Code

git.git
12 years agoMerge branch 'jk/maint-mv'
Junio C Hamano [Tue, 20 Dec 2011 00:05:34 +0000 (16:05 -0800)]
Merge branch 'jk/maint-mv'

* jk/maint-mv:
  mv: be quiet about overwriting
  mv: improve overwrite warning
  mv: make non-directory destination error more clear
  mv: honor --verbose flag
  docs: mention "-k" for both forms of "git mv"

12 years agoMerge branch 'ci/stripspace-docs'
Junio C Hamano [Tue, 20 Dec 2011 00:05:31 +0000 (16:05 -0800)]
Merge branch 'ci/stripspace-docs'

* ci/stripspace-docs:
  Update documentation for stripspace

12 years agoMerge branch 'rr/test-chaining'
Junio C Hamano [Tue, 20 Dec 2011 00:05:25 +0000 (16:05 -0800)]
Merge branch 'rr/test-chaining'

* rr/test-chaining:
  t3401: use test_commit in setup
  t3401: modernize style
  t3040 (subprojects-basic): fix '&&' chaining, modernize style
  t1510 (worktree): fix '&&' chaining
  t3030 (merge-recursive): use test_expect_code
  test: fix '&&' chaining
  t3200 (branch): fix '&&' chaining

12 years agoMerge branch 'tr/cache-tree'
Junio C Hamano [Tue, 20 Dec 2011 00:05:20 +0000 (16:05 -0800)]
Merge branch 'tr/cache-tree'

* tr/cache-tree:
  reset: update cache-tree data when appropriate
  commit: write cache-tree data when writing index anyway
  Refactor cache_tree_update idiom from commit
  Test the current state of the cache-tree optimization
  Add test-scrap-cache-tree

12 years agoMerge branch 'jk/credentials'
Junio C Hamano [Tue, 20 Dec 2011 00:05:16 +0000 (16:05 -0800)]
Merge branch 'jk/credentials'

* jk/credentials:
  t: add test harness for external credential helpers
  credentials: add "store" helper
  strbuf: add strbuf_add*_urlencode
  Makefile: unix sockets may not available on some platforms
  credentials: add "cache" helper
  docs: end-user documentation for the credential subsystem
  credential: make relevance of http path configurable
  credential: add credential.*.username
  credential: apply helper config
  http: use credential API to get passwords
  credential: add function for parsing url components
  introduce credentials API
  t5550: fix typo
  test-lib: add test_config_global variant

Conflicts:
strbuf.c

12 years agogit-p4: fix skipSubmitEdit regression
Pete Wyckoff [Sat, 17 Dec 2011 17:39:03 +0000 (12:39 -0500)]
git-p4: fix skipSubmitEdit regression

Commit 7c766e5 (git-p4: introduce skipSubmitEdit, 2011-12-04)
made it easier to automate submission to p4, but broke the most
common case.

Add a test for when the user really does edit and save the change
template, and fix the bug that causes the test to fail.

Also add a confirmation message when submission is cancelled.

Reported-by: Michael Horowitz <michael.horowitz@ieee.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUpdate draft release notes to 1.7.9
Junio C Hamano [Sat, 17 Dec 2011 06:45:03 +0000 (22:45 -0800)]
Update draft release notes to 1.7.9

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/commit-amend-no-edit'
Junio C Hamano [Sat, 17 Dec 2011 06:33:56 +0000 (22:33 -0800)]
Merge branch 'jc/commit-amend-no-edit'

* jc/commit-amend-no-edit:
  test: commit --amend should honor --no-edit
  commit: honour --no-edit
  t7501 (commit): modernize style
  test: remove a porcelain test that hard-codes commit names
  test: add missing "&&" after echo command

12 years agoMerge branch 'jc/stream-to-pack'
Junio C Hamano [Sat, 17 Dec 2011 06:33:40 +0000 (22:33 -0800)]
Merge branch 'jc/stream-to-pack'

* jc/stream-to-pack:
  bulk-checkin: replace fast-import based implementation
  csum-file: introduce sha1file_checkpoint
  finish_tmp_packfile(): a helper function
  create_tmp_packfile(): a helper function
  write_pack_header(): a helper function

Conflicts:
pack.h

12 years agoMerge branch 'aw/rebase-i-stop-on-failure-to-amend'
Junio C Hamano [Sat, 17 Dec 2011 06:33:37 +0000 (22:33 -0800)]
Merge branch 'aw/rebase-i-stop-on-failure-to-amend'

* aw/rebase-i-stop-on-failure-to-amend:
  rebase -i: interrupt rebase when "commit --amend" failed during "reword"

12 years agoMerge branch 'jh/fast-import-notes'
Junio C Hamano [Sat, 17 Dec 2011 06:33:34 +0000 (22:33 -0800)]
Merge branch 'jh/fast-import-notes'

* jh/fast-import-notes:
  fast-import: Fix incorrect fanout level when modifying existing notes refs
  t9301: Add 2nd testcase exposing bugs in fast-import's notes fanout handling
  t9301: Fix testcase covering up a bug in fast-import's notes fanout handling

12 years agoMerge branch 'jk/upload-archive-use-start-command'
Junio C Hamano [Sat, 17 Dec 2011 06:33:30 +0000 (22:33 -0800)]
Merge branch 'jk/upload-archive-use-start-command'

* jk/upload-archive-use-start-command:
  upload-archive: use start_command instead of fork

12 years agoMerge git://ozlabs.org/~paulus/gitk
Junio C Hamano [Sat, 17 Dec 2011 06:18:42 +0000 (22:18 -0800)]
Merge git://ozlabs.org/~paulus/gitk

* git://ozlabs.org/~paulus/gitk:
  gitk: Make vi-style keybindings more vi-like
  gitk: Make "touching paths" search support backslashes
  gitk: Show modified files with separate work tree
  gitk: Simplify calculation of gitdir
  gitk: Run 'git rev-parse --git-dir' only once
  gitk: Put temporary directory inside .git
  gitk: Fix "External diff" with separate work tree
  gitk: Fix "blame parent commit" with separate work tree
  gitk: Fix "show origin of this line" with separate work tree
  gitk: Fix file highlight when run in subdirectory
  gitk: Update copyright
  gitk: When a commit contains a note, mark it with a yellow box
  gitk: Remember time zones from author and commit timestamps
  gitk: Remove unused $cdate array

