Code

git.git
16 years agogit-cat-file: Add --batch option
Adam Roben [Wed, 23 Apr 2008 19:17:47 +0000 (15:17 -0400)]
git-cat-file: Add --batch option

--batch is similar to --batch-check, except that the contents of each object is
also printed. The output's form is:

<sha1> SP <type> SP <size> LF
<contents> LF

Signed-off-by: Adam Roben <aroben@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-cat-file: Add --batch-check option
Adam Roben [Wed, 23 Apr 2008 19:17:46 +0000 (15:17 -0400)]
git-cat-file: Add --batch-check option

This new option allows multiple objects to be specified on stdin. For each
object specified, a line of the following form is printed:

<sha1> SP <type> SP <size> LF

If the object does not exist in the repository, a line of the following form is
printed:

<object> SP missing LF

Signed-off-by: Adam Roben <aroben@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-cat-file: Make option parsing a little more flexible
Adam Roben [Wed, 23 Apr 2008 19:17:45 +0000 (15:17 -0400)]
git-cat-file: Make option parsing a little more flexible

This will make it easier to add newer options later.

Signed-off-by: Adam Roben <aroben@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-cat-file: Small refactor of cmd_cat_file
Adam Roben [Wed, 23 Apr 2008 19:17:44 +0000 (15:17 -0400)]
git-cat-file: Small refactor of cmd_cat_file

I separated the logic of parsing the arguments from the logic of fetching and
outputting the data. cat_one_file now does the latter.

Signed-off-by: Adam Roben <aroben@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd tests for git cat-file
Adam Roben [Wed, 23 Apr 2008 19:17:43 +0000 (15:17 -0400)]
Add tests for git cat-file

Signed-off-by: Adam Roben <aroben@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoCleanup xread() loops to use read_in_full()
Heikki Orsila [Sat, 3 May 2008 13:27:26 +0000 (16:27 +0300)]
Cleanup xread() loops to use read_in_full()

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Sun, 4 May 2008 05:15:09 +0000 (22:15 -0700)]
Merge branch 'maint'

* maint:
  checkout: don't rfc2047-encode oneline on detached HEAD
  filter-branch: Documentation fix.

16 years agoMerge branch 'maint-1.5.4' into maint
Junio C Hamano [Sun, 4 May 2008 01:55:33 +0000 (18:55 -0700)]
Merge branch 'maint-1.5.4' into maint

* maint-1.5.4:
  filter-branch: Documentation fix.

16 years agocheckout: don't rfc2047-encode oneline on detached HEAD
Jeff King [Fri, 2 May 2008 14:05:36 +0000 (10:05 -0400)]
checkout: don't rfc2047-encode oneline on detached HEAD

When calling pretty_print_commit, there is an implicit
assumption that passing in a non-NULL "subject" variable
for oneline or email formats means that the output is part
of a subject and therefore "subject" to rfc2047 encoding.
This is not the desired effect when reporting the movement
of detached HEAD.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: hooks: fix missing verb in pre-applypatch description
Christian Couder [Fri, 2 May 2008 03:30:41 +0000 (05:30 +0200)]
Documentation: hooks: fix missing verb in pre-applypatch description

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agofilter-branch: Documentation fix.
Florian Ragwitz [Wed, 30 Apr 2008 07:47:43 +0000 (09:47 +0200)]
filter-branch: Documentation fix.

It's --msg-filter, not --message-filter.

Signed-off-by: Florian Ragwitz <rafl@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agolog: print log entry terminator even if the message is empty
Adam Simpkins [Tue, 29 Apr 2008 08:33:00 +0000 (01:33 -0700)]
log: print log entry terminator even if the message is empty

This eliminates a special case in the show_log() function, to help
simplify the terminator semantics.  Now show_log() always prints a
newline after the log entry when use_terminator is set, even if the log
message is empty.

This change should only affect the --pretty=tformat output, since that
was the only way to trigger this special case.

Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoRemove dead code: show_log() sep argument and diff_options.msg_sep
Adam Simpkins [Tue, 29 Apr 2008 08:32:59 +0000 (01:32 -0700)]
Remove dead code: show_log() sep argument and diff_options.msg_sep

These variables were made unnecessary by commit
3969cf7db1a13a78f3b7a36d8c1084bbe0a53459.

Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svn: Same default as cvsimport when using --use-log-author
Stephen R. van den Berg [Tue, 29 Apr 2008 21:20:32 +0000 (23:20 +0200)]
git-svn: Same default as cvsimport when using --use-log-author

When using git-cvsimport, the author is inferred from the cvs commit,
e.g. cvs commit logname is foobaruser, then the author field in git
results in:

Author: foobaruser <foobaruser>

Which is not perfect, but perfectly acceptable given the circumstances.

The default git-svn import however, results in:

Author: foobaruser <foobaruser@acf43c95-373e-0410-b603-e72c3f656dc1>

When using mixes of imports, from CVS and SVN into the same git
repository, you'd like to harmonise the imports to the format cvsimport
uses.
git-svn supports an experimental option --use-log-author which currently
results in the same logentry as without that option when no From: or
Signed-off-by: is found in the logentry ($email currently ends up empty,
and hence is generated again).

This patches harmonises the result with cvsimport, and makes
git-svn --use-log-author produce:

Author: foobaruser <foobaruser>

Signed-off-by: Stephen R. van den Berg <srb@cuci.nl>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Wed, 30 Apr 2008 18:43:37 +0000 (11:43 -0700)]
Merge branch 'maint'

* maint:
  fetch-pack: brown paper bag fix

16 years agofetch-pack: brown paper bag fix
Junio C Hamano [Wed, 30 Apr 2008 18:42:05 +0000 (11:42 -0700)]
fetch-pack: brown paper bag fix

When I applied Linus's patch from the list by hand somehow I ended
up reversing the logic by mistake.  This fixes it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation: point git-prune users to git-gc
Jeff King [Tue, 29 Apr 2008 20:45:14 +0000 (16:45 -0400)]
Documentation: point git-prune users to git-gc

Most users should be using git-gc instead of directly
calling prune. For those who really do want more information
on pruning, let's point them at git-fsck, which goes into
slightly more detail on reachability.

And since we're pointing users there, let's make sure
reflogs are mentioned in git-fsck(1).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation on --git-dir and --work-tree
Liu Yubao [Mon, 28 Apr 2008 20:09:20 +0000 (04:09 +0800)]
Documentation on --git-dir and --work-tree

16 years agoMake read_in_full() and write_in_full() consistent with xread() and xwrite()
Heikki Orsila [Sun, 27 Apr 2008 18:21:58 +0000 (21:21 +0300)]
Make read_in_full() and write_in_full() consistent with xread() and xwrite()

xread() and xwrite() return ssize_t values as their native POSIX
counterparts read(2) and write(2).

To be consistent, read_in_full() and write_in_full() should also return
ssize_t values.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocumentation gitk: Describe what --merge does
Richard Quirk [Mon, 28 Apr 2008 20:58:35 +0000 (22:58 +0200)]
Documentation gitk: Describe what --merge does

Signed-off-by: Richard Quirk <richard.quirk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUse the modern syntax of git-diff-files in t2002-checkout-cache-u.sh
Alex Riesen [Sun, 27 Apr 2008 11:31:23 +0000 (13:31 +0200)]
Use the modern syntax of git-diff-files in t2002-checkout-cache-u.sh

As a nice side effect it also fixes t2002-checkout-cache-u.sh on FreeBSD 4,
/bin/sh of which has problems interpreting "! command" construction.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoAdd otherwise missing --strict option to unpack-objects summary.
Jon Loeliger [Wed, 23 Apr 2008 21:14:30 +0000 (16:14 -0500)]
Add otherwise missing --strict option to unpack-objects summary.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svn: detect and fail gracefully when dcommitting to a void
Matthieu Moy [Thu, 24 Apr 2008 18:06:36 +0000 (20:06 +0200)]
git-svn: detect and fail gracefully when dcommitting to a void

The command

  git svn clone (URL of an empty SVN repo here)

works, creates an empty git repository. I can perform the initial
commit there, but then, "git svn dcommit" says :

Use of uninitialized value in concatenation (.) or string at .../git-svn line 414.
Committing to  ...
Unable to determine upstream SVN information from HEAD history

I guess a correct management of the initial commit in git-svn would be
hard to implement, but at least, the error message can be improved.
First step is something like the patch below, and better would be for
"git svn clone" to warn that it won't be able to do much with the
cloned repo.

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agomake git-status use a pager
Bart Trojanowski [Thu, 24 Apr 2008 00:57:48 +0000 (20:57 -0400)]
make git-status use a pager

make git status act similar to git log and git diff by presenting long
output in a pager.

Signed-off-by: Bart Trojanowski <bart@jukie.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Wed, 30 Apr 2008 06:06:30 +0000 (23:06 -0700)]
Merge branch 'maint'

* maint:
  cvsimport: always pass user data to "system" as a list
  fix reflog approxidate parsing bug
  Fix use after free() in builtin-fetch
  fetch-pack: do not stop traversing an already parsed commit
  Use "=" instead of "==" in condition as it is more portable

16 years agoMerge branch 'maint-1.5.4' into maint
Junio C Hamano [Wed, 30 Apr 2008 05:55:07 +0000 (22:55 -0700)]
Merge branch 'maint-1.5.4' into maint

* maint-1.5.4:
  cvsimport: always pass user data to "system" as a list
  fix reflog approxidate parsing bug

16 years agocvsimport: always pass user data to "system" as a list
Jeff King [Wed, 30 Apr 2008 04:36:14 +0000 (00:36 -0400)]
cvsimport: always pass user data to "system" as a list

This avoids invoking the shell. Not only is it faster, but
it prevents the possibility of interpreting our arguments in
the shell.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agofix reflog approxidate parsing bug
Jeff King [Wed, 30 Apr 2008 04:13:58 +0000 (00:13 -0400)]
fix reflog approxidate parsing bug

In get_sha1_basic, we parse a string like

  HEAD@{10 seconds ago}:path/to/file

into its constituent ref, reflog date, and path components.
We never actually munge the string itself, but instead keep
offsets into the string with their associated lengths.

When we call approxidate on the contents inside braces,
however, we pass just a string without a length. This means
that approxidate could sometimes look past the closing brace
and (erroneously) interpret the rest of the string as part
of the date.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFix use after free() in builtin-fetch
Alex Riesen [Mon, 28 Apr 2008 20:23:35 +0000 (22:23 +0200)]
Fix use after free() in builtin-fetch

