Code

git.git
14 years agodiff: make sure --output=/bad/path is caught
Larry D'Anna [Tue, 16 Feb 2010 04:10:45 +0000 (23:10 -0500)]
diff: make sure --output=/bad/path is caught

The return value from fopen wasn't being checked.

Signed-off-by: Larry D'Anna <larry@elder-gods.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot8003: check exit code of command and error message separately
Junio C Hamano [Tue, 9 Feb 2010 18:06:33 +0000 (10:06 -0800)]
t8003: check exit code of command and error message separately

Shell reports exit status only from the most downstream command
in a pipeline.  In these tests, we want to make sure that the
command fails in a controlled way, and produces a correct error
message.

This issue was known by Jay who submitted the patch, and also was
pointed out by Hannes during the review process, but I forgot to
fix it up before applying.  Sorry about that.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoblame: prevent a segv when -L given start > EOF
Jay Soffian [Tue, 9 Feb 2010 03:48:13 +0000 (22:48 -0500)]
blame: prevent a segv when -L given start > EOF

blame would segv if given -L <lineno> with <lineno> past the end of the file.
While we're fixing the bug, add test cases for an invalid <start> when called
as -L <start>,<end> or -L<start>.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'sb/maint-octopus' into maint-1.6.5
Junio C Hamano [Mon, 1 Feb 2010 08:06:11 +0000 (00:06 -0800)]
Merge branch 'sb/maint-octopus' into maint-1.6.5

* sb/maint-octopus:
  octopus: remove dead code
  octopus: reenable fast-forward merges
  octopus: make merge process simpler to follow

14 years agoMerge branch 'bg/maint-add-all-doc' into maint-1.6.5
Junio C Hamano [Mon, 1 Feb 2010 08:04:12 +0000 (00:04 -0800)]
Merge branch 'bg/maint-add-all-doc' into maint-1.6.5

* bg/maint-add-all-doc:
  git-rm doc: Describe how to sync index & work tree
  git-add/rm doc: Consistently back-quote
  Documentation: 'git add -A' can remove files

14 years agofix memcpy of overlapping area
Jeff King [Fri, 29 Jan 2010 10:28:44 +0000 (05:28 -0500)]
fix memcpy of overlapping area

Caught by valgrind in t5500, but it is pretty obvious from
reading the code that this is shifting elements of an array
to the left, which needs memmove.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGit 1.6.5.8 v1.6.5.8
Junio C Hamano [Wed, 20 Jan 2010 20:44:59 +0000 (12:44 -0800)]
Git 1.6.5.8

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'jk/maint-1.6.5-reset-hard' into maint-1.6.5
Junio C Hamano [Wed, 20 Jan 2010 20:22:58 +0000 (12:22 -0800)]
Merge branch 'jk/maint-1.6.5-reset-hard' into maint-1.6.5

* jk/maint-1.6.5-reset-hard:
  reset: unbreak hard resets with GIT_WORK_TREE

14 years agoMerge branch 'tr/maint-1.6.5-bash-prompt-show-submodule-changes' into maint-1.6.5
Junio C Hamano [Wed, 20 Jan 2010 20:22:54 +0000 (12:22 -0800)]
Merge branch 'tr/maint-1.6.5-bash-prompt-show-submodule-changes' into maint-1.6.5

* tr/maint-1.6.5-bash-prompt-show-submodule-changes:
  bash completion: factor submodules into dirty state

14 years agoMerge branch 'dp/maint-1.6.5-fast-import-non-commit-tag' into maint-1.6.5
Junio C Hamano [Wed, 20 Jan 2010 20:17:24 +0000 (12:17 -0800)]
Merge branch 'dp/maint-1.6.5-fast-import-non-commit-tag' into maint-1.6.5

* dp/maint-1.6.5-fast-import-non-commit-tag:
  fast-import: tag may point to any object type

14 years agoMerge branch 'jm/maint-1.6.5-grep-NUL-terminate' into maint-1.6.5
Junio C Hamano [Wed, 20 Jan 2010 20:16:46 +0000 (12:16 -0800)]
Merge branch 'jm/maint-1.6.5-grep-NUL-terminate' into maint-1.6.5

* jm/maint-1.6.5-grep-NUL-terminate:
  grep: NUL terminate input from a file

14 years agoMerge branch 'maint-1.6.4' into maint-1.6.5
Junio C Hamano [Tue, 19 Jan 2010 05:37:12 +0000 (21:37 -0800)]
Merge branch 'maint-1.6.4' into maint-1.6.5

* maint-1.6.4:
  Fix mis-backport of t7002
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  textconv: stop leaking file descriptors
  commit: --cleanup is a message option
  git count-objects: handle packs bigger than 4G
  t7102: make the test fail if one of its check fails

14 years agoMerge branch 'maint-1.6.3' into maint-1.6.4
Junio C Hamano [Tue, 19 Jan 2010 05:37:06 +0000 (21:37 -0800)]
Merge branch 'maint-1.6.3' into maint-1.6.4

* maint-1.6.3:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  textconv: stop leaking file descriptors
  commit: --cleanup is a message option
  git count-objects: handle packs bigger than 4G
  t7102: make the test fail if one of its check fails

Conflicts:
builtin-commit.c

