git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] commit --amend and missing space in ident line
@ 2010-05-02  8:49 Jonathan Nieder
  2010-05-02  8:53 ` [PATCH 1/2] test-lib: Let tests specify commands to be run at end of test Jonathan Nieder
  2010-05-02  8:57 ` [PATCH 2/2] commit --amend: cope with missing display name Jonathan Nieder
  0 siblings, 2 replies; 3+ messages in thread
From: Jonathan Nieder @ 2010-05-02  8:49 UTC (permalink / raw)
  To: git; +Cc: Shawn O. Pearce, Santi Béjar, Junio C Hamano

The problem: since fast-import is advertised to expect the format

  "author" SP LT email GT SP date

when there is no display name associated to the author of a commit, it
seems likely that some importers use that format[1].  Current
fast-import passes that input through into the generated commit
objects.  Which would mean there are commit objects like this in
existing repositories generated by such importers.

Since commit --amend looks for the string " <" _after_ the "author "
string, it does not cope well with this sort of ident line.  In fact,
the first " <" is found on the following "committer" line, while "> "
is found on the author line; the distance between them, because
negative, becomes a large unsigned integer; and the display name and
email are considered to be very long but acceptable and happily
used[2].

After this series, commit --amend will instead see an empty display
name and the email from between the angle brackets and accordingly die
after complaining about the empty ident.  It might make sense to
tolerate an empty ident during --amend (silently fixing it up to add
the extra space character when missing), but such a change to the
traditional "GIT_AUTHOR_NAME=" behavior would go beyond the scope of
this series.

Thoughts?
Jonathan Nieder (2):
  test-lib: Let tests specify commands to be run at end of test
  commit --amend: cope better with invalid ident line

 builtin/commit.c  |   20 +++++++++++++-------
 t/t7509-commit.sh |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 t/test-lib.sh     |   28 +++++++++++++++++++++++++++-
 3 files changed, 86 insertions(+), 8 deletions(-)

[1] http://thread.gmane.org/gmane.comp.version-control.git/145651/focus=145825
[2] Earlier I suspected it would die().
http://thread.gmane.org/gmane.comp.version-control.git/145651/focus=145826
Sorry for the nonsense.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-02  8:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-02  8:49 [PATCH 0/2] commit --amend and missing space in ident line Jonathan Nieder
2010-05-02  8:53 ` [PATCH 1/2] test-lib: Let tests specify commands to be run at end of test Jonathan Nieder
2010-05-02  8:57 ` [PATCH 2/2] commit --amend: cope with missing display name Jonathan Nieder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).