1818/*
1919 * We refuse to tag something we can't verify. Just because.
2020 */
21- static int verify_object (const unsigned char * sha1 , const char * expected_type )
21+ static int verify_object (const struct object_id * oid , const char * expected_type )
2222{
2323 int ret = -1 ;
2424 enum object_type type ;
2525 unsigned long size ;
26- void * buffer = read_sha1_file (sha1 , & type , & size );
27- const unsigned char * repl = lookup_replace_object (sha1 );
26+ void * buffer = read_sha1_file (oid -> hash , & type , & size );
27+ const unsigned char * repl = lookup_replace_object (oid -> hash );
2828
2929 if (buffer ) {
3030 if (type == type_from_string (expected_type ))
@@ -38,8 +38,8 @@ static int verify_tag(char *buffer, unsigned long size)
3838{
3939 int typelen ;
4040 char type [20 ];
41- unsigned char sha1 [ 20 ] ;
42- const char * object , * type_line , * tag_line , * tagger_line , * lb , * rb ;
41+ struct object_id oid ;
42+ const char * object , * type_line , * tag_line , * tagger_line , * lb , * rb , * p ;
4343 size_t len ;
4444
4545 if (size < 84 )
@@ -52,11 +52,11 @@ static int verify_tag(char *buffer, unsigned long size)
5252 if (memcmp (object , "object " , 7 ))
5353 return error ("char%d: does not start with \"object \"" , 0 );
5454
55- if (get_sha1_hex (object + 7 , sha1 ))
55+ if (parse_oid_hex (object + 7 , & oid , & p ))
5656 return error ("char%d: could not get SHA1 hash" , 7 );
5757
5858 /* Verify type line */
59- type_line = object + 48 ;
59+ type_line = p + 1 ;
6060 if (memcmp (type_line - 1 , "\ntype " , 6 ))
6161 return error ("char%d: could not find \"\\ntype \"" , 47 );
6262
@@ -80,8 +80,8 @@ static int verify_tag(char *buffer, unsigned long size)
8080 type [typelen ] = 0 ;
8181
8282 /* Verify that the object matches */
83- if (verify_object (sha1 , type ))
84- return error ("char%d: could not verify object %s" , 7 , sha1_to_hex ( sha1 ));
83+ if (verify_object (& oid , type ))
84+ return error ("char%d: could not verify object %s" , 7 , oid_to_hex ( & oid ));
8585
8686 /* Verify the tag-name: we don't allow control characters or spaces in it */
8787 tag_line += 4 ;
0 commit comments