14 years agoMerge branch 'maint-1.6.2' into maint-1.6.3
Junio C Hamano [Tue, 19 Jan 2010 05:29:47 +0000 (21:29 -0800)]
Merge branch 'maint-1.6.2' into maint-1.6.3

* maint-1.6.2:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  textconv: stop leaking file descriptors
  commit: --cleanup is a message option
  git count-objects: handle packs bigger than 4G
  t7102: make the test fail if one of its check fails

Conflicts:
diff.c

14 years agoMerge commit 'v1.6.4.4-8-g8de6518' into maint-1.6.4
Junio C Hamano [Tue, 19 Jan 2010 05:18:41 +0000 (21:18 -0800)]
Merge commit 'v1.6.4.4-8-g8de6518' into maint-1.6.4

* commit 'v1.6.4.4-8-g8de6518':
  Fix mis-backport of t7002

14 years agoFix mis-backport of t7002
Junio C Hamano [Tue, 19 Jan 2010 05:14:41 +0000 (21:14 -0800)]
Fix mis-backport of t7002

The original patch that became cfe370c (grep: do not segfault when -f is
used, 2009-10-16), was made against "maint" or newer branch back then, but
the fix addressed the issue that was present as far as in 1.6.4 series.

The maintainer backported the patch to the 1.6.4 maintenance branch, but
failed to notice that the new tests assumed the setup done by the script
in "maint", which did quite a lot more than the same test script in 1.6.4
series, and the output didn't match the expected result.

This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogrep: NUL terminate input from a file
Jim Meyering [Mon, 18 Jan 2010 21:55:07 +0000 (22:55 +0100)]
grep: NUL terminate input from a file

Internally "git grep" runs regexec(3) that expects its input string
to be NUL terminated.  When searching inside blob data, read_sha1_file()
automatically gives such a buffer, but builtin-grep.c forgot to put
the NUL at the end, even though it allocated enough space for it.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agofast-import: tag may point to any object type
Dmitry Potapov [Thu, 14 Jan 2010 04:44:19 +0000 (07:44 +0300)]
fast-import: tag may point to any object type

If you tried to export the official git repository, and then to import it
back then git-fast-import would die complaining that "Mark :1 not a commit".

Accordingly to a generated crash file, Mark 1 is not a commit but a blob,
which is pointed by junio-gpg-pub tag. Because git-tag allows to create such
tags, git-fast-import should import them.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.6.1' into maint-1.6.2
Junio C Hamano [Sun, 10 Jan 2010 08:49:47 +0000 (00:49 -0800)]
Merge branch 'maint-1.6.1' into maint-1.6.2

* maint-1.6.1:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".
  textconv: stop leaking file descriptors
  commit: --cleanup is a message option
  git count-objects: handle packs bigger than 4G
  t7102: make the test fail if one of its check fails

Conflicts:
diff.c

14 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Sun, 10 Jan 2010 08:48:47 +0000 (00:48 -0800)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  base85: Make the code more obvious instead of explaining the non-obvious
  base85: encode_85() does not use the decode table
  base85 debug code: Fix length byte calculation
  checkout -m: do not try to fall back to --merge from an unborn branch
  branch: die explicitly why when calling "git branch [-a|-r] branchname".

14 years agobase85: Make the code more obvious instead of explaining the non-obvious
Andreas Gruenbacher [Fri, 8 Jan 2010 13:40:00 +0000 (14:40 +0100)]
base85: Make the code more obvious instead of explaining the non-obvious

Here is another cleanup ...

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobase85: encode_85() does not use the decode table
Andreas Gruenbacher [Fri, 8 Jan 2010 16:22:18 +0000 (17:22 +0100)]
base85: encode_85() does not use the decode table

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobase85 debug code: Fix length byte calculation
Andreas Gruenbacher [Fri, 8 Jan 2010 13:39:58 +0000 (14:39 +0100)]
base85 debug code: Fix length byte calculation

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-rm doc: Describe how to sync index & work tree
Björn Gustavsson [Mon, 7 Dec 2009 18:35:42 +0000 (19:35 +0100)]
git-rm doc: Describe how to sync index & work tree

Newcomers to git that want to remove from the index only the
files that have disappeared from the working tree will probably
look for a way to do that in the documentation for 'git rm'.

Therefore, describe how that can be done (even though it involves
other commands than 'git rm'). Based on a suggestion by Junio,
but re-arranged and rewritten to better fit into the style of
command reference.

While at it, change a single occurrence of "work tree" to "working
tree" for consistency.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agocheckout -m: do not try to fall back to --merge from an unborn branch
Junio C Hamano [Thu, 7 Jan 2010 07:51:47 +0000 (23:51 -0800)]
checkout -m: do not try to fall back to --merge from an unborn branch

If switching from an unborn branch (= empty tree) to a valid commit failed
without -m, it would fail with -m option as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobranch: die explicitly why when calling "git branch [-a|-r] branchname".
Matthieu Moy [Wed, 30 Dec 2009 14:45:31 +0000 (15:45 +0100)]
branch: die explicitly why when calling "git branch [-a|-r] branchname".

The -a and -r options used to be silently ignored in such a command.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobash completion: factor submodules into dirty state
Thomas Rast [Thu, 31 Dec 2009 11:48:41 +0000 (12:48 +0100)]
bash completion: factor submodules into dirty state

