commit --amend and missing space in ident line
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | test-lib: Let tests specify commands to be run at end of testt/ | +27 | 0 replies | |
| 2/2 | commit --amend: cope with missing display namebuiltin/ t/ | +59 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] commit --amend and missing space in ident line
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.