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:
43
43
44
44
new_tag ::= 'tag' sp tag_str lf
45
45
'from' sp (ref_str | hexsha1 | sha1exp_str | idnum) lf
46
- 'tagger' sp name '<' email '>' when lf
46
+ ( 'tagger' sp name '<' email '>' when lf)?
47
47
tag_msg;
48
48
tag_msg ::= data;
49
49
@@ -2264,23 +2264,27 @@ static void parse_new_tag(void)
2264
2264
read_next_command ();
2265
2265
2266
2266
/* 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 ;
2270
2272
2271
2273
/* tag payload/message */
2272
- read_next_command ();
2273
2274
parse_data (& msg );
2274
2275
2275
2276
/* build the tag object */
2276
2277
strbuf_reset (& new_data );
2278
+
2277
2279
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' );
2284
2288
strbuf_addbuf (& new_data , & msg );
2285
2289
free (tagger );
2286
2290
Original file line number Diff line number Diff line change @@ -56,6 +56,12 @@ M 644 :2 file2
56
56
M 644 :3 file3
57
57
M 755 :4 file4
58
58
59
+ tag series-A
60
+ from :5
61
+ data <<EOF
62
+ An annotated tag without a tagger
63
+ EOF
64
+
59
65
INPUT_END
60
66
test_expect_success \
61
67
' A: create pack from stdin' \
@@ -101,6 +107,18 @@ test_expect_success \
101
107
' A: verify file4' \
102
108
' git cat-file blob master:file4 >actual && test_cmp expect actual'
103
109
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
+
104
122
cat > expect << EOF
105
123
:2 ` git rev-parse --verify master:file2`
106
124
:3 ` git rev-parse --verify master:file3`
You can’t perform that action at this time.
0 commit comments