12 years agoUpdate draft release notes to 1.7.9
Junio C Hamano [Wed, 14 Dec 2011 07:09:27 +0000 (23:09 -0800)]
Update draft release notes to 1.7.9

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'ks/tag-cleanup'
Junio C Hamano [Wed, 14 Dec 2011 07:03:00 +0000 (23:03 -0800)]
Merge branch 'ks/tag-cleanup'

* ks/tag-cleanup:
  git-tag: introduce --cleanup option

Conflicts:
builtin/tag.c

12 years agoMerge branch 'jl/submodule-status-failure-report'
Junio C Hamano [Wed, 14 Dec 2011 07:00:52 +0000 (23:00 -0800)]
Merge branch 'jl/submodule-status-failure-report'

* jl/submodule-status-failure-report:
  diff/status: print submodule path when looking for changes fails

12 years agoMerge branch 'tr/userdiff-c-returns-pointer'
Junio C Hamano [Wed, 14 Dec 2011 06:57:19 +0000 (22:57 -0800)]
Merge branch 'tr/userdiff-c-returns-pointer'

* tr/userdiff-c-returns-pointer:
  userdiff: allow * between cpp funcname words

12 years agoMerge branch 'bc/maint-apply-check-no-patch'
Junio C Hamano [Wed, 14 Dec 2011 06:56:22 +0000 (22:56 -0800)]
Merge branch 'bc/maint-apply-check-no-patch'

* bc/maint-apply-check-no-patch:
  builtin/apply.c: report error on failure to recognize input
  t/t4131-apply-fake-ancestor.sh: fix broken test

12 years agoMerge branch 'nd/ignore-might-be-precious'
Junio C Hamano [Wed, 14 Dec 2011 06:55:07 +0000 (22:55 -0800)]
Merge branch 'nd/ignore-might-be-precious'

* nd/ignore-might-be-precious:
  checkout,merge: disallow overwriting ignored files with --no-overwrite-ignore

12 years agoMerge branch 'jn/branch-move-to-self'
Junio C Hamano [Wed, 14 Dec 2011 06:53:08 +0000 (22:53 -0800)]
Merge branch 'jn/branch-move-to-self'

* jn/branch-move-to-self:
  Allow checkout -B <current-branch> to update the current branch
  branch: allow a no-op "branch -M <current-branch> HEAD"

12 years agoMerge branch 'cn/maint-lf-to-crlf-filter'
Junio C Hamano [Wed, 14 Dec 2011 06:49:45 +0000 (22:49 -0800)]
Merge branch 'cn/maint-lf-to-crlf-filter'

* cn/maint-lf-to-crlf-filter:
  convert: track state in LF-to-CRLF filter

12 years agoMerge branch 'tj/maint-imap-send-remove-unused'
Junio C Hamano [Wed, 14 Dec 2011 06:49:19 +0000 (22:49 -0800)]
Merge branch 'tj/maint-imap-send-remove-unused'

* tj/maint-imap-send-remove-unused:
  imap-send: Remove unused 'use_namespace' variable

12 years agoMerge branch 'jk/maint-upload-archive'
Junio C Hamano [Wed, 14 Dec 2011 06:47:38 +0000 (22:47 -0800)]
Merge branch 'jk/maint-upload-archive'

* jk/maint-upload-archive:
  archive: don't let remote clients get unreachable commits

12 years agoMerge branch 'jn/gitweb-side-by-side-diff'
Junio C Hamano [Wed, 14 Dec 2011 06:46:57 +0000 (22:46 -0800)]
Merge branch 'jn/gitweb-side-by-side-diff'

* jn/gitweb-side-by-side-diff:
  gitweb: Add navigation to select side-by-side diff
  gitweb: Use href(-replay=>1,...) for formats links in "commitdiff"
  t9500: Add basic sanity tests for side-by-side diff in gitweb
  t9500: Add test for handling incomplete lines in diff by gitweb
  gitweb: Give side-by-side diff extra CSS styling
  gitweb: Add a feature to show side-by-side diff
  gitweb: Extract formatting of diff chunk header
  gitweb: Refactor diff body line classification

12 years agoMerge branch 'maint'
Junio C Hamano [Wed, 14 Dec 2011 06:18:00 +0000 (22:18 -0800)]
Merge branch 'maint'

* maint:
  Update draft release notes for 1.7.8.1
  Git 1.7.7.5
  Git 1.7.6.5
  blame: don't overflow time buffer
  fetch: create status table using strbuf

Conflicts:
RelNotes

12 years agoUpdate draft release notes for 1.7.8.1
Junio C Hamano [Wed, 14 Dec 2011 06:08:52 +0000 (22:08 -0800)]
Update draft release notes for 1.7.8.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/maint-pack-object-cycle' into maint
Junio C Hamano [Wed, 14 Dec 2011 06:04:50 +0000 (22:04 -0800)]
Merge branch 'jc/maint-pack-object-cycle' into maint

* jc/maint-pack-object-cycle:
  pack-object: tolerate broken packs that have duplicated objects

Conflicts:
builtin/pack-objects.c

12 years agoMerge branch 'jc/index-pack-reject-dups' into maint
Junio C Hamano [Wed, 14 Dec 2011 06:03:36 +0000 (22:03 -0800)]
Merge branch 'jc/index-pack-reject-dups' into maint

* jc/index-pack-reject-dups:
  receive-pack, fetch-pack: reject bogus pack that records objects twice

12 years agoMerge branch 'mf/curl-select-fdset' into maint
Junio C Hamano [Wed, 14 Dec 2011 06:03:17 +0000 (22:03 -0800)]
Merge branch 'mf/curl-select-fdset' into maint

* mf/curl-select-fdset:
  http: drop "local" member from request struct
  http.c: Rely on select instead of tracking whether data was received
  http.c: Use timeout suggested by curl instead of fixed 50ms timeout
  http.c: Use curl_multi_fdset to select on curl fds instead of just sleeping

12 years agoMerge branch 'nd/misc-cleanups' into maint
Junio C Hamano [Wed, 14 Dec 2011 06:02:51 +0000 (22:02 -0800)]
Merge branch 'nd/misc-cleanups' into maint