In the implementation of GIT_PS1_SHOWDIRTYSTATE in 738a94a (bash:
offer to show (un)staged changes, 2009-02-03), I cut&pasted the
git-diff invocations from dirty-worktree checks elsewhere, carrying
along the --ignore-submodules option.

As pointed out by Kevin Ballard, this doesn't really make sense: to
the _user_, a changed submodule counts towards uncommitted changes.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotextconv: stop leaking file descriptors
Jeff King [Wed, 30 Dec 2009 09:02:53 +0000 (04:02 -0500)]
textconv: stop leaking file descriptors

We read the output from textconv helpers over a pipe, but we
never actually closed our end of the pipe after using it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoreset: unbreak hard resets with GIT_WORK_TREE
Jeff King [Wed, 30 Dec 2009 08:47:03 +0000 (03:47 -0500)]
reset: unbreak hard resets with GIT_WORK_TREE

Commit 952dfc6 tried to tighten the safety valves for doing
a "reset --hard" in a bare repository or outside the work
tree, but accidentally broke the case for GIT_WORK_TREE.
This patch unbreaks it.

Most git commands which need a work tree simply use
NEED_WORK_TREE in git.c to die before they get to their
cmd_* function. Reset, however, only needs a work tree in
some cases, and so must handle the work tree itself. The
error that 952dfc6 made was to simply forbid certain
operations if the work tree was not set up; instead, we need
to do the same thing that NEED_WORK_TREE does, which is to
call setup_work_tree(). We no longer have to worry about dying
in the non-worktree case, as setup_work_tree handles that
for us.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'maint-1.6.0' into maint-1.6.1
Junio C Hamano [Wed, 30 Dec 2009 04:16:34 +0000 (20:16 -0800)]
Merge branch 'maint-1.6.0' into maint-1.6.1

* maint-1.6.0:
  commit: --cleanup is a message option
  t7102: make the test fail if one of its check fails

14 years agocommit: --cleanup is a message option
Greg Price [Tue, 29 Dec 2009 21:54:49 +0000 (16:54 -0500)]
commit: --cleanup is a message option

In the usage message for "git commit", the --cleanup option appeared
at the end, as one of the "contents options":

usage: git commit [options] [--] <filepattern>...
...
Commit message options
...
Commit contents options
...
    --allow-empty         ok to record an empty change
    --cleanup <default>   how to strip spaces and #comments from message

This is confusing, in part because it makes it ambiguous whether
--allow-empty, just above, refers to an empty diff or an empty message.

Move --cleanup into the 'message options' group.  Also add a pair of
comments to prevent similar oversights in the future.

Signed-off-by: Greg Price <price@ksplice.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit count-objects: handle packs bigger than 4G
Andreas Schwab [Tue, 29 Dec 2009 19:09:15 +0000 (20:09 +0100)]
git count-objects: handle packs bigger than 4G

Use off_t to count sizes of packs and objects to avoid overflow after
4Gb.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot7102: make the test fail if one of its check fails
Nguyễn Thái Ngọc Duy [Tue, 29 Dec 2009 08:13:18 +0000 (15:13 +0700)]
t7102: make the test fail if one of its check fails

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoPrevent git blame from segfaulting on a missing author name
David Reiss [Tue, 22 Dec 2009 18:51:41 +0000 (10:51 -0800)]
Prevent git blame from segfaulting on a missing author name

The human-readable author and committer name can be missing from
commits imported from foreign SCM interfaces.  Make sure we parse
the "author" and "committer" line a bit more leniently and avoid
segfaulting by assuming the name always exists.

Signed-off-by: David Reiss <dreiss@facebook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorebase -i: abort cleanly if the editor fails to launch
Björn Gustavsson [Sat, 19 Dec 2009 12:04:03 +0000 (13:04 +0100)]
rebase -i: abort cleanly if the editor fails to launch

If the user's configured editor is emacsclient, the editor
will fail to launch if emacs is not running and the git
command that tried to lanuch the editor will abort. For most
commands, all you have to do is to start emacs and repeat
the command.

The "git rebase -i" command, however, aborts without cleaning
the "$GIT_DIR/rebase-merge" directory if it fails to launch the
editor, so you'll need to do "git rebase --abort" before
repeating the rebase command.

Change "git rebase -i" to terminate using "die_abort" (instead of
with "die") if the initial launch of the editor fails.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agotechnical-docs: document hash API
Stephen Boyd [Fri, 18 Dec 2009 00:05:29 +0000 (16:05 -0800)]
technical-docs: document hash API

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoapi-strbuf.txt: fix typos and document launch_editor()
Stephen Boyd [Fri, 18 Dec 2009 00:05:28 +0000 (16:05 -0800)]
api-strbuf.txt: fix typos and document launch_editor()

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGit 1.6.5.7 v1.6.5.7
Junio C Hamano [Wed, 16 Dec 2009 18:23:54 +0000 (10:23 -0800)]
Git 1.6.5.7

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoworktree: don't segfault with an absolute pathspec without a work tree
Junio C Hamano [Wed, 16 Dec 2009 18:50:09 +0000 (10:50 -0800)]
worktree: don't segfault with an absolute pathspec without a work tree

If a command is run with an absolute path as a pathspec inside a bare
repository, e.g. "rev-list HEAD -- /home", the code tried to run strlen()
on NULL, which is the result of get_git_work_tree(), and segfaulted.  It
should just fail instead.

