@@ -482,10 +482,9 @@ static void snarf_refs(int head, int remotes)
482
482
}
483
483
}
484
484
485
- static int rev_is_head (const char * head , const char * name ,
486
- unsigned char * head_sha1 , unsigned char * sha1 )
485
+ static int rev_is_head (const char * head , const char * name )
487
486
{
488
- if (!head || ( head_sha1 && sha1 && ! hasheq ( head_sha1 , sha1 )) )
487
+ if (!head )
489
488
return 0 ;
490
489
skip_prefix (head , "refs/heads/" , & head );
491
490
if (!skip_prefix (name , "refs/heads/" , & name ))
@@ -806,9 +805,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
806
805
/* We are only interested in adding the branch
807
806
* HEAD points at.
808
807
*/
809
- if (rev_is_head (head ,
810
- ref_name [i ],
811
- head_oid .hash , NULL ))
808
+ if (rev_is_head (head , ref_name [i ]))
812
809
has_head ++ ;
813
810
}
814
811
if (!has_head ) {
@@ -867,10 +864,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
867
864
if (1 < num_rev || extra < 0 ) {
868
865
for (i = 0 ; i < num_rev ; i ++ ) {
869
866
int j ;
870
- int is_head = rev_is_head (head ,
871
- ref_name [i ],
872
- head_oid .hash ,
873
- rev [i ]-> object .oid .hash );
867
+ int is_head = rev_is_head (head , ref_name [i ]) &&
868
+ oideq (& head_oid , & rev [i ]-> object .oid );
874
869
if (extra < 0 )
875
870
printf ("%c [%s] " ,
876
871
is_head ? '*' : ' ' , ref_name [i ]);
0 commit comments