* nd/misc-cleanups:
  unpack_object_header_buffer(): clear the size field upon error
  tree_entry_interesting: make use of local pointer "item"
  tree_entry_interesting(): give meaningful names to return values
  read_directory_recursive: reduce one indentation level
  get_tree_entry(): do not call find_tree_entry() on an empty tree
  tree-walk.c: do not leak internal structure in tree_entry_len()

12 years agoMerge branch 'maint-1.7.7' into maint
Junio C Hamano [Wed, 14 Dec 2011 05:58:51 +0000 (21:58 -0800)]
Merge branch 'maint-1.7.7' into maint

* maint-1.7.7:
  Git 1.7.7.5
  Git 1.7.6.5
  blame: don't overflow time buffer
  fetch: create status table using strbuf
  checkout,merge: loosen overwriting untracked file check based on info/exclude
  cast variable in call to free() in builtin/diff.c and submodule.c
  apply: get rid of useless x < 0 comparison on a size_t type

Conflicts:
Documentation/git.txt
GIT-VERSION-GEN
RelNotes
builtin/fetch.c

12 years agoGit 1.7.7.5 v1.7.7.5
Junio C Hamano [Wed, 14 Dec 2011 05:55:31 +0000 (21:55 -0800)]
Git 1.7.7.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'ab/clang-lints' into maint-1.7.7
Junio C Hamano [Wed, 14 Dec 2011 05:47:51 +0000 (21:47 -0800)]
Merge branch 'ab/clang-lints' into maint-1.7.7

* ab/clang-lints:
  cast variable in call to free() in builtin/diff.c and submodule.c
  apply: get rid of useless x < 0 comparison on a size_t type

12 years agoMerge branch 'nd/maint-ignore-exclude' into maint-1.7.7
Junio C Hamano [Wed, 14 Dec 2011 05:47:08 +0000 (21:47 -0800)]
Merge branch 'nd/maint-ignore-exclude' into maint-1.7.7

* nd/maint-ignore-exclude:
  checkout,merge: loosen overwriting untracked file check based on info/exclude

12 years agoMerge branch 'maint-1.7.6' into maint-1.7.7
Junio C Hamano [Wed, 14 Dec 2011 05:44:56 +0000 (21:44 -0800)]
Merge branch 'maint-1.7.6' into maint-1.7.7

* maint-1.7.6:
  Git 1.7.6.5
  blame: don't overflow time buffer
  fetch: create status table using strbuf

Conflicts:
Documentation/git.txt
GIT-VERSION-GEN
RelNotes

12 years agoGit 1.7.6.5 v1.7.6.5
Junio C Hamano [Wed, 14 Dec 2011 05:30:40 +0000 (21:30 -0800)]
Git 1.7.6.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jk/maint-fetch-status-table' into maint-1.7.6
Junio C Hamano [Wed, 14 Dec 2011 05:21:30 +0000 (21:21 -0800)]
Merge branch 'jk/maint-fetch-status-table' into maint-1.7.6

* jk/maint-fetch-status-table:
  fetch: create status table using strbuf

12 years agoMerge branch 'jc/maint-name-rev-all' into maint-1.7.6
Junio C Hamano [Wed, 14 Dec 2011 05:12:34 +0000 (21:12 -0800)]
Merge branch 'jc/maint-name-rev-all' into maint-1.7.6

* jc/maint-name-rev-all:
  name-rev --all: do not even attempt to describe non-commit object

12 years agoMerge branch 'ml/mailmap' into maint-1.7.6
Junio C Hamano [Wed, 14 Dec 2011 05:12:14 +0000 (21:12 -0800)]
Merge branch 'ml/mailmap' into maint-1.7.6

* ml/mailmap:
  mailmap: xcalloc mailmap_info

Conflicts:
mailmap.c

12 years agoblame: don't overflow time buffer
Jeff King [Thu, 8 Dec 2011 10:25:54 +0000 (05:25 -0500)]
blame: don't overflow time buffer

When showing the raw timestamp, we format the numeric
seconds-since-epoch into a buffer, followed by the timezone
string. This string has come straight from the commit
object. A well-formed object should have a timezone string
of only a few bytes, but we could be operating on data
pushed by a malicious user.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'master' of git://repo.or.cz/git-gui
Junio C Hamano [Wed, 14 Dec 2011 00:48:24 +0000 (16:48 -0800)]
Merge branch 'master' of git://repo.or.cz/git-gui

* 'master' of git://repo.or.cz/git-gui: (28 commits)
  git-gui 0.16
  git-gui: handle shell script text filters when loading for blame.
  git-gui: Set both 16x16 and 32x32 icons on X to pacify Xming.
  git-gui: added config gui.gcwarning to disable the gc hint message
  git-gui: set whitespace warnings appropriate to this project
  git-gui: don't warn for detached head when rebasing
  git-gui: make config gui.warndetachedcommit a boolean
  git-gui: add config value gui.diffopts for passing additional diff options
  git-gui: sort the numeric ansi codes
  git-gui: support underline style when parsing diff output
  git-gui: fix spelling error in sshkey.tcl
  git-gui: include the file path in guitools confirmation dialog
  git-gui: span widgets over the full file output area in the blame view
  git-gui: use a tristate to control the case mode in the searchbar
  git-gui: set suitable extended window manager hints.
  git-gui: fix display of path in browser title
  git-gui: enable the smart case sensitive search only if gui.search.smartcase is true
  git-gui: catch invalid or complete regular expressions and treat as no match.
  git-gui: theme the search and line-number entry fields on blame screen
  git-gui: include the number of untracked files to stage when asking the user
  ...

12 years agogit-gui 0.16 gitgui-0.16.0
Pat Thoyts [Tue, 13 Dec 2011 23:44:30 +0000 (23:44 +0000)]
git-gui 0.16

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
12 years agoUpdate documentation for stripspace
Conrad Irwin [Mon, 12 Dec 2011 23:52:51 +0000 (15:52 -0800)]
Update documentation for stripspace

Tell the user what this command is intended for, and expand the
description of what it does.

Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot: add test harness for external credential helpers
Jeff King [Sat, 10 Dec 2011 10:35:55 +0000 (05:35 -0500)]
t: add test harness for external credential helpers

We already have tests for the internal helpers, but it's
nice to give authors of external tools an easy way to
sanity-check their helpers.

