git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/2] commit --amend and missing space in ident line

From
Jonathan Nieder <jrnieder@gmail.com>
Date
May 2, 2010, 08:49 UTC
Message-ID
<20100502084827.GA1690@progeny.tock>
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.

Next: Jonathan Nieder
Message 1 of 3 in “commit --amend and missing space in ident line”
  1. 0/2 commit --amend and missing space in ident lineJonathan Nieder, May 2, 2010
  2. 1/2 test-lib: Let tests specify commands to be run at end of testJonathan Nieder, May 2, 2010
  3. 2/2 commit --amend: cope with missing display nameJonathan Nieder, May 2, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.