Currently the function returns NULL even inside .git/ in a repository
with a work tree, but that is a separate issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoignore unknown color configuration
Jeff King [Sat, 12 Dec 2009 12:25:24 +0000 (07:25 -0500)]
ignore unknown color configuration

When parsing the config file, if there is a value that is
syntactically correct but unused, we generally ignore it.
This lets non-core porcelains store arbitrary information in
the config file, and it means that configuration files can
be shared between new and old versions of git (the old
versions might simply ignore certain configuration).

The one exception to this is color configuration; if we
encounter a color.{diff,branch,status}.$slot variable, we
die if it is not one of the recognized slots (presumably as
a safety valve for user misconfiguration). This behavior
has existed since 801235c (diff --color: use
$GIT_DIR/config, 2006-06-24), but hasn't yet caused a
problem. No porcelain has wanted to store extra colors, and
we once a color area (like color.diff) has been introduced,
we've never changed the set of color slots.

However, that changed recently with the addition of
color.diff.func. Now a user with color.diff.func in their
config can no longer freely switch between v1.6.6 and older
versions; the old versions will complain about the existence
of the variable.

This patch loosens the check to match the rest of
git-config; unknown color slots are simply ignored. This
doesn't fix this particular problem, as the older version
(without this patch) is the problem, but it at least
prevents it from happening again in the future.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agohelp.autocorrect: do not run a command if the command given is junk
Johannes Sixt [Tue, 15 Dec 2009 07:57:18 +0000 (08:57 +0100)]
help.autocorrect: do not run a command if the command given is junk

If a given command is not found, then help.c tries to guess which one the
user could have meant. If help.autocorrect is 0 or unset, then a list of
suggestions is given as long as the dissimilarity between the given command
and the candidates is not excessively high. But if help.autocorrect was
non-zero (i.e., a delay after which the command is run automatically), the
latter restriction on dissimilarity was not obeyed.

In my case, this happened:

 $ git ..daab02
 WARNING: You called a Git command named '..daab02', which does not exist.
 Continuing under the assumption that you meant 'read-tree'
 in 4.0 seconds automatically...

The patch reuses the similarity limit that is also applied when the list of
suggested commands is printed.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoIllustrate "filter" attribute with an example
Nanako Shiraishi [Tue, 15 Dec 2009 03:11:10 +0000 (12:11 +0900)]
Illustrate "filter" attribute with an example

The example was taken from aa4ed402c9721170fde2e9e43c3825562070e65e
(Add 'filter' attribute and external filter driver definition).

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agooctopus: remove dead code
Stephen Boyd [Sat, 12 Dec 2009 00:38:59 +0000 (16:38 -0800)]
octopus: remove dead code

MSG, PARENT, and CNT are never used, just assigned to.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agooctopus: reenable fast-forward merges
Stephen Boyd [Sat, 12 Dec 2009 00:38:58 +0000 (16:38 -0800)]
octopus: reenable fast-forward merges

The fast-forward logic is never being triggered because $common and
$MRC are never equivalent. $common is initialized to a commit id by
merge-base and MRC is initialized to HEAD. Fix this by initializing
$MRC to the commit id for HEAD so that its possible for $MRC and
$common to be equal.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agooctopus: make merge process simpler to follow
Stephen Boyd [Sat, 12 Dec 2009 00:38:57 +0000 (16:38 -0800)]
octopus: make merge process simpler to follow

Its not very easy to understand what heads are being merged given
the current output of an octopus merge. Fix this by replacing the
sha1 with the (usually) better description in GITHEAD_<SHA1>.

Suggested-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGit 1.6.5.6 v1.6.5.6
Junio C Hamano [Thu, 10 Dec 2009 23:42:30 +0000 (15:42 -0800)]
Git 1.6.5.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoFix archive format with -- on the command line
Junio C Hamano [Thu, 10 Dec 2009 23:27:51 +0000 (15:27 -0800)]
Fix archive format with -- on the command line

Giving --format from the command line, or using output file extention to
DWIM the output format, with a pathspec that is disambiguated with an
explicit double-dash on the command line, e.g.

    git archive -o file --format=zip HEAD -- path
    git archive -o file.zip HEAD -- path

didn't work correctly.

This was because the code reordered (when one was given) or added (when
the format was inferred) a --format argument at the end, effectively
making it to "archive HEAD -- path --format=zip", i.e. an extra pathspec
that is unlikely to match anything.

The command line argument list should always be "options, revs and then
paths", and we should set a good example by inserting the --format at the
beginning instead.

Reported-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoRemove post-upload-hook
Junio C Hamano [Thu, 10 Dec 2009 20:17:11 +0000 (12:17 -0800)]
Remove post-upload-hook

This hook runs after "git fetch" in the repository the objects are
fetched from as the user who fetched, and has security implications.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'mm/maint-merge-ff-error-message-fix' into maint
Junio C Hamano [Wed, 9 Dec 2009 06:42:23 +0000 (22:42 -0800)]
Merge branch 'mm/maint-merge-ff-error-message-fix' into maint

* mm/maint-merge-ff-error-message-fix:
  builtin-merge: show user-friendly error messages for fast-forward too.
  merge-recursive: make the error-message generation an extern function

Conflicts:
merge-recursive.c

