@@ -677,13 +677,13 @@ int verify_ref_format(const char *format)
677677 * by the "struct object" representation, set *eaten as well---it is a
678678 * signal from parse_object_buffer to us not to free the buffer.
679679 */
680- static void * get_obj (const unsigned char * sha1 , struct object * * obj , unsigned long * sz , int * eaten )
680+ static void * get_obj (const struct object_id * oid , struct object * * obj , unsigned long * sz , int * eaten )
681681{
682682 enum object_type type ;
683- void * buf = read_sha1_file (sha1 , & type , sz );
683+ void * buf = read_sha1_file (oid -> hash , & type , sz );
684684
685685 if (buf )
686- * obj = parse_object_buffer (sha1 , type , * sz , buf , eaten );
686+ * obj = parse_object_buffer (oid -> hash , type , * sz , buf , eaten );
687687 else
688688 * obj = NULL ;
689689 return buf ;
@@ -1293,7 +1293,7 @@ static void populate_value(struct ref_array_item *ref)
12931293 struct object * obj ;
12941294 int eaten , i ;
12951295 unsigned long size ;
1296- const unsigned char * tagged ;
1296+ const struct object_id * tagged ;
12971297
12981298 ref -> value = xcalloc (used_atom_cnt , sizeof (struct atom_value ));
12991299
@@ -1370,10 +1370,10 @@ static void populate_value(struct ref_array_item *ref)
13701370 continue ;
13711371 } else if (!strcmp (name , "HEAD" )) {
13721372 const char * head ;
1373- unsigned char sha1 [ 20 ] ;
1373+ struct object_id oid ;
13741374
13751375 head = resolve_ref_unsafe ("HEAD" , RESOLVE_REF_READING ,
1376- sha1 , NULL );
1376+ oid . hash , NULL );
13771377 if (head && !strcmp (ref -> refname , head ))
13781378 v -> s = "*" ;
13791379 else
@@ -1415,7 +1415,7 @@ static void populate_value(struct ref_array_item *ref)
14151415 return ;
14161416
14171417 need_obj :
1418- buf = get_obj (ref -> objectname . hash , & obj , & size , & eaten );
1418+ buf = get_obj (& ref -> objectname , & obj , & size , & eaten );
14191419 if (!buf )
14201420 die (_ ("missing object %s for %s" ),
14211421 oid_to_hex (& ref -> objectname ), ref -> refname );
@@ -1438,7 +1438,7 @@ static void populate_value(struct ref_array_item *ref)
14381438 * If it is a tag object, see if we use a value that derefs
14391439 * the object, and if we do grab the object it refers to.
14401440 */
1441- tagged = ((struct tag * )obj )-> tagged -> oid . hash ;
1441+ tagged = & ((struct tag * )obj )-> tagged -> oid ;
14421442
14431443 /*
14441444 * NEEDSWORK: This derefs tag only once, which
@@ -1449,10 +1449,10 @@ static void populate_value(struct ref_array_item *ref)
14491449 buf = get_obj (tagged , & obj , & size , & eaten );
14501450 if (!buf )
14511451 die (_ ("missing object %s for %s" ),
1452- sha1_to_hex (tagged ), ref -> refname );
1452+ oid_to_hex (tagged ), ref -> refname );
14531453 if (!obj )
14541454 die (_ ("parse_object_buffer failed on %s for %s" ),
1455- sha1_to_hex (tagged ), ref -> refname );
1455+ oid_to_hex (tagged ), ref -> refname );
14561456 grab_values (ref -> value , 1 , obj , buf , size );
14571457 if (!eaten )
14581458 free (buf );
0 commit comments