fast-import: make tagger information optional
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>
This commit is contained in:
parent
4e46a8d62c
commit
88fbf67b78
@ -43,7 +43,7 @@ Format of STDIN stream:
|
|||||||
|
|
||||||
new_tag ::= 'tag' sp tag_str lf
|
new_tag ::= 'tag' sp tag_str lf
|
||||||
'from' sp (ref_str | hexsha1 | sha1exp_str | idnum) 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;
|
||||||
tag_msg ::= data;
|
tag_msg ::= data;
|
||||||
|
|
||||||
@ -2264,23 +2264,27 @@ static void parse_new_tag(void)
|
|||||||
read_next_command();
|
read_next_command();
|
||||||
|
|
||||||
/* tagger ... */
|
/* tagger ... */
|
||||||
if (prefixcmp(command_buf.buf, "tagger "))
|
if (!prefixcmp(command_buf.buf, "tagger ")) {
|
||||||
die("Expected tagger command, got %s", command_buf.buf);
|
tagger = parse_ident(command_buf.buf + 7);
|
||||||
tagger = parse_ident(command_buf.buf + 7);
|
read_next_command();
|
||||||
|
} else
|
||||||
|
tagger = NULL;
|
||||||
|
|
||||||
/* tag payload/message */
|
/* tag payload/message */
|
||||||
read_next_command();
|
|
||||||
parse_data(&msg);
|
parse_data(&msg);
|
||||||
|
|
||||||
/* build the tag object */
|
/* build the tag object */
|
||||||
strbuf_reset(&new_data);
|
strbuf_reset(&new_data);
|
||||||
|
|
||||||
strbuf_addf(&new_data,
|
strbuf_addf(&new_data,
|
||||||
"object %s\n"
|
"object %s\n"
|
||||||
"type %s\n"
|
"type %s\n"
|
||||||
"tag %s\n"
|
"tag %s\n",
|
||||||
"tagger %s\n"
|
sha1_to_hex(sha1), commit_type, t->name);
|
||||||
"\n",
|
if (tagger)
|
||||||
sha1_to_hex(sha1), commit_type, t->name, tagger);
|
strbuf_addf(&new_data,
|
||||||
|
"tagger %s\n", tagger);
|
||||||
|
strbuf_addch(&new_data, '\n');
|
||||||
strbuf_addbuf(&new_data, &msg);
|
strbuf_addbuf(&new_data, &msg);
|
||||||
free(tagger);
|
free(tagger);
|
||||||
|
|
||||||
|
@ -56,6 +56,12 @@ M 644 :2 file2
|
|||||||
M 644 :3 file3
|
M 644 :3 file3
|
||||||
M 755 :4 file4
|
M 755 :4 file4
|
||||||
|
|
||||||
|
tag series-A
|
||||||
|
from :5
|
||||||
|
data <<EOF
|
||||||
|
An annotated tag without a tagger
|
||||||
|
EOF
|
||||||
|
|
||||||
INPUT_END
|
INPUT_END
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'A: create pack from stdin' \
|
'A: create pack from stdin' \
|
||||||
@ -101,6 +107,18 @@ test_expect_success \
|
|||||||
'A: verify file4' \
|
'A: verify file4' \
|
||||||
'git cat-file blob master:file4 >actual && test_cmp expect actual'
|
'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
|
cat >expect <<EOF
|
||||||
:2 `git rev-parse --verify master:file2`
|
:2 `git rev-parse --verify master:file2`
|
||||||
:3 `git rev-parse --verify master:file3`
|
:3 `git rev-parse --verify master:file3`
|
||||||
|
Loading…
Reference in New Issue
Block a user