If you have written the "git-credential-foo" helper, you can
do so with:

  GIT_TEST_CREDENTIAL_HELPER=foo \
  make t0303-credential-external.sh

This assumes that your helper is capable of both storing and
retrieving credentials (some helpers may be read-only, and
they will fail these tests).

If your helper supports time-based expiration with a
configurable timeout, you can test that feature like this:

  GIT_TEST_CREDENTIAL_HELPER_TIMEOUT="foo --timeout=1" \
  make t0303-credential-external.sh

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocredentials: add "store" helper
Jeff King [Sat, 10 Dec 2011 10:34:44 +0000 (05:34 -0500)]
credentials: add "store" helper

This is like "cache", except that we actually put the
credentials on disk. This can be terribly insecure, of
course, but we do what we can to protect them by filesystem
permissions, and we warn the user in the documentation.

This is not unlike using .netrc to store entries, but it's a
little more user-friendly. Instead of putting credentials in
place ahead of time, we transparently store them after
prompting the user for them once.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agostrbuf: add strbuf_add*_urlencode
Jeff King [Sat, 10 Dec 2011 10:34:20 +0000 (05:34 -0500)]
strbuf: add strbuf_add*_urlencode

This just follows the rfc3986 rules for percent-encoding
url data into a strbuf.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMakefile: unix sockets may not available on some platforms
Johannes Sixt [Mon, 12 Dec 2011 21:12:56 +0000 (22:12 +0100)]
Makefile: unix sockets may not available on some platforms

Introduce a configuration option NO_UNIX_SOCKETS to exclude code that
depends on Unix sockets and use it in MSVC and MinGW builds.

Notice that unix-socket.h was missing from LIB_H before; fix that, too.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agomv: be quiet about overwriting
Jeff King [Mon, 12 Dec 2011 21:54:42 +0000 (16:54 -0500)]
mv: be quiet about overwriting

When a user asks us to force a mv and overwrite the
destination, we print a warning. However, since a typical
use would be:

  $ git mv one two
  fatal: destination exists, source=one, destination=two
  $ git mv -f one two
  warning: overwriting 'two'

this warning is just noise. We already know we're
overwriting; that's why we gave -f!

This patch silences the warning unless "--verbose" is given.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agomv: improve overwrite warning
Jeff King [Mon, 12 Dec 2011 21:54:17 +0000 (16:54 -0500)]
mv: improve overwrite warning

When we try to "git mv" over an existing file, the error
message is fairly informative:

  $ git mv one two
  fatal: destination exists, source=one, destination=two

When the user forces the overwrite, we give a warning:

  $ git mv -f one two
  warning: destination exists; will overwrite!

This is less informative, but still sufficient in the simple
rename case, as there is only one rename happening.

But when moving files from one directory to another, it
becomes useless:

  $ mkdir three
  $ touch one two three/one
  $ git add .
  $ git mv one two three
  fatal: destination exists, source=one, destination=three/one
  $ git mv -f one two three
  warning: destination exists; will overwrite!

The first message is helpful, but the second one gives us no
clue about what was overwritten. Let's mention the name of
the destination file:

  $ git mv -f one two three
  warning: overwriting 'three/one'

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agomv: make non-directory destination error more clear
Jeff King [Mon, 12 Dec 2011 07:51:36 +0000 (02:51 -0500)]
mv: make non-directory destination error more clear

If you try to "git mv" multiple files onto another
non-directory file, you confusingly get the "usage" message:

  $ touch one two three
  $ git add .
  $ git mv one two three
  usage: git mv [options] <source>... <destination>
  [...]

From the user's perspective, that makes no sense. They just
gave parameters that exactly match that usage!

This behavior dates back to the original C version of "git
mv", which had a usage message like:

  usage: git mv (<source> <destination> | <source>...  <destination>)

This was slightly less confusing, because it at least
mentions that there are two ways to invoke (but it still
isn't clear why what the user provided doesn't work).

Instead, let's show an error message like:

  $ git mv one two three
  fatal: destination 'three' is not a directory

We could leave the usage message in place, too, but it
doesn't actually help here. It contains no hints that there
are two forms, nor that multi-file form requires that the
endpoint be a directory. So it just becomes useless noise
that distracts from the real error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agomv: honor --verbose flag
Jeff King [Mon, 12 Dec 2011 07:51:24 +0000 (02:51 -0500)]
mv: honor --verbose flag

The code for a verbose flag has been here since "git mv" was
converted to C many years ago, but actually getting the "-v"
flag from the command line was accidentally lost in the
transition.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodocs: mention "-k" for both forms of "git mv"
Jeff King [Mon, 12 Dec 2011 07:50:31 +0000 (02:50 -0500)]
docs: mention "-k" for both forms of "git mv"

The "git mv" synopsis shows two forms: renaming a file, and
moving files into a directory. They can both make use of the
"-k" flag to ignore errors, so mention it in both places.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocredentials: add "cache" helper
Jeff King [Sat, 10 Dec 2011 10:34:14 +0000 (05:34 -0500)]
credentials: add "cache" helper

If you access repositories over smart-http using http
authentication, then it can be annoying to have git ask you
for your password repeatedly. We cache credentials in
memory, of course, but git is composed of many small
programs. Having to input your password for each one can be
frustrating.

This patch introduces a credential helper that will cache
passwords in memory for a short period of time.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodocs: end-user documentation for the credential subsystem
Jeff King [Sat, 10 Dec 2011 10:31:38 +0000 (05:31 -0500)]
docs: end-user documentation for the credential subsystem

The credential API and helper format is already defined in
technical/api-credentials.txt.  This presents the end-user
view.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocredential: make relevance of http path configurable
Jeff King [Sat, 10 Dec 2011 10:31:34 +0000 (05:31 -0500)]
credential: make relevance of http path configurable

When parsing a URL into a credential struct, we carefully
record each part of the URL, including the path on the
remote host, and use the result as part of the credential
context.

This had two practical implications:

  1. Credential helpers which store a credential for later
     access are likely to use the "path" portion as part of
     the storage key. That means that a request to

       https://example.com/foo.git

     would not use the same credential that was stored in an
     earlier request for:

       https://example.com/bar.git

  2. The prompt shown to the user includes all relevant
     context, including the path.