As reported by Dave Jones:

Since master.kernel.org updated to latest, I noticed that I could crash
git-fetch by doing this..

export KERNEL=/pub/scm/linux/kernel/git/
git fetch $KERNEL/torvalds/linux-2.6 master:linus

(gdb) bt
 0  0x000000349fd6d44b in free () from /lib64/libc.so.6
 1  0x000000000048f4eb in transport_unlock_pack (transport=0x7ce530) at transport.c:811
 2  0x000000349fd31b25 in exit () from /lib64/libc.so.6
 3  0x00000000004043d8 in handle_internal_command (argc=3, argv=0x7fffea4449f0) at git.c:379
 4  0x0000000000404547 in main (argc=3, argv=0x7fffea4449f0) at git.c:443
 5  0x000000349fd1c784 in __libc_start_main () from /lib64/libc.so.6
 6  0x0000000000403ef9 in ?? ()
 7  0x00007fffea4449d8 in ?? ()
 8  0x0000000000000000 in ?? ()

I then remembered, my .bashrc has this..

export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))

which is handy for showing up such bugs.

More info on this glibc feature is at http://udrepper.livejournal.com/11429.html

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agofetch-pack: do not stop traversing an already parsed commit
Linus Torvalds [Mon, 28 Apr 2008 23:27:49 +0000 (16:27 -0700)]
fetch-pack: do not stop traversing an already parsed commit

f3ec549 (fetch-pack: check parse_commit/object results, 2008-03-03)
broke common ancestor computation by stopping traversal when it sees
an already parsed commit.  This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoUse "=" instead of "==" in condition as it is more portable
Alex Riesen [Mon, 28 Apr 2008 21:09:55 +0000 (23:09 +0200)]
Use "=" instead of "==" in condition as it is more portable

At least the dash from Ubuntu's /bin/sh says:

    test: 233: ==: unexpected operator

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDie for an early EOF in a file reading loop
Heikki Orsila [Sun, 27 Apr 2008 14:07:24 +0000 (17:07 +0300)]
Die for an early EOF in a file reading loop

The resulting data is zero terminated after the read loop, but
the subsequent loop that scans for '\n' will overrun the buffer.

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocument functions xmemdupz(), xread() and xwrite()
Heikki Orsila [Sun, 27 Apr 2008 09:48:30 +0000 (12:48 +0300)]
Document functions xmemdupz(), xread() and xwrite()

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Mon, 28 Apr 2008 04:47:51 +0000 (21:47 -0700)]
Merge branch 'maint'

* maint:
  clone: detect and fail on excess parameters
  Remove 'header' from --signoff option description

16 years agoclone: detect and fail on excess parameters
Junio C Hamano [Wed, 23 Apr 2008 17:53:47 +0000 (10:53 -0700)]
clone: detect and fail on excess parameters

"git clone [options] $src $dst excess-garbage" simply ignored
excess-garbage without giving any diagnostic message.  Fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint-1.5.4' into maint
Junio C Hamano [Mon, 28 Apr 2008 04:47:38 +0000 (21:47 -0700)]
Merge branch 'maint-1.5.4' into maint

* maint-1.5.4:
  Remove 'header' from --signoff option description

16 years agoRemove 'header' from --signoff option description
Dan McGee [Sun, 27 Apr 2008 00:43:20 +0000 (19:43 -0500)]
Remove 'header' from --signoff option description

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash: Add completion for gitk --merge
Richard Quirk [Sun, 27 Apr 2008 15:35:10 +0000 (17:35 +0200)]
bash: Add completion for gitk --merge

Option is only completed when .git/MERGE_HEAD is present.

Signed-off-by: Richard Quirk <richard.quirk@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorev-parse: fix --verify to error out when passed junk after a good rev
Christian Couder [Sat, 26 Apr 2008 13:19:29 +0000 (15:19 +0200)]
rev-parse: fix --verify to error out when passed junk after a good rev

Before this patch something like:

$ git rev-parse --verify <good-rev> <junk>

worked whatever junk was as long as <good-rev> could be parsed
correctly.

This patch makes "git rev-parse --verify" error out when passed
any junk after a good rev.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit checkout: add -t alias for --track
Miklos Vajna [Wed, 23 Apr 2008 23:04:48 +0000 (01:04 +0200)]
git checkout: add -t alias for --track

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorev-parse: teach "--verify" to be quiet when using "-q" or "--quiet"
Christian Couder [Sat, 26 Apr 2008 11:57:23 +0000 (13:57 +0200)]
rev-parse: teach "--verify" to be quiet when using "-q" or "--quiet"

Currently "git rev-parse --verify <something>" is often used with
its error output redirected to /dev/null. This patch makes it
easier to do that.

The -q|--quiet option is designed to work the same way as it does
for "git symbolic-ref".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'ho/shared'
Junio C Hamano [Fri, 25 Apr 2008 19:17:45 +0000 (12:17 -0700)]
Merge branch 'ho/shared'

* ho/shared:
  Make core.sharedRepository more generic

16 years agoMerge branch 'maint'
Junio C Hamano [Fri, 25 Apr 2008 05:40:02 +0000 (22:40 -0700)]
Merge branch 'maint'

