@@ -2305,6 +2305,7 @@ static void parse_new_tag(void)
23052305 struct tag * t ;
23062306 uintmax_t from_mark = 0 ;
23072307 unsigned char sha1 [20 ];
2308+ enum object_type type ;
23082309
23092310 /* Obtain the new tag name from the rest of our command */
23102311 sp = strchr (command_buf .buf , ' ' ) + 1 ;
@@ -2325,19 +2326,18 @@ static void parse_new_tag(void)
23252326 s = lookup_branch (from );
23262327 if (s ) {
23272328 hashcpy (sha1 , s -> sha1 );
2329+ type = OBJ_COMMIT ;
23282330 } else if (* from == ':' ) {
23292331 struct object_entry * oe ;
23302332 from_mark = strtoumax (from + 1 , NULL , 10 );
23312333 oe = find_mark (from_mark );
2332- if (oe -> type != OBJ_COMMIT )
2333- die ("Mark :%" PRIuMAX " not a commit" , from_mark );
2334+ type = oe -> type ;
23342335 hashcpy (sha1 , oe -> sha1 );
23352336 } else if (!get_sha1 (from , sha1 )) {
23362337 unsigned long size ;
23372338 char * buf ;
23382339
2339- buf = read_object_with_reference (sha1 ,
2340- commit_type , & size , sha1 );
2340+ buf = read_sha1_file (sha1 , & type , & size );
23412341 if (!buf || size < 46 )
23422342 die ("Not a valid commit: %s" , from );
23432343 free (buf );
@@ -2362,7 +2362,7 @@ static void parse_new_tag(void)
23622362 "object %s\n"
23632363 "type %s\n"
23642364 "tag %s\n" ,
2365- sha1_to_hex (sha1 ), commit_type , t -> name );
2365+ sha1_to_hex (sha1 ), typename ( type ) , t -> name );
23662366 if (tagger )
23672367 strbuf_addf (& new_data ,
23682368 "tagger %s\n" , tagger );
0 commit comments