In most cases, however, users will have a single password
per host. The behavior in (1) will be inconvenient, and the
prompt in (2) will be overly long.

This patch introduces a config option to toggle the
relevance of http paths. When turned on, we use the path as
before. When turned off, we drop the path component from the
context: helpers don't see it, and it does not appear in the
prompt.

This is nothing you couldn't do with a clever credential
helper at the start of your stack, like:

  [credential "http://"]
helper = "!f() { grep -v ^path= ; }; f"
helper = your_real_helper

But doing this:

  [credential]
useHttpPath = false

is way easier and more readable. Furthermore, since most
users will want the "off" behavior, that is the new default.
Users who want it "on" can set the variable (either for all
credentials, or just for a subset using
credential.*.useHttpPath).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocredential: add credential.*.username
Jeff King [Sat, 10 Dec 2011 10:31:30 +0000 (05:31 -0500)]
credential: add credential.*.username

Credential helpers can help users avoid having to type their
username and password over and over. However, some users may
not want a helper for their password, or they may be running
a helper which caches for a short time. In this case, it is
convenient to provide the non-secret username portion of
their credential via config.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocredential: apply helper config
Jeff King [Sat, 10 Dec 2011 10:31:24 +0000 (05:31 -0500)]
credential: apply helper config

The functionality for credential storage helpers is already
there; we just need to give the users a way to turn it on.
This patch provides a "credential.helper" configuration
variable which allows the user to provide one or more helper
strings.

Rather than simply matching credential.helper, we will also
compare URLs in subsection headings to the current context.
This means you can apply configuration to a subset of
credentials. For example:

  [credential "https://example.com"]
helper = foo

would match a request for "https://example.com/foo.git", but
not one for "https://kernel.org/foo.git".

This is overkill for the "helper" variable, since users are
unlikely to want different helpers for different sites (and
since helpers run arbitrary code, they could do the matching
themselves anyway).

However, future patches will add new config variables where
this extra feature will be more useful.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agohttp: use credential API to get passwords
Jeff King [Sat, 10 Dec 2011 10:31:21 +0000 (05:31 -0500)]
http: use credential API to get passwords

This patch converts the http code to use the new credential
API, both for http authentication as well as for getting
certificate passwords.

Most of the code change is simply variable naming (the
passwords are now contained inside the credential struct)
or deletion of obsolete code (the credential code handles
URL parsing and prompting for us).

The behavior should be the same, with one exception: the
credential code will prompt with a description based on the
credential components. Therefore, the old prompt of:

  Username for 'example.com':
  Password for 'example.com':

now looks like:

  Username for 'https://example.com/repo.git':
  Password for 'https://user@example.com/repo.git':

Note that we include more information in each line,
specifically:

  1. We now include the protocol. While more noisy, this is
     an important part of knowing what you are accessing
     (especially if you care about http vs https).

  2. We include the username in the password prompt. This is
     not a big deal when you have just been prompted for it,
     but the username may also come from the remote's URL
     (and after future patches, from configuration or
     credential helpers).  In that case, it's a nice
     reminder of the user for which you're giving the
     password.

  3. We include the path component of the URL. In many
     cases, the user won't care about this and it's simply
     noise (i.e., they'll use the same credential for a
     whole site). However, that is part of a larger
     question, which is whether path components should be
     part of credential context, both for prompting and for
     lookup by storage helpers. That issue will be addressed
     as a whole in a future patch.

Similarly, for unlocking certificates, we used to say:

  Certificate Password for 'example.com':

and we now say:

  Password for 'cert:///path/to/certificate':

Showing the path to the client certificate makes more sense,
as that is what you are unlocking, not "example.com".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocredential: add function for parsing url components
Jeff King [Sat, 10 Dec 2011 10:31:17 +0000 (05:31 -0500)]
credential: add function for parsing url components

All of the components of a credential struct can be found in
a URL.  For example, the URL:

  http://foo:bar@example.com/repo.git

contains:

  protocol=http
  host=example.com
  path=repo.git
  username=foo
  password=bar

We want to be able to turn URLs into broken-down credential
structs so that we know two things:

  1. Which parts of the username/password we still need

  2. What the context of the request is (for prompting or
     as a key for storing credentials).

This code is based on http_auth_init in http.c, but needed a
few modifications in order to get all of the components that
the credential object is interested in.

Once the http code is switched over to the credential API,
then http_auth_init can just go away.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agointroduce credentials API
Jeff King [Sat, 10 Dec 2011 10:31:11 +0000 (05:31 -0500)]
introduce credentials API

There are a few places in git that need to get a username
and password credential from the user; the most notable one
is HTTP authentication for smart-http pushing.

Right now the only choices for providing credentials are to
put them plaintext into your ~/.netrc, or to have git prompt
you (either on the terminal or via an askpass program). The
former is not very secure, and the latter is not very
convenient.

Unfortunately, there is no "always best" solution for
password management. The details will depend on the tradeoff
you want between security and convenience, as well as how
git can integrate with other security systems (e.g., many
operating systems provide a keychain or password wallet for
single sign-on).

This patch provides an abstract notion of credentials as a
data item, and provides three basic operations:

  - fill (i.e., acquire from external storage or from the
    user)

  - approve (mark a credential as "working" for further
    storage)

  - reject (mark a credential as "not working", so it can
    be removed from storage)

These operations can be backed by external helper processes
that interact with system- or user-specific secure storage.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot5550: fix typo
Jeff King [Sat, 10 Dec 2011 10:30:10 +0000 (05:30 -0500)]
t5550: fix typo

This didn't have an impact, because it was just setting up
an "expect" file that happened to be identical to the one in
the test before it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agotest-lib: add test_config_global variant
Jeff King [Sat, 10 Dec 2011 10:30:06 +0000 (05:30 -0500)]
test-lib: add test_config_global variant

The point of test_config is to simultaneously set a config
variable and register its cleanup handler, like:

  test_config core.foo bar

However, it stupidly assumes that $1 contained the name of
the variable, which means it won't work for:

  test_config --global core.foo bar

We could try to parse the command-line ourselves and figure
out which parts need to be fed to test_unconfig. But since
this is likely the most common variant, it's much simpler
and less error-prone to simply add a new function.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot3401: use test_commit in setup
Martin von Zweigbergk [Sat, 10 Dec 2011 08:17:54 +0000 (00:17 -0800)]
t3401: use test_commit in setup