14 years agoMerge branch 'jn/maint-pull-rebase-error-message' into maint
Junio C Hamano [Wed, 9 Dec 2009 06:39:20 +0000 (22:39 -0800)]
Merge branch 'jn/maint-pull-rebase-error-message' into maint

* jn/maint-pull-rebase-error-message:
  pull: clarify advice for the unconfigured error case

14 years agoMerge branch 'jk/maint-add-p-delete-fix' into maint
Junio C Hamano [Wed, 9 Dec 2009 06:37:50 +0000 (22:37 -0800)]
Merge branch 'jk/maint-add-p-delete-fix' into maint

* jk/maint-add-p-delete-fix:
  add-interactive: fix deletion of non-empty files

14 years agoadd-interactive: fix deletion of non-empty files
Jeff King [Tue, 8 Dec 2009 07:49:35 +0000 (02:49 -0500)]
add-interactive: fix deletion of non-empty files

Commit 24ab81a fixed the deletion of empty files, but broke
deletion of non-empty files. The approach it took was to
factor out the "deleted" line from the patch header into its
own hunk, the same way we do for mode changes. However,
unlike mode changes, we only showed the special "delete this
file" hunk if there were no other hunks. Otherwise, the user
would annoyingly be presented with _two_ hunks: one for
deleting the file and one for deleting the content.

This meant that in the non-empty case, we forgot about the
deleted line entirely, and we submitted a bogus patch to
git-apply (with "/dev/null" as the destination file, but not
marked as a deletion).

Instead, this patch combines the file deletion hunk and the
content deletion hunk (if there is one) into a single
deletion hunk which is either staged or not.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agogit-add/rm doc: Consistently back-quote
Björn Gustavsson [Mon, 7 Dec 2009 18:26:57 +0000 (19:26 +0100)]
git-add/rm doc: Consistently back-quote

Consistently back-quote commands, options and file names.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: 'git add -A' can remove files
Björn Gustavsson [Mon, 7 Dec 2009 08:20:09 +0000 (09:20 +0100)]
Documentation: 'git add -A' can remove files

The current documentation fails to mention that 'git add -A/--all' can
remove files as well as add them, and it also does not say anything about
filepatterns (whether they are allowed, mandatory, or optional). It is
also not clear what the similarities and differences to the -u option are.

Update the intro paragraph (as suggested by Junio, with some minor edits)
to make it clear that 'git add' is able to delete and to also cover the -p
option.

Reword the description of -u to make it clearer (based on Björn
Steinbrink's suggestion).

Simplify the description of -A by saying "Like -u" and then describe the
differences (based on the suggestions by Björn Steinbrink and Junio).

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGit 1.6.5.5 v1.6.5.5
Junio C Hamano [Sat, 5 Dec 2009 19:08:35 +0000 (11:08 -0800)]
Git 1.6.5.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoFix diff -B/--dirstat miscounting of newly added contents
Linus Torvalds [Fri, 4 Dec 2009 20:07:47 +0000 (12:07 -0800)]
Fix diff -B/--dirstat miscounting of newly added contents

What used to happen is that diffcore_count_changes() simply ignored any
hashes in the destination that didn't match hashes in the source. EXCEPT
if the source hash didn't exist at all, in which case it would count _one_
destination hash that happened to have the "next" hash value.  As a
consequence, newly added material was often undercounted, making output
from --dirstat and "complete rewrite" detection used by -B unrelialble.

This changes it so that:

 - whenever it bypasses a destination hash (because it doesn't match a
   source), it counts the bytes associated with that as "literal added"

 - at the end (once we have used up all the source hashes), we do the same
   thing with the remaining destination hashes.

 - when hashes do match, and we use the difference in counts as a value,
   we also use up that destination hash entry (the 'd++').

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoreset: improve worktree safety valves
Jeff King [Fri, 4 Dec 2009 11:11:58 +0000 (06:11 -0500)]
reset: improve worktree safety valves

The existing code checked to make sure we were not in a bare
repository when doing a hard reset. However, we should take
this one step further, and make sure we are in a worktree.
Otherwise, we can end up munging files inside of '.git'.

Furthermore, we should do the same check for --merge resets,
which have the same properties. Actually, a merge reset of
HEAD^ would already complain, since further down in the code
we want a worktree. However, it is nicer to check up-front;
then we are sure we cover all cases ("git reset --merge"
would run, even though it wasn't doing anything) and we can
give a more specific message.

Add tests to t7103 to cover these cases and some missing ones.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: Avoid use of xmlto --stringparam
Todd Zullinger [Fri, 4 Dec 2009 17:53:21 +0000 (12:53 -0500)]
Documentation: Avoid use of xmlto --stringparam

The --stringparam option is not available on older xmlto versions.
Instead, set man.base.url.for.relative.links via a .xsl file.  Older
docbook versions will ignore this without causing grief to users of
older xmlto versions.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoarchive: clarify description of path parameter
René Scharfe [Fri, 4 Dec 2009 23:11:01 +0000 (00:11 +0100)]
archive: clarify description of path parameter

Mention that path parameters are based on the current working directory.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
--
 Documentation/git-archive.txt |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agorerere: don't segfault on failure to open rr-cache
Jeff King [Fri, 4 Dec 2009 10:35:57 +0000 (05:35 -0500)]
rerere: don't segfault on failure to open rr-cache

The rr-cache directory should always exist if we are doing
garbage collection (earlier code paths check this
explicitly), but we may not necessarily succeed in opening
it (for example, due to permissions problems). In that case,
we should print an error message rather than simply
segfaulting.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoPrepare for 1.6.5.5
Junio C Hamano [Thu, 3 Dec 2009 22:07:32 +0000 (14:07 -0800)]
Prepare for 1.6.5.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoMerge branch 'uk/maint-shortlog-encoding' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:56:50 +0000 (13:56 -0800)]
Merge branch 'uk/maint-shortlog-encoding' into maint

* uk/maint-shortlog-encoding:
  t4201: use ISO8859-1 rather than ISO-8859-1
  shortlog: respect commit encoding

14 years agoMerge branch 'fc/maint-format-patch-pathspec-dashes' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:54:25 +0000 (13:54 -0800)]
Merge branch 'fc/maint-format-patch-pathspec-dashes' into maint

