@@ -313,26 +313,24 @@ static void append_suffix(int depth, const struct object_id *oid, struct strbuf
313
313
repo_find_unique_abbrev (the_repository , oid , abbrev ));
314
314
}
315
315
316
- static void describe_commit (struct object_id * oid , struct strbuf * dst )
316
+ static void describe_commit (struct commit * cmit , struct strbuf * dst )
317
317
{
318
- struct commit * cmit , * gave_up_on = NULL ;
318
+ struct commit * gave_up_on = NULL ;
319
319
struct commit_list * list ;
320
320
struct commit_name * n ;
321
321
struct possible_tag all_matches [MAX_TAGS ];
322
322
unsigned int match_cnt = 0 , annotated_cnt = 0 , cur_match ;
323
323
unsigned long seen_commits = 0 ;
324
324
unsigned int unannotated_cnt = 0 ;
325
325
326
- cmit = lookup_commit_reference (the_repository , oid );
327
-
328
326
n = find_commit_name (& cmit -> object .oid );
329
327
if (n && (tags || all || n -> prio == 2 )) {
330
328
/*
331
329
* Exact match to an existing ref.
332
330
*/
333
331
append_name (n , dst );
334
332
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 );
336
334
if (suffix )
337
335
strbuf_addstr (dst , suffix );
338
336
return ;
@@ -489,7 +487,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
489
487
}
490
488
491
489
struct process_commit_data {
492
- struct object_id current_commit ;
490
+ struct commit * current_commit ;
493
491
const struct object_id * looking_for ;
494
492
struct strbuf * dst ;
495
493
struct rev_info * revs ;
@@ -498,7 +496,7 @@ struct process_commit_data {
498
496
static void process_commit (struct commit * commit , void * data )
499
497
{
500
498
struct process_commit_data * pcd = data ;
501
- pcd -> current_commit = commit -> object . oid ;
499
+ pcd -> current_commit = commit ;
502
500
}
503
501
504
502
static 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)
507
505
508
506
if (oideq (pcd -> looking_for , & obj -> oid ) && !pcd -> dst -> len ) {
509
507
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 );
512
510
strbuf_addf (pcd -> dst , ":%s" , path );
513
511
}
514
512
free_commit_list (pcd -> revs -> commits );
@@ -521,7 +519,7 @@ static void describe_blob(const struct object_id *oid, struct strbuf *dst)
521
519
struct rev_info revs ;
522
520
struct strvec args = STRVEC_INIT ;
523
521
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 };
525
523
526
524
if (repo_get_oid (the_repository , "HEAD" , & head_oid ))
527
525
die (_ ("cannot search for blob '%s' on an unborn branch" ),
@@ -562,7 +560,7 @@ static void describe(const char *arg, int last_one)
562
560
cmit = lookup_commit_reference_gently (the_repository , & oid , 1 );
563
561
564
562
if (cmit )
565
- describe_commit (& oid , & sb );
563
+ describe_commit (cmit , & sb );
566
564
else if (odb_read_object_info (the_repository -> objects ,
567
565
& oid , NULL ) == OBJ_BLOB )
568
566
describe_blob (& oid , & sb );
0 commit comments