Simplify t3401 by using test_commit in the setup. This lets us refer
to commits using their tags and there is no longer a need to create
the branch my-topic-branch-merge. Also, the branch master-merge points
to the same commit as master (even before this change), so that branch
does not need to be created either.

While at it, replace "test ! -d" by "test_path_is_missing".

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot3401: modernize style
Martin von Zweigbergk [Fri, 9 Dec 2011 16:59:11 +0000 (08:59 -0800)]
t3401: modernize style

Put the opening quote starting each test on the same line as the
test_expect_* invocation. Also make sure to use tabs for indentation.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: test for absolute PWD problem
Pete Wyckoff [Fri, 9 Dec 2011 23:48:17 +0000 (18:48 -0500)]
git-p4: test for absolute PWD problem

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: use absolute directory for PWD env var
Gary Gibbons [Fri, 9 Dec 2011 23:48:16 +0000 (18:48 -0500)]
git-p4: use absolute directory for PWD env var

P4 only looks at the environment variable $PWD to figure out
where it is, so chdir() has code to set that every time.  But
when the clone --destination is not an absolute path, PWD will
not be absolute and P4 won't be able to find any files expected
to be in the current directory.  Fix this by expanding PWD to
an absolute path.

One place this crops up is when using a P4CONFIG environment
variable to specify P4 parameters, such as P4USER or P4PORT.
Setting P4CONFIG=.p4config works for p4 invocations from the
current directory.  But if the value of PWD is not absolute, it
fails.

[ update description --pw ]

Signed-off-by: Gary Gibbons <ggibbons@perforce.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: submit test for auto-creating clientPath
Pete Wyckoff [Fri, 9 Dec 2011 23:48:15 +0000 (18:48 -0500)]
git-p4: submit test for auto-creating clientPath

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: ensure submit clientPath exists before chdir
Gary Gibbons [Fri, 9 Dec 2011 23:48:14 +0000 (18:48 -0500)]
git-p4: ensure submit clientPath exists before chdir

Submitting patches back to p4 requires a p4 "client".  This
is a mapping from server depot paths into a local directory.
The directory need not exist or be populated with files; only
the mapping on the server is required.  When there is no
directory, make git-p4 automatically create it.

[ reword description --pw ]

Signed-off-by: Gary Gibbons <ggibbons@perforce.com>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agofetch: create status table using strbuf
Jeff King [Thu, 8 Dec 2011 08:43:19 +0000 (03:43 -0500)]
fetch: create status table using strbuf

When we fetch from a remote, we print a status table like:

  From url
   * [new branch]   foo -> origin/foo

We create this table in a static buffer using sprintf. If
the remote refnames are long, they can overflow this buffer
and smash the stack.

Instead, let's use a strbuf to build the string.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUpdate draft release notes for 1.7.9
Junio C Hamano [Fri, 9 Dec 2011 21:52:36 +0000 (13:52 -0800)]
Update draft release notes for 1.7.9

The first two of more important topics slated for 1.7.9 have been merged.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'sg/complete-refs'
Junio C Hamano [Fri, 9 Dec 2011 21:37:18 +0000 (13:37 -0800)]
Merge branch 'sg/complete-refs'

* sg/complete-refs:
  completion: remove broken dead code from __git_heads() and __git_tags()
  completion: fast initial completion for config 'remote.*.fetch' value
  completion: improve ls-remote output filtering in __git_refs_remotes()
  completion: query only refs/heads/ in __git_refs_remotes()
  completion: support full refs from remote repositories
  completion: improve ls-remote output filtering in __git_refs()
  completion: make refs completion consistent for local and remote repos
  completion: optimize refs completion
  completion: document __gitcomp()

Conflicts:
contrib/completion/git-completion.bash

12 years agoMerge branch 'nd/resolve-ref'
Junio C Hamano [Fri, 9 Dec 2011 21:37:14 +0000 (13:37 -0800)]
Merge branch 'nd/resolve-ref'

* nd/resolve-ref:
  Copy resolve_ref() return value for longer use
  Convert many resolve_ref() calls to read_ref*() and ref_exists()

Conflicts:
builtin/fmt-merge-msg.c
builtin/merge.c
refs.c

12 years agoMerge branch 'jc/pull-signed-tag'
Junio C Hamano [Fri, 9 Dec 2011 21:37:09 +0000 (13:37 -0800)]
Merge branch 'jc/pull-signed-tag'

* jc/pull-signed-tag:
  commit-tree: teach -m/-F options to read logs from elsewhere
  commit-tree: update the command line parsing
  commit: teach --amend to carry forward extra headers
  merge: force edit and no-ff mode when merging a tag object
  commit: copy merged signed tags to headers of merge commit
  merge: record tag objects without peeling in MERGE_HEAD
  merge: make usage of commit->util more extensible
  fmt-merge-msg: Add contents of merged tag in the merge message
  fmt-merge-msg: package options into a structure
  fmt-merge-msg: avoid early returns
  refs DWIMmery: use the same rule for both "git fetch" and others
  fetch: allow "git fetch $there v1.0" to fetch a tag
  merge: notice local merging of tags and keep it unwrapped
  fetch: do not store peeled tag object names in FETCH_HEAD
  Split GPG interface into its own helper library

Conflicts:
builtin/fmt-merge-msg.c
builtin/merge.c

12 years agoMerge branch 'jc/request-pull-show-head-4'
Junio C Hamano [Fri, 9 Dec 2011 21:37:05 +0000 (13:37 -0800)]
Merge branch 'jc/request-pull-show-head-4'

* jc/request-pull-show-head-4:
  request-pull: use the annotated tag contents
  fmt-merge-msg.c: Fix an "dubious one-bit signed bitfield" sparse error
  environment.c: Fix an sparse "symbol not declared" warning
  builtin/log.c: Fix an "Using plain integer as NULL pointer" warning
  fmt-merge-msg: use branch.$name.description
  request-pull: use the branch description
  request-pull: state what commit to expect
  request-pull: modernize style
  branch: teach --edit-description option
  format-patch: use branch description in cover letter
  branch: add read_branch_desc() helper function

Conflicts:
builtin/branch.c

