@@ -552,7 +552,8 @@ static int read_ref_internal(struct ref_store *ref_store, const char *refname,
552
552
strbuf_rtrim (& sb_contents );
553
553
buf = sb_contents .buf ;
554
554
555
- ret = parse_loose_ref_contents (buf , oid , referent , type , & myerr );
555
+ ret = parse_loose_ref_contents (ref_store -> repo -> hash_algo , buf ,
556
+ oid , referent , type , & myerr );
556
557
557
558
out :
558
559
if (ret && !myerr )
@@ -586,7 +587,8 @@ static int files_read_symbolic_ref(struct ref_store *ref_store, const char *refn
586
587
return !(type & REF_ISSYMREF );
587
588
}
588
589
589
- int parse_loose_ref_contents (const char * buf , struct object_id * oid ,
590
+ int parse_loose_ref_contents (const struct git_hash_algo * algop ,
591
+ const char * buf , struct object_id * oid ,
590
592
struct strbuf * referent , unsigned int * type ,
591
593
int * failure_errno )
592
594
{
@@ -604,7 +606,7 @@ int parse_loose_ref_contents(const char *buf, struct object_id *oid,
604
606
/*
605
607
* FETCH_HEAD has additional data after the sha.
606
608
*/
607
- if (parse_oid_hex (buf , oid , & p ) ||
609
+ if (parse_oid_hex_algop (buf , oid , & p , algop ) ||
608
610
(* p != '\0' && !isspace (* p ))) {
609
611
* type |= REF_ISBROKEN ;
610
612
* failure_errno = EINVAL ;
@@ -1998,7 +2000,8 @@ static int files_delete_reflog(struct ref_store *ref_store,
1998
2000
return ret ;
1999
2001
}
2000
2002
2001
- static int show_one_reflog_ent (struct strbuf * sb , each_reflog_ent_fn fn , void * cb_data )
2003
+ static int show_one_reflog_ent (struct files_ref_store * refs , struct strbuf * sb ,
2004
+ each_reflog_ent_fn fn , void * cb_data )
2002
2005
{
2003
2006
struct object_id ooid , noid ;
2004
2007
char * email_end , * message ;
@@ -2008,8 +2011,8 @@ static int show_one_reflog_ent(struct strbuf *sb, each_reflog_ent_fn fn, void *c
2008
2011
2009
2012
/* old SP new SP name <email> SP time TAB msg LF */
2010
2013
if (!sb -> len || sb -> buf [sb -> len - 1 ] != '\n' ||
2011
- parse_oid_hex (p , & ooid , & p ) || * p ++ != ' ' ||
2012
- parse_oid_hex (p , & noid , & p ) || * p ++ != ' ' ||
2014
+ parse_oid_hex_algop (p , & ooid , & p , refs -> base . repo -> hash_algo ) || * p ++ != ' ' ||
2015
+ parse_oid_hex_algop (p , & noid , & p , refs -> base . repo -> hash_algo ) || * p ++ != ' ' ||
2013
2016
!(email_end = strchr (p , '>' )) ||
2014
2017
email_end [1 ] != ' ' ||
2015
2018
!(timestamp = parse_timestamp (email_end + 2 , & message , 10 )) ||
@@ -2108,7 +2111,7 @@ static int files_for_each_reflog_ent_reverse(struct ref_store *ref_store,
2108
2111
strbuf_splice (& sb , 0 , 0 , bp + 1 , endp - (bp + 1 ));
2109
2112
scanp = bp ;
2110
2113
endp = bp + 1 ;
2111
- ret = show_one_reflog_ent (& sb , fn , cb_data );
2114
+ ret = show_one_reflog_ent (refs , & sb , fn , cb_data );
2112
2115
strbuf_reset (& sb );
2113
2116
if (ret )
2114
2117
break ;
@@ -2120,7 +2123,7 @@ static int files_for_each_reflog_ent_reverse(struct ref_store *ref_store,
2120
2123
* Process it, and we can end the loop.
2121
2124
*/
2122
2125
strbuf_splice (& sb , 0 , 0 , buf , endp - buf );
2123
- ret = show_one_reflog_ent (& sb , fn , cb_data );
2126
+ ret = show_one_reflog_ent (refs , & sb , fn , cb_data );
2124
2127
strbuf_reset (& sb );
2125
2128
break ;
2126
2129
}
@@ -2170,7 +2173,7 @@ static int files_for_each_reflog_ent(struct ref_store *ref_store,
2170
2173
return -1 ;
2171
2174
2172
2175
while (!ret && !strbuf_getwholeline (& sb , logfp , '\n' ))
2173
- ret = show_one_reflog_ent (& sb , fn , cb_data );
2176
+ ret = show_one_reflog_ent (refs , & sb , fn , cb_data );
2174
2177
fclose (logfp );
2175
2178
strbuf_release (& sb );
2176
2179
return ret ;
0 commit comments