summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4cedb78)
raw | patch | inline | side by side (parent: 4cedb78)
author | Dmitry Ivankov <divanorama@gmail.com> | |
Thu, 11 Aug 2011 10:21:07 +0000 (16:21 +0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 11 Aug 2011 19:20:56 +0000 (12:20 -0700) |
fast-import format declares 'committer_name SP' to be optional in
'committer_name SP LT email GT'. But for a (commit) object SP is
obligatory while zero length committer_name is ok. git-fsck checks
that SP is present, so fast-import must prepend it if the name SP
part is omitted. It doesn't do so and thus for "LT email GT" ident
it writes a bad object.
Name cannot contain LT or GT, ident always comes after SP in fast-import.
So if ident starts with LT reuse the SP as if a valid 'SP LT email GT'
ident was passed.
This fixes a ident parsing bug for a well-formed fast-import input.
Though the parsing is still loose and can accept a ill-formed input.
Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
'committer_name SP LT email GT'. But for a (commit) object SP is
obligatory while zero length committer_name is ok. git-fsck checks
that SP is present, so fast-import must prepend it if the name SP
part is omitted. It doesn't do so and thus for "LT email GT" ident
it writes a bad object.
Name cannot contain LT or GT, ident always comes after SP in fast-import.
So if ident starts with LT reuse the SP as if a valid 'SP LT email GT'
ident was passed.
This fixes a ident parsing bug for a well-formed fast-import input.
Though the parsing is still loose and can accept a ill-formed input.
Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fast-import.c | patch | blob | history | |
t/t9300-fast-import.sh | patch | blob | history |
diff --git a/fast-import.c b/fast-import.c
index 78d978684da2e2b79340c138e1b6300100df1221..c07f155723c8bd3ff724e0a4a1c93842c8b985ca 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
size_t name_len;
char *ident;
+ /* ensure there is a space delimiter even if there is no name */
+ if (*buf == '<')
+ --buf;
+
gt = strrchr(buf, '>');
if (!gt)
die("Missing > in ident string: %s", buf);
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index a659dd408f4d6bbbf704279b93b02dc3f7876b13..09ef6ba1d995a9a1b47da5894cbf3d3be058b962 100755 (executable)
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
empty commit
COMMIT
INPUT_END
-test_expect_failure 'B: accept and fixup committer with no name' '
+test_expect_success 'B: accept and fixup committer with no name' '
git fast-import <input &&
out=$(git fsck) &&
echo "$out" &&