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:
@ -43,7 +43,7 @@ Format of STDIN stream:
|
||||
|
||||
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;
|
||||
|
||||
@ -2264,23 +2264,27 @@ static void parse_new_tag(void)
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user