12 years agoMerge branch 'ab/pull-rebase-config'
Junio C Hamano [Fri, 9 Dec 2011 21:37:01 +0000 (13:37 -0800)]
Merge branch 'ab/pull-rebase-config'

* ab/pull-rebase-config:
  pull: introduce a pull.rebase option to enable --rebase

12 years agoMerge branch 'rs/allocate-cache-entry-individually'
Junio C Hamano [Fri, 9 Dec 2011 21:36:56 +0000 (13:36 -0800)]
Merge branch 'rs/allocate-cache-entry-individually'

* rs/allocate-cache-entry-individually:
  cache.h: put single NUL at end of struct cache_entry
  read-cache.c: allocate index entries individually

Conflicts:
read-cache.c

12 years agoMerge branch 'maint'
Junio C Hamano [Fri, 9 Dec 2011 21:34:18 +0000 (13:34 -0800)]
Merge branch 'maint'

* maint:
  am: don't persist keepcr flag
  mingw: give waitpid the correct signature
  git symbolic-ref: documentation fix

12 years agoMerge branch 'maint-1.7.7' into maint
Junio C Hamano [Fri, 9 Dec 2011 21:33:39 +0000 (13:33 -0800)]
Merge branch 'maint-1.7.7' into maint

* maint-1.7.7:
  am: don't persist keepcr flag
  mingw: give waitpid the correct signature
  git symbolic-ref: documentation fix

12 years agot3040 (subprojects-basic): fix '&&' chaining, modernize style
Ramkumar Ramachandra [Fri, 9 Dec 2011 11:29:13 +0000 (16:59 +0530)]
t3040 (subprojects-basic): fix '&&' chaining, modernize style

Breaks in a test assertion's && chain can potentially hide failures
from earlier commands in the chain.  Fix instances of this.  While at
it, clean up the style to fit the prevailing style.  This means:

- Put the opening quote starting each test on the same line as the
  test_expect_* invocation.

- Indent the file with tabs, not spaces.

- Use test_expect_code() in preference to checking the exit status of
  various statements by hand.

- Guard commands that prepare test input for individual tests in the
  same test_expect_success, so that their scope is clearer and errors
  at that stage can be caught.

- Use <<-\EOF in preference to <<EOF to save readers the trouble of
  looking for variable interpolations.

- Include "setup" in the titles of test assertions that prepare for
  later ones to make it more obvious which tests can be skipped.

Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoam: don't persist keepcr flag
Martin von Zweigbergk [Fri, 9 Dec 2011 07:30:45 +0000 (23:30 -0800)]
am: don't persist keepcr flag

The keepcr flag is only used in the split_patches function, which is
only called before a patch application has to stopped for user input,
not after resuming. It is therefore unnecessary to persist the
flag. This seems to have been the case since it was introduced in
ad2c928 (git-am: Add command line parameter `--keep-cr` passing it to
git-mailsplit, 2010-02-27).

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agomingw: give waitpid the correct signature
Erik Faye-Lund [Thu, 8 Dec 2011 19:39:57 +0000 (20:39 +0100)]
mingw: give waitpid the correct signature

POSIX says that last parameter to waitpid should be 'int',
so let's make it so.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot1510 (worktree): fix '&&' chaining
Ramkumar Ramachandra [Thu, 8 Dec 2011 13:10:16 +0000 (18:40 +0530)]
t1510 (worktree): fix '&&' chaining

Breaks in a test assertion's && chain can potentially hide failures
from earlier commands in the chain.

'unset' returns non-zero status when the variable passed was already unset
on some shells; we need to change these instances to 'sane_unset'.

Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot3030 (merge-recursive): use test_expect_code
Ramkumar Ramachandra [Thu, 8 Dec 2011 13:10:13 +0000 (18:40 +0530)]
t3030 (merge-recursive): use test_expect_code

Use test_expect_code in preference to repeatedly checking exit codes
by hand.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-tag: introduce --cleanup option
Kirill A. Shutemov [Wed, 7 Dec 2011 03:01:45 +0000 (05:01 +0200)]
git-tag: introduce --cleanup option

Normally git tag strips tag message lines starting with '#', trailing
spaces from every line and empty lines from the beginning and end.

--cleanup allows to select different cleanup modes for tag message.
It provides the same interface as --cleanup option in git-commit.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-gui: handle shell script text filters when loading for blame.
Pat Thoyts [Fri, 9 Dec 2011 15:14:32 +0000 (15:14 +0000)]
git-gui: handle shell script text filters when loading for blame.

When loading a file into the blame window git-gui does all the work and
must handle the text conversion filters if defined. On Windows it is
necessary to detect the need for a shell script explicitly.

Such filter commands are run using non-blocking I/O but this has the
unfortunate side effect of losing any error that might be reported when
the pipe is closed. Switching to blocking mode just before closing
enables reporting of errors in the filter scripts to the user.

Tested-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
12 years agotest: fix '&&' chaining
Ramkumar Ramachandra [Thu, 8 Dec 2011 13:10:17 +0000 (18:40 +0530)]
test: fix '&&' chaining

Breaks in a test assertion's && chain can potentially hide failures from
earlier commands in the chain by adding " &&" at the end of line to the
commands that need them.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot3200 (branch): fix '&&' chaining
Ramkumar Ramachandra [Thu, 8 Dec 2011 13:10:15 +0000 (18:40 +0530)]
t3200 (branch): fix '&&' chaining

Breaks in a test assertion's && chain can potentially hide failures
from earlier commands in the chain.  Fix these breaks.

The 'git branch --help' in the test may fail if git manual pages are
not installed, but the point of the test is to make sure it does not
create a bogus branch "--help", so run it under 'test_might_fail'.

Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agotest: commit --amend should honor --no-edit
Jonathan Nieder [Wed, 7 Dec 2011 14:54:14 +0000 (08:54 -0600)]
test: commit --amend should honor --no-edit

A quick test to make sure git doesn't lose the functionality added by
the recent patch "commit: honor --no-edit", plus another test to check
the classical --edit use case (use with "-m").

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocommit: honour --no-edit
Junio C Hamano [Tue, 6 Dec 2011 21:09:55 +0000 (13:09 -0800)]
commit: honour --no-edit

After making fixes to the contents to be committed, it is not unusual to
update the current commit without rewording the message. Idioms to tell
"commit --amend" that we do not need an editor have been:

    $ EDITOR=: git commit --amend
    $ git commit --amend -C HEAD

