summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4e46a8d)
raw | patch | inline | side by side (parent: 4e46a8d)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 19 Dec 2008 22:41:21 +0000 (14:41 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 20 Dec 2008 03:25:06 +0000 (19:25 -0800) |
Even though newer Porcelain tools always record the tagger information
when creating new tags, export/import pair should be able to faithfully
reproduce ancient tag objects that lack tagger information.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
when creating new tags, export/import pair should be able to faithfully
reproduce ancient tag objects that lack tagger information.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
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 13b36147a46390aa9fe3461eead08be7dadc35cd..d58cca58e5fdbe0838e3622148d7b502affeaebf 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
new_tag ::= 'tag' sp tag_str lf
'from' sp (ref_str | hexsha1 | sha1exp_str | idnum) lf
- 'tagger' sp name '<' email '>' when lf
+ ('tagger' sp name '<' email '>' when lf)?
tag_msg;
tag_msg ::= data;
read_next_command();
/* tagger ... */
- if (prefixcmp(command_buf.buf, "tagger "))
- die("Expected tagger command, got %s", command_buf.buf);
- tagger = parse_ident(command_buf.buf + 7);
+ if (!prefixcmp(command_buf.buf, "tagger ")) {
+ tagger = parse_ident(command_buf.buf + 7);
+ read_next_command();
+ } else
+ tagger = NULL;
/* tag payload/message */
- read_next_command();
parse_data(&msg);
/* build the tag object */
strbuf_reset(&new_data);
+
strbuf_addf(&new_data,
- "object %s\n"
- "type %s\n"
- "tag %s\n"
- "tagger %s\n"
- "\n",
- sha1_to_hex(sha1), commit_type, t->name, tagger);
+ "object %s\n"
+ "type %s\n"
+ "tag %s\n",
+ sha1_to_hex(sha1), commit_type, t->name);
+ if (tagger)
+ strbuf_addf(&new_data,
+ "tagger %s\n", tagger);
+ strbuf_addch(&new_data, '\n');
strbuf_addbuf(&new_data, &msg);
free(tagger);
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index dba3a1b48f70c47b405d85f140684b181e62002a..8b79de5b6345680bfc0a50f02a0334ddc67186c2 100755 (executable)
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
M 644 :3 file3
M 755 :4 file4
+tag series-A
+from :5
+data <<EOF
+An annotated tag without a tagger
+EOF
+
INPUT_END
test_expect_success \
'A: create pack from stdin' \
'A: verify file4' \
'git cat-file blob master:file4 >actual && test_cmp expect actual'
+cat >expect <<EOF
+object $(git rev-parse refs/heads/master)
+type commit
+tag series-A
+
+An annotated tag without a tagger
+EOF
+test_expect_success 'A: verify tag/series-A' '
+ git cat-file tag tags/series-A >actual &&
+ test_cmp expect actual
+'
+
cat >expect <<EOF
:2 `git rev-parse --verify master:file2`
:3 `git rev-parse --verify master:file3`