* maint:
  remote: create fetch config lines with '+'
  push: allow unqualified dest refspecs to DWIM
  doc/git-gc: add a note about what is collected
  t5516: remove ambiguity test (1)
  Linked glossary from cvs-migration page
  write-tree: properly detect failure to write tree objects

16 years agoremote: create fetch config lines with '+'
Jeff King [Tue, 22 Apr 2008 11:11:13 +0000 (07:11 -0400)]
remote: create fetch config lines with '+'

Since git-remote always uses remote tracking branches, it
should be safe to always force updates of those branches.
I.e., we should generate

  fetch = +refs/heads/*:refs/remotes/$remote/*

instead of

  fetch = refs/heads/*:refs/remotes/$remote/*

This was the behavior of the perl version, which seems to
have been lost in the C rewrite.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agopush: allow unqualified dest refspecs to DWIM
Jeff King [Wed, 23 Apr 2008 09:16:06 +0000 (05:16 -0400)]
push: allow unqualified dest refspecs to DWIM

Previously, a push like:

  git push remote src:dst

would go through the following steps:

  1. check for an unambiguous 'dst' on the remote; if it
     exists, then push to that ref
  2. otherwise, check if 'dst' begins with 'refs/'; if it
     does, create a new ref
  3. otherwise, complain because we don't know where in the
     refs hierarchy to put 'dst'

However, in some cases, we can guess about the ref type of
'dst' based on the ref type of 'src'. Specifically, before
complaining we now check:

  2.5. if 'src' resolves to a ref starting with refs/heads
       or refs/tags, then prepend that to 'dst'

So now this creates a new branch on the remote, whereas it
previously failed with an error message:

  git push master:newbranch

Note that, by design, we limit this DWIM behavior only to
source refs which resolve exactly (including symrefs which
resolve to existing refs). We still complain on a partial
destination refspec if the source is a raw sha1, or a ref
expression such as 'master~10'.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint-1.5.4' into maint
Junio C Hamano [Fri, 25 Apr 2008 04:50:48 +0000 (21:50 -0700)]
Merge branch 'maint-1.5.4' into maint

* maint-1.5.4:
  t5516: remove ambiguity test (1)
  Linked glossary from cvs-migration page
  write-tree: properly detect failure to write tree objects

16 years agodoc/git-gc: add a note about what is collected
Jeff King [Thu, 24 Apr 2008 01:28:36 +0000 (21:28 -0400)]
doc/git-gc: add a note about what is collected

It seems to be a FAQ that people try running git-gc, and
then get puzzled about why the size of their .git directory
didn't change. This note mentions the reasons why things
might unexpectedly get kept.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agot5516: remove ambiguity test (1)
Jeff King [Wed, 23 Apr 2008 09:21:45 +0000 (05:21 -0400)]
t5516: remove ambiguity test (1)

This test tried to push into a remote with ambiguous refs in
remotes/$x/master and remotes/$y/master. However, the remote
never actually tells us about the refs/remotes hierarchy, so
we don't even see this ambiguity.

The test happened to pass because we were simply looking for
failure, and the test fails for another reason: the dst
refspec does not exist and does not begin with refs/, making
it invalid.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoLinked glossary from cvs-migration page
Matt Graham [Wed, 23 Apr 2008 13:13:51 +0000 (09:13 -0400)]
Linked glossary from cvs-migration page

Coming from CVS, I found the git glossary vital to learning git and learning
how terms in git correlate to the cvs terminology with which I am familiar.

This patch links the glossary from the cvs-migration page so cvs users will
be able to fine the glossary as soon as they start looking at git documents.

Signed-off-by: Matt Graham <mdg149@gmail.com>
Acked-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agowrite-tree: properly detect failure to write tree objects
Junio C Hamano [Wed, 23 Apr 2008 16:47:17 +0000 (09:47 -0700)]
write-tree: properly detect failure to write tree objects

Tomasz Fortuna reported that "git commit" does not error out properly when
it cannot write tree objects out.  "git write-tree" shares the same issue,
as the failure to notice the error is deep in the logic to write tree
objects out recursively.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Wed, 23 Apr 2008 07:03:56 +0000 (00:03 -0700)]
Merge branch 'maint'

* maint:
  Amend git-push refspec documentation
  git-gc --prune is deprecated
  svn-git: Use binmode for reading/writing binary rev maps
  diff options documentation: refer to --diff-filter in --name-status
  Don't force imap.host to be set when imap.tunnel is set
  git-clone.txt: Adjust note to --shared for new pruning behavior of git-gc
  git-svn bug with blank commits and author file
  archive.c: format_subst - fixed bogus argument to memchr
  copy.c: copy_fd - correctly report write errors
  gitattributes: Fix subdirectory attributes specified from root directory

16 years agoMerge branch 'maint-1.5.4' into maint
Junio C Hamano [Wed, 23 Apr 2008 06:37:06 +0000 (23:37 -0700)]
Merge branch 'maint-1.5.4' into maint

* maint-1.5.4:
  svn-git: Use binmode for reading/writing binary rev maps
  diff options documentation: refer to --diff-filter in --name-status
  git-svn bug with blank commits and author file
  archive.c: format_subst - fixed bogus argument to memchr
  copy.c: copy_fd - correctly report write errors
  gitattributes: Fix subdirectory attributes specified from root directory

16 years agoAmend git-push refspec documentation
Sam Vilain [Mon, 21 Apr 2008 03:31:24 +0000 (15:31 +1200)]
Amend git-push refspec documentation

These paragraphs are a little confusing.  Also, make it clearer when
you have to specify the full name for <dst>

Signed-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-gc --prune is deprecated
Dmitry Potapov [Mon, 14 Apr 2008 12:17:31 +0000 (16:17 +0400)]
git-gc --prune is deprecated

25ee9731c137d0a24b0f4879eb0b0cce9b77d5b0 made the '--prune' option
deprecated and removed its description from the git-gc man page. This
patch removes all references to this option from the rest of the Git
documentation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agosvn-git: Use binmode for reading/writing binary rev maps
Michael Weber [Fri, 18 Apr 2008 13:12:04 +0000 (15:12 +0200)]
svn-git: Use binmode for reading/writing binary rev maps

Otherwise, there is a possible interaction with UTF-8 locales in
combination with PERL_UNICODE, resulting in "inconsistent size: 40" or
"read:"-type errors.

See also:
    perldoc -f binmode
    <http://perldoc.perl.org/perl581delta.html#UTF-8-no-longer-default-under-UTF-8-locales>

Signed-off-by: Michael Weber <michaelw@foldr.org>
Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodiff options documentation: refer to --diff-filter in --name-status
Miklos Vajna [Tue, 22 Apr 2008 12:23:48 +0000 (14:23 +0200)]
diff options documentation: refer to --diff-filter in --name-status

git diff --name-status outputs letters, but the meaning of those letters
is documented elsewhere. Add a note to make the manpage more intuitive.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDon't force imap.host to be set when imap.tunnel is set
Jeff King [Tue, 22 Apr 2008 10:41:47 +0000 (06:41 -0400)]
Don't force imap.host to be set when imap.tunnel is set

The documentation for git-imap-send suggests a tunnel setting such as

  Tunnel = "ssh -q user@server.com /usr/bin/imapd ./Maildir 2> /dev/null"

which works wonderfully and doesn't require a username, password or port
setting.

However, git-imap-send currently requires that the imap.host variable be
set in the config even when it was unused.  This patch changes imap-send
to only require that the imap.host setting is set if imap.tunnel is not
set.  Otherwise, server.host is set to "tunnel" for reporting purposes.

Acked-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-clone.txt: Adjust note to --shared for new pruning behavior of git-gc
Brandon Casey [Thu, 3 Apr 2008 18:26:13 +0000 (13:26 -0500)]
git-clone.txt: Adjust note to --shared for new pruning behavior of git-gc

Since git-gc now always calls prune, even with --auto, unreferenced objects
may be removed by more operations than just git-gc. This is important for
clones created using --shared or --reference.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-svn bug with blank commits and author file
Thomas Guyot-Sionnest [Tue, 22 Apr 2008 10:07:47 +0000 (06:07 -0400)]
git-svn bug with blank commits and author file

When trying to import from svn using an author file, git-svn bails out
if it encounters a blank author. The attached patch changes this
behavior and allow using the author file with blanks authors.

I came across this bug while importing from a cvs2svn repo where the
initial revision (1) has a blank author. This doesn't break the behavior
of bailing out when an unknown author is encountered.

Acked-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoarchive.c: format_subst - fixed bogus argument to memchr
Ariel Badichi [Wed, 23 Apr 2008 01:06:27 +0000 (04:06 +0300)]
archive.c: format_subst - fixed bogus argument to memchr

Also removed a superfluous test.

Signed-off-by: Ariel Badichi <abadichi@bezeqint.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocopy.c: copy_fd - correctly report write errors
Ariel Badichi [Wed, 23 Apr 2008 01:05:29 +0000 (04:05 +0300)]
copy.c: copy_fd - correctly report write errors

Previously, the errno could have been lost due to an intervening
close() call.

This patch also contains minor cosmetic changes.

Signed-off-by: Ariel Badichi <abadichi@bezeqint.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogitattributes: Fix subdirectory attributes specified from root directory
Matthew Ogilvie [Tue, 22 Apr 2008 18:19:12 +0000 (12:19 -0600)]
gitattributes: Fix subdirectory attributes specified from root directory

Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Tue, 22 Apr 2008 07:10:20 +0000 (00:10 -0700)]
Merge branch 'maint'

* maint:
  post-receive-email: fix accidental removal of a trailing space in signature line
  Escape project names before creating pathinfo URLs
  Escape project name in regexp
  bash: Add completion for git diff --base --ours --theirs
  diff-options.txt: document the new "--dirstat" option

16 years agopost-receive-email: fix accidental removal of a trailing space in signature line
Andy Parkins [Mon, 21 Apr 2008 13:44:44 +0000 (14:44 +0100)]
post-receive-email: fix accidental removal of a trailing space in signature line

post-receive-email adds a signature to the end of emails in
generate_email_footer().  The signature was separated from the main email
body using the standard string "-- ". (see RFC 3676)

a6080a0 (War on whitespace, 2007-06-07) removed the trailing whitespace
from "-- ", leaving it as "--", which is not a correct signature
separator.

This patch restores the missing space, but does it in a way that will
not set off the trailing whitespace alarms.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocompletion: remove use of dashed git commands
Dan McGee [Sun, 20 Apr 2008 17:28:44 +0000 (12:28 -0500)]
completion: remove use of dashed git commands

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agocompletion: allow 'git remote' subcommand completion
Dan McGee [Sun, 20 Apr 2008 19:34:07 +0000 (14:34 -0500)]
completion: allow 'git remote' subcommand completion

After typing 'git remote ', the subcommand options were not shown. Fix it
by adding the missing __gitcomp call.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoEscape project names before creating pathinfo URLs
martin f. krafft [Sun, 20 Apr 2008 21:23:38 +0000 (23:23 +0200)]
Escape project names before creating pathinfo URLs

If a project name contains special URL characters like +, gitweb's links
break in subtle ways. The solution is to pass the project name through
esc_url() and using the return value.

Signed-off-by: martin f. krafft <madduck@madduck.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoEscape project name in regexp
martin f. krafft [Sun, 20 Apr 2008 21:03:56 +0000 (23:03 +0200)]
Escape project name in regexp

The project name, when used in a regular expression, needs to be quoted
properly, so that stuff like '++' in the project name does not cause
Perl to barf.

Related info: http://bugs.debian.org/476076
This is a bug in Perl's CGI.pm, but fixing that exposed a similar bug in
gitweb.perl

Signed-off-by: martin f. krafft <madduck@madduck.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoSpelling fixes in the gitweb documentation
Rafael Garcia-Suarez [Thu, 17 Apr 2008 11:45:52 +0000 (13:45 +0200)]
Spelling fixes in the gitweb documentation

Mostly spelling and grammar nits.

Signed-off-by: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit.el: Set process-environment instead of invoking env
Clifford Caoile [Fri, 18 Apr 2008 13:07:12 +0000 (22:07 +0900)]
git.el: Set process-environment instead of invoking env

According to the similar patch from David Kågedal [1], "this will make
it a little less posix-dependent and more efficient." However, there
are two other areas that need to replaced, namely
git-run-command-region and git-run-hooks. This patch implements the
changes of [1] onto those Emacs Lisp functions.

If unpatched, using the git port "msysgit" on Windows will require
defadvice changes as shown at [2] (also explained at 4msysgit.git
[3]).

I have tested git-run-command-region on msysgit, because this is
always called by git-commit (via git-commit-tree <- git-do-commit <-
git-commit-file). However, I could not test git-run-hooks because it
currently does not work on the Emacs Windows port. The latter reports
the hooks files as a+rw and a-x, despite msysgit and cygwin chmod
setting on the respective files.

References:
[1] f27e55864317611385be4d33b3c53ca787379df9
[2] http://groups.google.com/group/msysgit/browse_thread/thread/b852fef689817707
[3] http://repo.or.cz/w/git/mingw/4msysgit.git?a=commit;h=3c30e5e87358eba7b6d7dcd6301ae8438f0c30ea

Signed-off-by: Clifford Caoile <piyo@users.sourceforge.net>
Acked-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agobash: Add completion for git diff --base --ours --theirs
Teemu Likonen [Sun, 20 Apr 2008 19:32:47 +0000 (22:32 +0300)]
bash: Add completion for git diff --base --ours --theirs

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agodiff-options.txt: document the new "--dirstat" option
Gerrit Pape [Mon, 21 Apr 2008 18:15:52 +0000 (18:15 +0000)]
diff-options.txt: document the new "--dirstat" option

This commit adds the documentation for the new option added by 7df7c01
(Add "--dirstat" for some directory statistics, 2008-02-12).

Noticed by Clint Adams, reported through
 http://bugs.debian.org/476437

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoFirst batch of post 1.5.5 updates
Junio C Hamano [Sun, 20 Apr 2008 23:03:40 +0000 (16:03 -0700)]
First batch of post 1.5.5 updates

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Sun, 20 Apr 2008 22:51:57 +0000 (15:51 -0700)]
Merge branch 'maint'

* maint:
  GIT 1.5.5.1

16 years agoGIT 1.5.5.1 v1.5.5.1
Junio C Hamano [Sun, 20 Apr 2008 18:36:53 +0000 (11:36 -0700)]
GIT 1.5.5.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'jc/maint-rebase-am' into maint
Junio C Hamano [Sun, 20 Apr 2008 06:01:51 +0000 (23:01 -0700)]
Merge branch 'jc/maint-rebase-am' into maint

* jc/maint-rebase-am:
  rebase: do not munge commit log message

Conflicts:

git-am.sh

16 years agoMerge branch 'jc/sha1-lookup'
Junio C Hamano [Sun, 20 Apr 2008 04:12:52 +0000 (21:12 -0700)]
Merge branch 'jc/sha1-lookup'

* jc/sha1-lookup:
  sha1-lookup: make selection of 'middle' less aggressive
  sha1-lookup: more memory efficient search in sorted list of SHA-1

16 years agoMerge branch 'jc/dirstat'
Junio C Hamano [Sun, 20 Apr 2008 04:12:34 +0000 (21:12 -0700)]
Merge branch 'jc/dirstat'

* jc/dirstat:
  diff: make --dirstat binary-file safe

16 years agoMerge branch 'mv/defer-gc'
Junio C Hamano [Sun, 20 Apr 2008 04:12:24 +0000 (21:12 -0700)]
Merge branch 'mv/defer-gc'

* mv/defer-gc:
  contrib/hooks: add an example pre-auto-gc hook
  Documentation/hooks: add pre-auto-gc hook
  git-gc --auto: add pre-auto-gc hook

16 years agoMerge branch 'py/submodule'
Junio C Hamano [Sun, 20 Apr 2008 04:11:29 +0000 (21:11 -0700)]
Merge branch 'py/submodule'

* py/submodule:
  builtin-status: Add tests for submodule summary
  builtin-status: submodule summary support
  git-submodule summary: --for-status option

16 years agoMerge branch 'jc/terminator-separator'
Junio C Hamano [Sun, 20 Apr 2008 04:10:54 +0000 (21:10 -0700)]
Merge branch 'jc/terminator-separator'

* jc/terminator-separator:
  log: teach "terminator" vs "separator" mode to "--pretty=format"

16 years agoMerge branch 'jk/remote-default-show'
Junio C Hamano [Sun, 20 Apr 2008 04:10:24 +0000 (21:10 -0700)]
Merge branch 'jk/remote-default-show'

* jk/remote-default-show:
  git-remote: show all remotes with "git remote show"

16 years agoMerge branch 'mk/color'
Junio C Hamano [Sun, 20 Apr 2008 04:09:54 +0000 (21:09 -0700)]
Merge branch 'mk/color'

* mk/color:
  Use color.ui variable in scripts too

16 years agoMerge branch 'jc/maint-rebase-am'
Junio C Hamano [Sat, 19 Apr 2008 07:25:15 +0000 (00:25 -0700)]
Merge branch 'jc/maint-rebase-am'

* jc/maint-rebase-am:
  rebase: do not munge commit log message

Conflicts:

git-am.sh

16 years agoMerge branch 'maint'
Junio C Hamano [Sat, 19 Apr 2008 05:58:32 +0000 (22:58 -0700)]
Merge branch 'maint'

* maint:
  gitweb: Fix 'history' view for deleted files with history
  Document that WebDAV doesn't need git on the server, and works over SSL
  git-remote: reject adding remotes with invalid names
  am: POSIX portability fix

16 years agogitweb: Fix 'history' view for deleted files with history
Jakub Narebski [Sun, 13 Apr 2008 12:12:15 +0000 (14:12 +0200)]
gitweb: Fix 'history' view for deleted files with history

When asked for history of a file which is not present in given branch
("HEAD", i.e. current branch, or given by transient $hash_hase ('hb')
parameter), but is present deeper in the history (meaning that "git
rev-list --full-history $hash_base -- $file_name" is not empty), and
there is no $hash ('h') parameter set for a file, gitweb would spew
multiple of "Use of uninitialized value" warnings, and some links
would be missing.  This commit fixes this bug.

This bug occurs in the rare cases when "git log -- <path>" is empty
and "git log --full-history -- <path>" is not, or to be more exact in
the cases when full-history starts later than given branch.  It can
happen if you are using handcrafted gitwb URL, or if you follow
generic 'history' link or bookmark for a file which got deleted.

Gitweb tried to get file type ('tree', or 'blob', or even 'commit')
from the commit we start searching from (where the file was not
present), and not among found commits.  This was the cause of "Use of
uninitialized value" warnings.

This commit also add tests for such situation to t9500 test.

While we are it, return HTTP error if there is _no_ history; it means
that file or directory was not found (for given branch).  Also error
out if type of item could not be found: it should not happen now, but
better be sure.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoDocument that WebDAV doesn't need git on the server, and works over SSL
Matthieu Moy [Sun, 13 Apr 2008 13:38:21 +0000 (15:38 +0200)]
Document that WebDAV doesn't need git on the server, and works over SSL

I managed to set up a Git repository on a preconfigured WebDAV server,
and using HTTPS, without installing Git on it or changing the server
configuration. This works through a proxy too. This patch reflects
this (it previously stated that Git was _necessary_ on the server,
which isn't true). Also give a few hints to troubleshoting.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint-1.5.4' into maint
Junio C Hamano [Sat, 19 Apr 2008 05:07:00 +0000 (22:07 -0700)]
Merge branch 'maint-1.5.4' into maint

* maint-1.5.4:
  am: POSIX portability fix

16 years agogit-remote: reject adding remotes with invalid names
Jonas Fonseca [Sun, 13 Apr 2008 09:56:54 +0000 (11:56 +0200)]
git-remote: reject adding remotes with invalid names

This can happen if the arguments to git-remote add is switched by the
user, and git would only show an error if fetching was also requested.
Fix it by using the refspec parsing engine to check if the requested
name can be parsed as a remote before add it.

Also cleanup so that the "remote.<name>.url" config name buffer is only
initialized once.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoam: POSIX portability fix
Junio C Hamano [Fri, 18 Apr 2008 23:11:40 +0000 (16:11 -0700)]
am: POSIX portability fix

POSIX allows echo without flag to interpret specials such as \n, and we
tried to make things portable by using printf instead where it matters.
Recently added code to "git am" had unprotected "echo", which was caught
by t4014 and Rémi Vanicat.

This should fix it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMake core.sharedRepository more generic
Heikki Orsila [Wed, 16 Apr 2008 08:34:24 +0000 (11:34 +0300)]
Make core.sharedRepository more generic

git init --shared=0xxx, where '0xxx' is an octal number, will create
a repository with file modes set to '0xxx'. Users with a safe umask
value (0077) can use this option to force file modes. For example,
'0640' is a group-readable but not group-writable regardless of
user's umask value. Values compatible with old Git versions are written
as they were before, for compatibility reasons. That is, "1" for
"group" and "2" for "everybody".

"git config core.sharedRepository 0xxx" is also handled.

Signed-off-by: Heikki Orsila <heikki.orsila@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Thu, 17 Apr 2008 00:49:52 +0000 (17:49 -0700)]
Merge branch 'maint'

* maint:
  git-am: minor cleanup
  Clarify and fix English in "git-rm" documentation

16 years agoMerge branch 'maint-1.5.4' into maint
Junio C Hamano [Thu, 17 Apr 2008 00:04:05 +0000 (17:04 -0700)]
Merge branch 'maint-1.5.4' into maint

* maint-1.5.4:
  git-am: minor cleanup
  Clarify and fix English in "git-rm" documentation

16 years agogit-am: minor cleanup
Junio C Hamano [Wed, 16 Apr 2008 23:46:26 +0000 (16:46 -0700)]
git-am: minor cleanup

This moves the assignment to FIRSTLINE down so that we do not have
to have multiple copies.

Suggested by Linus.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoClarify and fix English in "git-rm" documentation
Jon Loeliger [Wed, 16 Apr 2008 23:41:27 +0000 (18:41 -0500)]
Clarify and fix English in "git-rm" documentation

Do some verb-noun agreement changes.
Clarify some file globbing cases.
Fixed a wrong statement in an example.

Signed-off-by: Jon Loeliger <jdl@jdl.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agorebase: do not munge commit log message
Junio C Hamano [Wed, 16 Apr 2008 19:50:48 +0000 (12:50 -0700)]
rebase: do not munge commit log message

Traditionally git-rebase was implemented in terms of "format-patch" piped
to "am -3", to strike balance between speed (because it avoids a rather
expensive read-tree/merge-recursive machinery most of the time) and
flexibility (the magic "-3" allows it to fall back to 3-way merge as
necessary).  However, this combination has one flaw when dealing with a
nonstandard commit log message format that has more than one lines in the
first paragraph.

This teaches "git am --rebasing" to take advantage of the fact that the
mbox message "git rebase" prepares for it records the original commit
object name, to get the log message from the original commit object
instead.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agoMerge branch 'maint'
Junio C Hamano [Wed, 16 Apr 2008 07:45:52 +0000 (00:45 -0700)]
Merge branch 'maint'

* maint:
  git-bisect: make "start", "good" and "skip" succeed or fail atomically
  git-am: cope better with an empty Subject: line
  Ignore leading empty lines while summarizing merges
  bisect: squelch "fatal: ref HEAD not a symref" misleading message
  builtin-apply: Show a more descriptive error on failure when opening a patch
  Clarify documentation of git-cvsserver, particularly in relation to git-shell

16 years agoMerge branch 'maint-1.5.4' into maint
Junio C Hamano [Wed, 16 Apr 2008 07:37:33 +0000 (00:37 -0700)]
Merge branch 'maint-1.5.4' into maint

* maint-1.5.4:
  git-bisect: make "start", "good" and "skip" succeed or fail atomically
  git-am: cope better with an empty Subject: line
  Ignore leading empty lines while summarizing merges
  bisect: squelch "fatal: ref HEAD not a symref" misleading message
  builtin-apply: Show a more descriptive error on failure when opening a patch
  Clarify documentation of git-cvsserver, particularly in relation to git-shell

16 years agogit-bisect: make "start", "good" and "skip" succeed or fail atomically
Christian Couder [Mon, 14 Apr 2008 03:41:45 +0000 (05:41 +0200)]
git-bisect: make "start", "good" and "skip" succeed or fail atomically

Before this patch, when "git bisect start", "git bisect good" or
"git bisect skip" were called with many revisions, they could fail
after having already marked some revisions as "good", "bad" or
"skip".

This could be especilally bad for "git bisect start" because as
the file ".git/BISECT_NAMES" would not have been written, there
would have been no attempt to clear the marked revisions on a
"git bisect reset". That's because if there is no
".git/BISECT_NAMES" file, nothing is done to clean things up, as
the bisect session is not supposed to have started.

While at it, let's also create the ".git/BISECT_START" file, only
after ".git/BISECT_NAMES" as been created.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 years agogit-am: cope better with an empty Subject: line
Linus Torvalds [Tue, 15 Apr 2008 19:56:50 +0000 (12:56 -0700)]
git-am: cope better with an empty Subject: line

When the Subject: line is empty for whatever reason, git-am was fooled by
it and left an empty line at the beginning of the resulting commit log
message.

This moves the logic around so that we do not keep $SUBJECT in a separate
variable.  Instead, $dotest/msg-clean, which used to be the log message
body extracted from the message and then trailing whitespaces cleansed
out, now contains the subject line followed by a blank line at the
beginning for normal messages, and we use the first line from the file as
the summary line throughout the program.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>