but that was only because a more natural "--no-edit" option in

    $ git commit --amend --no-edit

was not honoured.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot7501 (commit): modernize style
Jonathan Nieder [Wed, 7 Dec 2011 14:50:23 +0000 (08:50 -0600)]
t7501 (commit): modernize style

Put the opening quote starting each test on the same line as the
test_expect_* invocation.  While at it:

- guard commands that prepare test input for individual tests in
  the same test_expect_success, so their scope is clearer and
  errors at that stage can be caught;
- use the compare_diff_patch helper function when comparing patches;
- use single-quotes in preference to double-quotes and <<\EOF in
  preference to <<EOF, to save readers the trouble of looking for
  variable interpolations;
- lift the setting of the $author variable used throughout the
  test script to the top of the test script;
- include "setup" in the titles of test assertions that prepare for
  later ones to make it more obvious which tests can be skipped;
- use test_must_fail instead of "if ...; then:; else false; fi",
  for clarity and to catch segfaults when they happen;
- break up some pipelines into separate commands that read and write
  to ordinary files, and test the exit status at each stage;
- chain commands with &&.  Breaks in a test assertion's && chain can
  potentially hide failures from earlier commands in the chain;
- combine two initial tests that do not make as much sense alone.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agotest: remove a porcelain test that hard-codes commit names
Jonathan Nieder [Wed, 7 Dec 2011 14:49:29 +0000 (08:49 -0600)]
test: remove a porcelain test that hard-codes commit names

The rev-list output in this test depends on the details of test_tick's
dummy dates and the choice of hash function.  Worse, it depends on the
order and nature of commits made in the earlier tests, so adding new
tests or rearranging existing ones breaks it.

It would be nice to check that "git commit" and commit-tree name
objects consistently and that commit objects' text is as documented,
but this particular test checks everything at once and hence is not a
robust test for that.  Remove it.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agotest: add missing "&&" after echo command
Jonathan Nieder [Wed, 7 Dec 2011 14:45:40 +0000 (08:45 -0600)]
test: add missing "&&" after echo command

This test wants to modify a file and commit the change, but because of
a missing separator between commands it is parsed as a single "echo"
command.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodiff/status: print submodule path when looking for changes fails
Jens Lehmann [Wed, 7 Dec 2011 21:50:14 +0000 (22:50 +0100)]
diff/status: print submodule path when looking for changes fails

diff and status run "git status --porcelain" inside each populated
submodule to see if it contains changes (unless told not to do so via
config or command line option). When that fails, e.g. due to a corrupt
submodule .git directory, it just prints "git status --porcelain failed"
or "Could not run git status --porcelain" without giving the user a clue
where that happened.

Add '"in submodule %s", path' to these error strings to tell the user
where exactly the problem occurred.

Reported-by: Seth Robertson <in-gitvger@baka.org>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit symbolic-ref: documentation fix
Michael Haggerty [Wed, 7 Dec 2011 15:20:16 +0000 (16:20 +0100)]
git symbolic-ref: documentation fix

The old "git symbolic-ref" manpage seemed to imply in one place that
symlinks are still the default way to represent symbolic references
and in another that symlinks are deprecated.  Fix the text and shorten
the justification for the change of implementation.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-gui: Set both 16x16 and 32x32 icons on X to pacify Xming.
Samuel Bronson [Wed, 7 Dec 2011 12:48:04 +0000 (12:48 +0000)]
git-gui: Set both 16x16 and 32x32 icons on X to pacify Xming.

It would be better if the 32x32 icon was equivalent to the one used on
Windows (in git-gui.ico), but I'm not sure how that would best be done,
so I copied this code from gitk instead.

Signed-off-by: Samuel Bronson <naesten@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
12 years agoreset: update cache-tree data when appropriate
Thomas Rast [Tue, 6 Dec 2011 17:43:39 +0000 (18:43 +0100)]
reset: update cache-tree data when appropriate

In the case of --mixed and --hard, we throw away the old index and
rebuild everything from the tree argument (or HEAD).  So we have an
opportunity here to fill in the cache-tree data, just as read-tree
did.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocommit: write cache-tree data when writing index anyway
Thomas Rast [Tue, 6 Dec 2011 17:43:38 +0000 (18:43 +0100)]
commit: write cache-tree data when writing index anyway

In prepare_index(), we refresh the index, and then write it to disk if
this changed the index data.  After running hooks we re-read the index
and compute the root tree sha1 with the cache-tree machinery.

This gives us a mostly free opportunity to write up-to-date cache-tree
data: we can compute it in prepare_index() immediately before writing
the index to disk.

If we do this, we were going to write the index anyway, and the later
cache-tree update has no further work to do.  If we don't do it, we
don't do any extra work, though we still don't have have cache-tree
data after the commit.

The only case that suffers badly is when the pre-commit hook changes
many trees in the index.  I'm writing this off as highly unusual.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoRefactor cache_tree_update idiom from commit
Thomas Rast [Tue, 6 Dec 2011 17:43:37 +0000 (18:43 +0100)]
Refactor cache_tree_update idiom from commit

We'll need to safely create or update the cache-tree data of the_index
from other places.  While at it, give it an argument that lets us
silence the messages produced by unmerged entries (which prevent it
from working).

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoTest the current state of the cache-tree optimization
Thomas Rast [Tue, 6 Dec 2011 17:43:36 +0000 (18:43 +0100)]
Test the current state of the cache-tree optimization

The cache-tree optimization originally helped speed up write-tree
operation.  However, many commands no longer properly maintain -- or
use an opportunity to cheaply generate -- the cache-tree data.  In
particular, this affects commit, checkout and reset.  The notable
examples that *do* write cache-tree data are read-tree and write-tree.

This sadly means most people no longer benefit from the optimization,
as they would not normally use the plumbing commands.

Document the current state of affairs in a test file, in preparation
for improvements in the area.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoAdd test-scrap-cache-tree
Thomas Rast [Tue, 6 Dec 2011 17:43:35 +0000 (18:43 +0100)]
Add test-scrap-cache-tree

A simple utility that invalidates all existing cache-tree data.  We
need this for tests.  (We don't need a tool to rebuild the cache-tree
data; git read-tree HEAD works for that.)

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>