* fc/maint-format-patch-pathspec-dashes:
  format-patch: add test for parsing of "--"
  format-patch: fix parsing of "--" on the command line

14 years agoMerge branch 'ap/maint-merge-strategy-list-fix' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:54:11 +0000 (13:54 -0800)]
Merge branch 'ap/maint-merge-strategy-list-fix' into maint

* ap/maint-merge-strategy-list-fix:
  builtin-merge.c: call exclude_cmds() correctly.

14 years agoMerge branch 'jc/maint-am-keep' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:54:03 +0000 (13:54 -0800)]
Merge branch 'jc/maint-am-keep' into maint

* jc/maint-am-keep:
  Remove dead code from "git am"

14 years agoMerge branch 'rs/work-around-grep-opt-insanity' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:53:58 +0000 (13:53 -0800)]
Merge branch 'rs/work-around-grep-opt-insanity' into maint

* rs/work-around-grep-opt-insanity:
  Protect scripted Porcelains from GREP_OPTIONS insanity
  mergetool--lib: simplify guess_merge_tool()

14 years agoMerge branch 'rj/maint-cygwin-count-objects' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:53:54 +0000 (13:53 -0800)]
Merge branch 'rj/maint-cygwin-count-objects' into maint

* rj/maint-cygwin-count-objects:
  git-count-objects: Fix a disk-space under-estimate on Cygwin

14 years agoMerge branch 'mm/maint-hint-failed-merge' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:52:54 +0000 (13:52 -0800)]
Merge branch 'mm/maint-hint-failed-merge' into maint

* mm/maint-hint-failed-merge:
  user-manual: Document that "git merge" doesn't like uncommited changes.
  merge-recursive: point the user to commit when file would be overwritten.

14 years agoMerge branch 'th/maint-remote-update-help-string' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:52:31 +0000 (13:52 -0800)]
Merge branch 'th/maint-remote-update-help-string' into maint

* th/maint-remote-update-help-string:
  Update 'git remote update' usage string to match man page.

14 years agoMerge branch 'rj/maint-t9700' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:52:22 +0000 (13:52 -0800)]
Merge branch 'rj/maint-t9700' into maint

* rj/maint-t9700:
  t9700-perl-git.sh: Fix a test failure on Cygwin

14 years agoMerge branch 'ls/maint-mailinfo-no-inbody' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:52:16 +0000 (13:52 -0800)]
Merge branch 'ls/maint-mailinfo-no-inbody' into maint

* ls/maint-mailinfo-no-inbody:
  git am/mailinfo: Don't look at in-body headers when rebasing

14 years agoMerge branch 'mo/maint-crlf-doc' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:52:11 +0000 (13:52 -0800)]
Merge branch 'mo/maint-crlf-doc' into maint

* mo/maint-crlf-doc:
  core.autocrlf documentation: mention the crlf attribute

14 years agoMerge branch 'th/remote-usage' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:51:53 +0000 (13:51 -0800)]
Merge branch 'th/remote-usage' into maint

* th/remote-usage:
  git remote: Separate usage strings for subcommands

14 years agoMerge branch 'pb/maint-use-custom-perl' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:51:41 +0000 (13:51 -0800)]
Merge branch 'pb/maint-use-custom-perl' into maint

* pb/maint-use-custom-perl:
  Make sure $PERL_PATH is defined when the test suite is run.

14 years agoMerge branch 'mm/config-pathname-tilde-expand' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:51:36 +0000 (13:51 -0800)]
Merge branch 'mm/config-pathname-tilde-expand' into maint

* mm/config-pathname-tilde-expand:
  Documentation: avoid xmlto input error
  expand_user_path: expand ~ to $HOME, not to the actual homedir.
  Expand ~ and ~user in core.excludesfile, commit.template

14 years agoMerge branch 'bc/grep-i-F' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:51:26 +0000 (13:51 -0800)]
Merge branch 'bc/grep-i-F' into maint

* bc/grep-i-F:
  grep: Allow case insensitive search of fixed-strings

14 years agoMerge branch 'jk/maint-break-rename-reduce-memory' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:51:21 +0000 (13:51 -0800)]
Merge branch 'jk/maint-break-rename-reduce-memory' into maint

* jk/maint-break-rename-reduce-memory:
  diffcore-rename: reduce memory footprint by freeing blob data early
  diffcore-break: save cnt_data for other phases
  diffcore-break: free filespec data as we go

