@@ -313,26 +313,24 @@ static void append_suffix(int depth, const struct object_id *oid, struct strbuf
313313 repo_find_unique_abbrev (the_repository , oid , abbrev ));
314314}
315315
316- static void describe_commit (struct object_id * oid , struct strbuf * dst )
316+ static void describe_commit (struct commit * cmit , struct strbuf * dst )
317317{
318- struct commit * cmit , * gave_up_on = NULL ;
318+ struct commit * gave_up_on = NULL ;
319319 struct commit_list * list ;
320320 struct commit_name * n ;
321321 struct possible_tag all_matches [MAX_TAGS ];
322322 unsigned int match_cnt = 0 , annotated_cnt = 0 , cur_match ;
323323 unsigned long seen_commits = 0 ;
324324 unsigned int unannotated_cnt = 0 ;
325325
326- cmit = lookup_commit_reference (the_repository , oid );
327-
328326 n = find_commit_name (& cmit -> object .oid );
329327 if (n && (tags || all || n -> prio == 2 )) {
330328 /*
331329 * Exact match to an existing ref.
332330 */
333331 append_name (n , dst );
334332 if (n -> misnamed || longformat )
335- append_suffix (0 , n -> tag ? get_tagged_oid (n -> tag ) : oid , dst );
333+ append_suffix (0 , n -> tag ? get_tagged_oid (n -> tag ) : & cmit -> object . oid , dst );
336334 if (suffix )
337335 strbuf_addstr (dst , suffix );
338336 return ;
@@ -489,7 +487,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
489487}
490488
491489struct process_commit_data {
492- struct object_id current_commit ;
490+ struct commit * current_commit ;
493491 const struct object_id * looking_for ;
494492 struct strbuf * dst ;
495493 struct rev_info * revs ;
@@ -498,7 +496,7 @@ struct process_commit_data {
498496static void process_commit (struct commit * commit , void * data )
499497{
500498 struct process_commit_data * pcd = data ;
501- pcd -> current_commit = commit -> object . oid ;
499+ pcd -> current_commit = commit ;
502500}
503501
504502static void process_object (struct object * obj , const char * path , void * data )
@@ -507,8 +505,8 @@ static void process_object(struct object *obj, const char *path, void *data)
507505
508506 if (oideq (pcd -> looking_for , & obj -> oid ) && !pcd -> dst -> len ) {
509507 reset_revision_walk ();
510- if (! is_null_oid ( & pcd -> current_commit ) ) {
511- describe_commit (& pcd -> current_commit , pcd -> dst );
508+ if (pcd -> current_commit ) {
509+ describe_commit (pcd -> current_commit , pcd -> dst );
512510 strbuf_addf (pcd -> dst , ":%s" , path );
513511 }
514512 free_commit_list (pcd -> revs -> commits );
@@ -521,7 +519,7 @@ static void describe_blob(const struct object_id *oid, struct strbuf *dst)
521519 struct rev_info revs ;
522520 struct strvec args = STRVEC_INIT ;
523521 struct object_id head_oid ;
524- struct process_commit_data pcd = { * null_oid ( the_hash_algo ) , oid , dst , & revs };
522+ struct process_commit_data pcd = { NULL , oid , dst , & revs };
525523
526524 if (repo_get_oid (the_repository , "HEAD" , & head_oid ))
527525 die (_ ("cannot search for blob '%s' on an unborn branch" ),
@@ -562,7 +560,7 @@ static void describe(const char *arg, int last_one)
562560 cmit = lookup_commit_reference_gently (the_repository , & oid , 1 );
563561
564562 if (cmit )
565- describe_commit (& oid , & sb );
563+ describe_commit (cmit , & sb );
566564 else if (odb_read_object_info (the_repository -> objects ,
567565 & oid , NULL ) == OBJ_BLOB )
568566 describe_blob (& oid , & sb );
0 commit comments