File tree Expand file tree Collapse file tree 2 files changed +33
-11
lines changed
Expand file tree Collapse file tree 2 files changed +33
-11
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ Format of STDIN stream:
4343
4444 new_tag ::= 'tag' sp tag_str lf
4545 'from' sp (ref_str | hexsha1 | sha1exp_str | idnum) lf
46- 'tagger' sp name '<' email '>' when lf
46+ ( 'tagger' sp name '<' email '>' when lf)?
4747 tag_msg;
4848 tag_msg ::= data;
4949
@@ -2264,23 +2264,27 @@ static void parse_new_tag(void)
22642264 read_next_command ();
22652265
22662266 /* tagger ... */
2267- if (prefixcmp (command_buf .buf , "tagger " ))
2268- die ("Expected tagger command, got %s" , command_buf .buf );
2269- tagger = parse_ident (command_buf .buf + 7 );
2267+ if (!prefixcmp (command_buf .buf , "tagger " )) {
2268+ tagger = parse_ident (command_buf .buf + 7 );
2269+ read_next_command ();
2270+ } else
2271+ tagger = NULL ;
22702272
22712273 /* tag payload/message */
2272- read_next_command ();
22732274 parse_data (& msg );
22742275
22752276 /* build the tag object */
22762277 strbuf_reset (& new_data );
2278+
22772279 strbuf_addf (& new_data ,
2278- "object %s\n"
2279- "type %s\n"
2280- "tag %s\n"
2281- "tagger %s\n"
2282- "\n" ,
2283- sha1_to_hex (sha1 ), commit_type , t -> name , tagger );
2280+ "object %s\n"
2281+ "type %s\n"
2282+ "tag %s\n" ,
2283+ sha1_to_hex (sha1 ), commit_type , t -> name );
2284+ if (tagger )
2285+ strbuf_addf (& new_data ,
2286+ "tagger %s\n" , tagger );
2287+ strbuf_addch (& new_data , '\n' );
22842288 strbuf_addbuf (& new_data , & msg );
22852289 free (tagger );
22862290
Original file line number Diff line number Diff line change @@ -56,6 +56,12 @@ M 644 :2 file2
5656M 644 :3 file3
5757M 755 :4 file4
5858
59+ tag series-A
60+ from :5
61+ data <<EOF
62+ An annotated tag without a tagger
63+ EOF
64+
5965INPUT_END
6066test_expect_success \
6167 ' A: create pack from stdin' \
@@ -101,6 +107,18 @@ test_expect_success \
101107 ' A: verify file4' \
102108 ' git cat-file blob master:file4 >actual && test_cmp expect actual'
103109
110+ cat > expect << EOF
111+ object $( git rev-parse refs/heads/master)
112+ type commit
113+ tag series-A
114+
115+ An annotated tag without a tagger
116+ EOF
117+ test_expect_success ' A: verify tag/series-A' '
118+ git cat-file tag tags/series-A >actual &&
119+ test_cmp expect actual
120+ '
121+
104122cat > expect << EOF
105123:2 ` git rev-parse --verify master:file2`
106124:3 ` git rev-parse --verify master:file3`
You can’t perform that action at this time.
0 commit comments