14 years agoMerge branch 'rj/maint-simplify-cygwin-makefile' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:51:16 +0000 (13:51 -0800)]
Merge branch 'rj/maint-simplify-cygwin-makefile' into maint

* rj/maint-simplify-cygwin-makefile:
  Makefile: merge two Cygwin configuration sections into one

14 years agoMerge branch 'rg/doc-workflow' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:50:41 +0000 (13:50 -0800)]
Merge branch 'rg/doc-workflow' into maint

* rg/doc-workflow:
  Add branch management for releases to gitworkflows

14 years agoMerge branch 'np/maint-sideband-favor-status' into maint
Junio C Hamano [Thu, 3 Dec 2009 21:50:24 +0000 (13:50 -0800)]
Merge branch 'np/maint-sideband-favor-status' into maint

* np/maint-sideband-favor-status:
  give priority to progress messages

14 years agoDocumentation: xmlto 0.0.18 does not know --stringparam
Junio C Hamano [Thu, 3 Dec 2009 19:12:32 +0000 (11:12 -0800)]
Documentation: xmlto 0.0.18 does not know --stringparam

Newer DocBook stylesheets want man.base.url.for.relative.links
parameter set when formatting manpages with external references
to turn them into full URLs, and leave a helpful "you should
set this parameter" message in the output.  Earlier we added
the MAN_BASE_URL make variable to specify the value for it.

When MAN_BASE_URL is not given, it ought to be safe to set the
parameter to empty; it would result in an empty leading path for
older stylesheets that ignore the parameter, and newer ones
would produce the same "relative URL" without the message.

Unfortunately, older xmlto (at least version 0.0.18 released in
early 2004 that comes with RHEL/CentOS 5) does not understand
the --stringparam command line option, so we cannot add the
parameter definition unconditionally to the command line.  Work
it around by passing the parameter only when set.

If you do not have a suitable URL prefix, you can pass a quoted empty
string to it, like so:

    $ make MAN_BASE_URL='""'

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agot4201: use ISO8859-1 rather than ISO-8859-1
Brandon Casey [Thu, 3 Dec 2009 17:52:45 +0000 (11:52 -0600)]
t4201: use ISO8859-1 rather than ISO-8859-1

Some ancient platforms do not have an extensive list of alternate names for
character encodings.  For example, Solaris 7 and IRIX 6.5 do not know that
ISO-8859-1 is the same as ISO8859-1.  Modern platforms do know this, so use
the older name.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agopull: clarify advice for the unconfigured error case
Jan Krüger [Fri, 27 Nov 2009 14:17:05 +0000 (08:17 -0600)]
pull: clarify advice for the unconfigured error case

When pull --rebase fails because it cannot find what branch to
merge against, the error message implies we are trying to merge.
Say "rebase against" instead of "merge with" to avoid confusion.

The configuration suggested to remedy the situation uses a
confusing syntax, with variables specified in the dotted form
accepted by 'git config' but separated from their values by the
'=' delimiter used by config files.  Since the user will have to
edit this output anyway, it is more helpful to provide a config
file snippet to paste into an editor and modify.

Signed-off-by: Jan Krüger <jk@jk.gs>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoGit 1.6.5.4 v1.6.5.4
Junio C Hamano [Thu, 3 Dec 2009 08:08:16 +0000 (00:08 -0800)]
Git 1.6.5.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoUnconditionally set man.base.url.for.relative.links
Junio C Hamano [Thu, 3 Dec 2009 08:06:52 +0000 (00:06 -0800)]
Unconditionally set man.base.url.for.relative.links

Even setting it to empty is better than leaving it unset as it
prevents the warning cruft from appearing in the output.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation/Makefile: allow man.base.url.for.relative.link to be set from Make
Junio C Hamano [Thu, 3 Dec 2009 02:45:09 +0000 (02:45 +0000)]
Documentation/Makefile: allow man.base.url.for.relative.link to be set from Make

Signed-off-by: Junio C Hamano <junio@kernel.org>
14 years agoPrepare for 1.6.5.4
Junio C Hamano [Wed, 2 Dec 2009 18:29:00 +0000 (10:29 -0800)]
Prepare for 1.6.5.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge: do not add standard message when message is given with -m option
Junio C Hamano [Wed, 2 Dec 2009 18:00:58 +0000 (10:00 -0800)]
merge: do not add standard message when message is given with -m option

Even if the user explicitly gave her own message to "git merge", the
command still added its standard merge message.  It resulted in a
useless repetition like this:

    % git merge -m "Merge early part of side branch" `git rev-parse side~2`
    % git show -s
    commit 37217141e7519629353738d5e4e677a15096206f
    Merge: e68e646 a1d2374
    Author: しらいし ななこ <nanako3@lavabit.com>
    Date:   Wed Dec 2 14:33:20 2009 +0900

Merge early part of side branch

Merge commit 'a1d2374f8f52f4e8a53171601a920b538a6cec23'

The gave her own message because she didn't want git to add the
standard message (if she wanted to, she wouldn't have given one,
or she would have prepared it using git-fmt-merge-msg command).

Noticed by Nanako Shiraishi

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDo not misidentify "git merge foo HEAD" as an old-style invocation
Junio C Hamano [Wed, 2 Dec 2009 17:59:35 +0000 (09:59 -0800)]
Do not misidentify "git merge foo HEAD" as an old-style invocation

