1
- #define USE_THE_REPOSITORY_VARIABLE
2
-
3
1
#include "../git-compat-util.h"
4
2
#include "../copy.h"
5
3
#include "../environment.h"
@@ -248,7 +246,7 @@ static void loose_fill_ref_dir_regular_file(struct files_ref_store *refs,
248
246
249
247
if (!refs_resolve_ref_unsafe (& refs -> base , refname , RESOLVE_REF_READING ,
250
248
& oid , & flag )) {
251
- oidclr (& oid , the_repository -> hash_algo );
249
+ oidclr (& oid , refs -> base . repo -> hash_algo );
252
250
flag |= REF_ISBROKEN ;
253
251
} else if (is_null_oid (& oid )) {
254
252
/*
@@ -265,7 +263,7 @@ static void loose_fill_ref_dir_regular_file(struct files_ref_store *refs,
265
263
if (check_refname_format (refname , REFNAME_ALLOW_ONELEVEL )) {
266
264
if (!refname_is_safe (refname ))
267
265
die ("loose refname is dangerous: %s" , refname );
268
- oidclr (& oid , the_repository -> hash_algo );
266
+ oidclr (& oid , refs -> base . repo -> hash_algo );
269
267
flag |= REF_BAD_NAME | REF_ISBROKEN ;
270
268
}
271
269
add_entry_to_dir (dir , create_ref_entry (refname , & oid , flag ));
@@ -552,7 +550,8 @@ static int read_ref_internal(struct ref_store *ref_store, const char *refname,
552
550
strbuf_rtrim (& sb_contents );
553
551
buf = sb_contents .buf ;
554
552
555
- ret = parse_loose_ref_contents (buf , oid , referent , type , & myerr );
553
+ ret = parse_loose_ref_contents (ref_store -> repo -> hash_algo , buf ,
554
+ oid , referent , type , & myerr );
556
555
557
556
out :
558
557
if (ret && !myerr )
@@ -586,7 +585,8 @@ static int files_read_symbolic_ref(struct ref_store *ref_store, const char *refn
586
585
return !(type & REF_ISSYMREF );
587
586
}
588
587
589
- int parse_loose_ref_contents (const char * buf , struct object_id * oid ,
588
+ int parse_loose_ref_contents (const struct git_hash_algo * algop ,
589
+ const char * buf , struct object_id * oid ,
590
590
struct strbuf * referent , unsigned int * type ,
591
591
int * failure_errno )
592
592
{
@@ -604,7 +604,7 @@ int parse_loose_ref_contents(const char *buf, struct object_id *oid,
604
604
/*
605
605
* FETCH_HEAD has additional data after the sha.
606
606
*/
607
- if (parse_oid_hex (buf , oid , & p ) ||
607
+ if (parse_oid_hex_algop (buf , oid , & p , algop ) ||
608
608
(* p != '\0' && !isspace (* p ))) {
609
609
* type |= REF_ISBROKEN ;
610
610
* failure_errno = EINVAL ;
@@ -1152,7 +1152,7 @@ static struct ref_lock *lock_ref_oid_basic(struct files_ref_store *refs,
1152
1152
1153
1153
if (!refs_resolve_ref_unsafe (& refs -> base , lock -> ref_name , 0 ,
1154
1154
& lock -> old_oid , NULL ))
1155
- oidclr (& lock -> old_oid , the_repository -> hash_algo );
1155
+ oidclr (& lock -> old_oid , refs -> base . repo -> hash_algo );
1156
1156
goto out ;
1157
1157
1158
1158
error_return :
@@ -1998,7 +1998,8 @@ static int files_delete_reflog(struct ref_store *ref_store,
1998
1998
return ret ;
1999
1999
}
2000
2000
2001
- static int show_one_reflog_ent (struct strbuf * sb , each_reflog_ent_fn fn , void * cb_data )
2001
+ static int show_one_reflog_ent (struct files_ref_store * refs , struct strbuf * sb ,
2002
+ each_reflog_ent_fn fn , void * cb_data )
2002
2003
{
2003
2004
struct object_id ooid , noid ;
2004
2005
char * email_end , * message ;
@@ -2008,8 +2009,8 @@ static int show_one_reflog_ent(struct strbuf *sb, each_reflog_ent_fn fn, void *c
2008
2009
2009
2010
/* old SP new SP name <email> SP time TAB msg LF */
2010
2011
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 ++ != ' ' ||
2012
+ parse_oid_hex_algop (p , & ooid , & p , refs -> base . repo -> hash_algo ) || * p ++ != ' ' ||
2013
+ parse_oid_hex_algop (p , & noid , & p , refs -> base . repo -> hash_algo ) || * p ++ != ' ' ||
2013
2014
!(email_end = strchr (p , '>' )) ||
2014
2015
email_end [1 ] != ' ' ||
2015
2016
!(timestamp = parse_timestamp (email_end + 2 , & message , 10 )) ||
@@ -2108,7 +2109,7 @@ static int files_for_each_reflog_ent_reverse(struct ref_store *ref_store,
2108
2109
strbuf_splice (& sb , 0 , 0 , bp + 1 , endp - (bp + 1 ));
2109
2110
scanp = bp ;
2110
2111
endp = bp + 1 ;
2111
- ret = show_one_reflog_ent (& sb , fn , cb_data );
2112
+ ret = show_one_reflog_ent (refs , & sb , fn , cb_data );
2112
2113
strbuf_reset (& sb );
2113
2114
if (ret )
2114
2115
break ;
@@ -2120,7 +2121,7 @@ static int files_for_each_reflog_ent_reverse(struct ref_store *ref_store,
2120
2121
* Process it, and we can end the loop.
2121
2122
*/
2122
2123
strbuf_splice (& sb , 0 , 0 , buf , endp - buf );
2123
- ret = show_one_reflog_ent (& sb , fn , cb_data );
2124
+ ret = show_one_reflog_ent (refs , & sb , fn , cb_data );
2124
2125
strbuf_reset (& sb );
2125
2126
break ;
2126
2127
}
@@ -2170,7 +2171,7 @@ static int files_for_each_reflog_ent(struct ref_store *ref_store,
2170
2171
return -1 ;
2171
2172
2172
2173
while (!ret && !strbuf_getwholeline (& sb , logfp , '\n' ))
2173
- ret = show_one_reflog_ent (& sb , fn , cb_data );
2174
+ ret = show_one_reflog_ent (refs , & sb , fn , cb_data );
2174
2175
fclose (logfp );
2175
2176
strbuf_release (& sb );
2176
2177
return ret ;
0 commit comments