1
- #define USE_THE_REPOSITORY_VARIABLE
2
-
3
1
#include "../git-compat-util.h"
4
2
#include "../abspath.h"
5
3
#include "../chdir-notify.h"
@@ -201,7 +199,8 @@ static void fill_reftable_log_record(struct reftable_log_record *log, const stru
201
199
log -> value .update .tz_offset = sign * atoi (tz_begin );
202
200
}
203
201
204
- static int read_ref_without_reload (struct reftable_stack * stack ,
202
+ static int read_ref_without_reload (struct reftable_ref_store * refs ,
203
+ struct reftable_stack * stack ,
205
204
const char * refname ,
206
205
struct object_id * oid ,
207
206
struct strbuf * referent ,
@@ -220,7 +219,7 @@ static int read_ref_without_reload(struct reftable_stack *stack,
220
219
* type |= REF_ISSYMREF ;
221
220
} else if (reftable_ref_record_val1 (& ref )) {
222
221
oidread (oid , reftable_ref_record_val1 (& ref ),
223
- the_repository -> hash_algo );
222
+ refs -> base . repo -> hash_algo );
224
223
} else {
225
224
/* We got a tombstone, which should not happen. */
226
225
BUG ("unhandled reference value type %d" , ref .value_type );
@@ -487,16 +486,16 @@ static int reftable_ref_iterator_advance(struct ref_iterator *ref_iterator)
487
486
switch (iter -> ref .value_type ) {
488
487
case REFTABLE_REF_VAL1 :
489
488
oidread (& iter -> oid , iter -> ref .value .val1 ,
490
- the_repository -> hash_algo );
489
+ refs -> base . repo -> hash_algo );
491
490
break ;
492
491
case REFTABLE_REF_VAL2 :
493
492
oidread (& iter -> oid , iter -> ref .value .val2 .value ,
494
- the_repository -> hash_algo );
493
+ refs -> base . repo -> hash_algo );
495
494
break ;
496
495
case REFTABLE_REF_SYMREF :
497
496
if (!refs_resolve_ref_unsafe (& iter -> refs -> base , iter -> ref .refname ,
498
497
RESOLVE_REF_READING , & iter -> oid , & flags ))
499
- oidclr (& iter -> oid , the_repository -> hash_algo );
498
+ oidclr (& iter -> oid , refs -> base . repo -> hash_algo );
500
499
break ;
501
500
default :
502
501
BUG ("unhandled reference value type %d" , iter -> ref .value_type );
@@ -508,7 +507,7 @@ static int reftable_ref_iterator_advance(struct ref_iterator *ref_iterator)
508
507
if (check_refname_format (iter -> ref .refname , REFNAME_ALLOW_ONELEVEL )) {
509
508
if (!refname_is_safe (iter -> ref .refname ))
510
509
die (_ ("refname is dangerous: %s" ), iter -> ref .refname );
511
- oidclr (& iter -> oid , the_repository -> hash_algo );
510
+ oidclr (& iter -> oid , refs -> base . repo -> hash_algo );
512
511
flags |= REF_BAD_NAME | REF_ISBROKEN ;
513
512
}
514
513
@@ -551,7 +550,7 @@ static int reftable_ref_iterator_peel(struct ref_iterator *ref_iterator,
551
550
552
551
if (iter -> ref .value_type == REFTABLE_REF_VAL2 ) {
553
552
oidread (peeled , iter -> ref .value .val2 .target_value ,
554
- the_repository -> hash_algo );
553
+ iter -> refs -> base . repo -> hash_algo );
555
554
return 0 ;
556
555
}
557
556
@@ -659,7 +658,7 @@ static int reftable_be_read_raw_ref(struct ref_store *ref_store,
659
658
if (ret )
660
659
return ret ;
661
660
662
- ret = read_ref_without_reload (stack , refname , oid , referent , type );
661
+ ret = read_ref_without_reload (refs , stack , refname , oid , referent , type );
663
662
if (ret < 0 )
664
663
return ret ;
665
664
if (ret > 0 ) {
@@ -868,8 +867,8 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store,
868
867
goto done ;
869
868
}
870
869
871
- ret = read_ref_without_reload (stack_for (refs , "HEAD" , NULL ), "HEAD" , & head_oid ,
872
- & head_referent , & head_type );
870
+ ret = read_ref_without_reload (refs , stack_for (refs , "HEAD" , NULL ), "HEAD" ,
871
+ & head_oid , & head_referent , & head_type );
873
872
if (ret < 0 )
874
873
goto done ;
875
874
ret = 0 ;
@@ -936,7 +935,7 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store,
936
935
string_list_insert (& affected_refnames , new_update -> refname );
937
936
}
938
937
939
- ret = read_ref_without_reload (stack , rewritten_ref ,
938
+ ret = read_ref_without_reload (refs , stack , rewritten_ref ,
940
939
& current_oid , & referent , & u -> type );
941
940
if (ret < 0 )
942
941
goto done ;
@@ -1500,7 +1499,8 @@ static int write_copy_table(struct reftable_writer *writer, void *cb_data)
1500
1499
memcpy (logs [logs_nr ].value .update .old_hash , old_ref .value .val1 , GIT_MAX_RAWSZ );
1501
1500
logs_nr ++ ;
1502
1501
1503
- ret = read_ref_without_reload (arg -> stack , "HEAD" , & head_oid , & head_referent , & head_type );
1502
+ ret = read_ref_without_reload (arg -> refs , arg -> stack , "HEAD" , & head_oid ,
1503
+ & head_referent , & head_type );
1504
1504
if (ret < 0 )
1505
1505
goto done ;
1506
1506
append_head_reflog = (head_type & REF_ISSYMREF ) && !strcmp (head_referent .buf , arg -> oldname );
@@ -1790,15 +1790,16 @@ static struct ref_iterator *reftable_be_reflog_iterator_begin(struct ref_store *
1790
1790
ref_iterator_select , NULL );
1791
1791
}
1792
1792
1793
- static int yield_log_record (struct reftable_log_record * log ,
1793
+ static int yield_log_record (struct reftable_ref_store * refs ,
1794
+ struct reftable_log_record * log ,
1794
1795
each_reflog_ent_fn fn ,
1795
1796
void * cb_data )
1796
1797
{
1797
1798
struct object_id old_oid , new_oid ;
1798
1799
const char * full_committer ;
1799
1800
1800
- oidread (& old_oid , log -> value .update .old_hash , the_repository -> hash_algo );
1801
- oidread (& new_oid , log -> value .update .new_hash , the_repository -> hash_algo );
1801
+ oidread (& old_oid , log -> value .update .old_hash , refs -> base . repo -> hash_algo );
1802
+ oidread (& new_oid , log -> value .update .new_hash , refs -> base . repo -> hash_algo );
1802
1803
1803
1804
/*
1804
1805
* When both the old object ID and the new object ID are null
@@ -1841,7 +1842,7 @@ static int reftable_be_for_each_reflog_ent_reverse(struct ref_store *ref_store,
1841
1842
break ;
1842
1843
}
1843
1844
1844
- ret = yield_log_record (& log , fn , cb_data );
1845
+ ret = yield_log_record (refs , & log , fn , cb_data );
1845
1846
if (ret )
1846
1847
break ;
1847
1848
}
@@ -1886,7 +1887,7 @@ static int reftable_be_for_each_reflog_ent(struct ref_store *ref_store,
1886
1887
}
1887
1888
1888
1889
for (i = logs_nr ; i -- ;) {
1889
- ret = yield_log_record (& logs [i ], fn , cb_data );
1890
+ ret = yield_log_record (refs , & logs [i ], fn , cb_data );
1890
1891
if (ret )
1891
1892
goto done ;
1892
1893
}
@@ -2200,7 +2201,7 @@ static int reftable_be_reflog_expire(struct ref_store *ref_store,
2200
2201
goto done ;
2201
2202
if (reftable_ref_record_val1 (& ref_record ))
2202
2203
oidread (& oid , reftable_ref_record_val1 (& ref_record ),
2203
- the_repository -> hash_algo );
2204
+ ref_store -> repo -> hash_algo );
2204
2205
prepare_fn (refname , & oid , policy_cb_data );
2205
2206
2206
2207
while (1 ) {
@@ -2216,9 +2217,9 @@ static int reftable_be_reflog_expire(struct ref_store *ref_store,
2216
2217
}
2217
2218
2218
2219
oidread (& old_oid , log .value .update .old_hash ,
2219
- the_repository -> hash_algo );
2220
+ ref_store -> repo -> hash_algo );
2220
2221
oidread (& new_oid , log .value .update .new_hash ,
2221
- the_repository -> hash_algo );
2222
+ ref_store -> repo -> hash_algo );
2222
2223
2223
2224
/*
2224
2225
* Skip over the reflog existence marker. We will add it back
@@ -2250,9 +2251,9 @@ static int reftable_be_reflog_expire(struct ref_store *ref_store,
2250
2251
2251
2252
* dest = logs [i ];
2252
2253
oidread (& old_oid , logs [i ].value .update .old_hash ,
2253
- the_repository -> hash_algo );
2254
+ ref_store -> repo -> hash_algo );
2254
2255
oidread (& new_oid , logs [i ].value .update .new_hash ,
2255
- the_repository -> hash_algo );
2256
+ ref_store -> repo -> hash_algo );
2256
2257
2257
2258
if (should_prune_fn (& old_oid , & new_oid , logs [i ].value .update .email ,
2258
2259
(timestamp_t )logs [i ].value .update .time ,
@@ -2269,7 +2270,7 @@ static int reftable_be_reflog_expire(struct ref_store *ref_store,
2269
2270
2270
2271
if (flags & EXPIRE_REFLOGS_UPDATE_REF && last_hash &&
2271
2272
reftable_ref_record_val1 (& ref_record ))
2272
- oidread (& arg .update_oid , last_hash , the_repository -> hash_algo );
2273
+ oidread (& arg .update_oid , last_hash , ref_store -> repo -> hash_algo );
2273
2274
2274
2275
arg .refs = refs ;
2275
2276
arg .records = rewritten ;
0 commit comments