This was misinterpreted as an ancient style "git merge <message> HEAD
<commit> <commit>..." that merges one (or more) <commit> into the current
branch and record the resulting commit with the given message.  Then a
later sanity check found that there is no <commit> specified and gave
a usage message.

Tested-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agohelp: Do not unnecessarily look for a repository
David Aguilar [Tue, 1 Dec 2009 19:27:34 +0000 (11:27 -0800)]
help: Do not unnecessarily look for a repository

Although 'git help' actually doesn't need to be run inside a git
repository and uses no repository-specific information, it looks for a git
directory.  Searching for a git directory can be annoying in auto-mount
environments.  With this commit, 'git help' no longer searches for a
repository when run without any options.

7c3baa9 originally modified 'git help -a' to not require a repository.
This applies the same fix for 'git help'.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: Fix a few i.e./e.g. mix-ups
Michael J Gruber [Tue, 1 Dec 2009 09:19:05 +0000 (10:19 +0100)]
Documentation: Fix a few i.e./e.g. mix-ups

A git bundle can be transported by several means (such as e-mail), not
only by snekaernet, so use e.g. instead of i.e.

The mix-up in git-bundle.txt is obvious.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agoDocumentation: Document --branch option in git clone synopsis
David Soria Parra [Mon, 30 Nov 2009 13:27:52 +0000 (14:27 +0100)]
Documentation: Document --branch option in git clone synopsis

Document the --branch option as [-b <name>] in git clones synopsis.

Signed-off-by: David Soria Parra <dsp@php.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobuiltin-merge: show user-friendly error messages for fast-forward too.
Matthieu Moy [Sun, 29 Nov 2009 12:18:33 +0000 (13:18 +0100)]
builtin-merge: show user-friendly error messages for fast-forward too.

fadd069d03 (merge-recursive: give less scary messages when merge did not
start, Sep 7 2009) introduced some friendlier error message for merge
failure, but the messages were shown only for non-fast forward merges.
This patch uses the same for fast-forward.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agomerge-recursive: make the error-message generation an extern function
Matthieu Moy [Sun, 29 Nov 2009 12:18:32 +0000 (13:18 +0100)]
merge-recursive: make the error-message generation an extern function

The construction of the struct unpack_trees_error_msgs was done within
git_merge_trees(), which prevented using the same messages easily from
another function.

[jc: backported for 1.6.5 maint before advice_commit_before_merge]

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 years agobuiltin-merge.c: call exclude_cmds() correctly.
Avery Pennarun [Thu, 26 Nov 2009 02:23:54 +0000 (21:23 -0500)]
builtin-merge.c: call exclude_cmds() correctly.

We need to call exclude_cmds() after the loop, not during the loop, because
excluding a command from the array can change the indexes of objects in the
array.  The result is that, depending on file ordering, some commands
weren't excluded as they should have been.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoRemove dead code from "git am"
Junio C Hamano [Fri, 27 Nov 2009 23:06:37 +0000 (15:06 -0800)]
Remove dead code from "git am"

Ever since the initial implementation, "git am" had kept a dead code that
never triggered due to a typo in the variable name.  Worse yet, the code,
if it weren't for the typo, would have attempted to add "[PATCH] " at the
beginning of the Subject: header when "git am" is run with its "-k"
option.  However, because "git am -k" tells mailinfo to keep such prefix
when parsing the input, the "[PATCH] " added by this dead code would have
really been unnecessary duplicate.

Embarrassing is that we kept _maintaining_ the codepath without anybody
noticing for four years.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoformat-patch: add test for parsing of "--"
Felipe Contreras [Thu, 26 Nov 2009 19:12:00 +0000 (21:12 +0200)]
format-patch: add test for parsing of "--"

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoformat-patch: fix parsing of "--" on the command line
Felipe Contreras [Thu, 26 Nov 2009 19:11:59 +0000 (21:11 +0200)]
format-patch: fix parsing of "--" on the command line

When given a pathspec that does not match any path in the current work
tree with an explicit "--":

    git format-patch <commit> -- <path>

the command still complains that <path> does not exist in the current work
tree and the user needs to explicitly specify "--" and errors out.  This
is because it incorrectly removes "--" from the command line arguments
that is later passed to setup_revisions().

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agobuiltin-apply.c: pay attention to -p<n> when determining the name
Junio C Hamano [Wed, 25 Nov 2009 10:56:54 +0000 (02:56 -0800)]
builtin-apply.c: pay attention to -p<n> when determining the name

The patch structure has def_name component that is used to validate the
sanity of a "diff --git" patch by checking pathnames that appear on the
patch header lines for consistency.  The git_header_name() function is
used to compute this out of "diff --git a/... b/..." line, but the code
always stripped one level of prefix (i.e. "a/" and "b/"), without paying
attention to -p<n> option.  Code in find_name() function that parses other
lines in the patch header (e.g. "--- a/..." and "+++ b/..." lines) however
did strip the correct number of leading paths prefixes, and the sanity
check between these computed values failed.

Teach git_header_name() to honor -p<n> option like find_name() function
does.

Found and reported by Steven J. Murdoch who also wrote tests.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 years agoshortlog: respect commit encoding
Uwe Kleine-König [Wed, 25 Nov 2009 19:33:28 +0000 (20:33 +0100)]
shortlog: respect commit encoding

Don't take the author name information without re-encoding from the raw
commit object buffer.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>