@@ -2305,6 +2305,7 @@ static void parse_new_tag(void)
2305
2305
struct tag * t ;
2306
2306
uintmax_t from_mark = 0 ;
2307
2307
unsigned char sha1 [20 ];
2308
+ enum object_type type ;
2308
2309
2309
2310
/* Obtain the new tag name from the rest of our command */
2310
2311
sp = strchr (command_buf .buf , ' ' ) + 1 ;
@@ -2325,19 +2326,18 @@ static void parse_new_tag(void)
2325
2326
s = lookup_branch (from );
2326
2327
if (s ) {
2327
2328
hashcpy (sha1 , s -> sha1 );
2329
+ type = OBJ_COMMIT ;
2328
2330
} else if (* from == ':' ) {
2329
2331
struct object_entry * oe ;
2330
2332
from_mark = strtoumax (from + 1 , NULL , 10 );
2331
2333
oe = find_mark (from_mark );
2332
- if (oe -> type != OBJ_COMMIT )
2333
- die ("Mark :%" PRIuMAX " not a commit" , from_mark );
2334
+ type = oe -> type ;
2334
2335
hashcpy (sha1 , oe -> sha1 );
2335
2336
} else if (!get_sha1 (from , sha1 )) {
2336
2337
unsigned long size ;
2337
2338
char * buf ;
2338
2339
2339
- buf = read_object_with_reference (sha1 ,
2340
- commit_type , & size , sha1 );
2340
+ buf = read_sha1_file (sha1 , & type , & size );
2341
2341
if (!buf || size < 46 )
2342
2342
die ("Not a valid commit: %s" , from );
2343
2343
free (buf );
@@ -2362,7 +2362,7 @@ static void parse_new_tag(void)
2362
2362
"object %s\n"
2363
2363
"type %s\n"
2364
2364
"tag %s\n" ,
2365
- sha1_to_hex (sha1 ), commit_type , t -> name );
2365
+ sha1_to_hex (sha1 ), typename ( type ) , t -> name );
2366
2366
if (tagger )
2367
2367
strbuf_addf (& new_data ,
2368
2368
"tagger %s\n" , tagger );
0 commit comments