@@ -243,8 +243,7 @@ static void fill_reftable_log_record(struct reftable_log_record *log, const stru
243
243
log -> value .update .tz_offset = sign * atoi (tz_begin );
244
244
}
245
245
246
- static int read_ref_without_reload (struct reftable_ref_store * refs ,
247
- struct reftable_stack * stack ,
246
+ static int read_ref_without_reload (struct reftable_stack * stack ,
248
247
const char * refname ,
249
248
struct object_id * oid ,
250
249
struct strbuf * referent ,
@@ -262,8 +261,21 @@ static int read_ref_without_reload(struct reftable_ref_store *refs,
262
261
strbuf_addstr (referent , ref .value .symref );
263
262
* type |= REF_ISSYMREF ;
264
263
} else if (reftable_ref_record_val1 (& ref )) {
264
+ unsigned int hash_id ;
265
+
266
+ switch (reftable_stack_hash_id (stack )) {
267
+ case REFTABLE_HASH_SHA1 :
268
+ hash_id = GIT_HASH_SHA1 ;
269
+ break ;
270
+ case REFTABLE_HASH_SHA256 :
271
+ hash_id = GIT_HASH_SHA256 ;
272
+ break ;
273
+ default :
274
+ BUG ("unhandled hash ID %d" , reftable_stack_hash_id (stack ));
275
+ }
276
+
265
277
oidread (oid , reftable_ref_record_val1 (& ref ),
266
- refs -> base . repo -> hash_algo );
278
+ & hash_algos [ hash_id ] );
267
279
} else {
268
280
/* We got a tombstone, which should not happen. */
269
281
BUG ("unhandled reference value type %d" , ref .value_type );
@@ -855,7 +867,7 @@ static int reftable_be_read_raw_ref(struct ref_store *ref_store,
855
867
if (ret )
856
868
return ret ;
857
869
858
- ret = read_ref_without_reload (refs , be -> stack , refname , oid , referent , type );
870
+ ret = read_ref_without_reload (be -> stack , refname , oid , referent , type );
859
871
if (ret < 0 )
860
872
return ret ;
861
873
if (ret > 0 ) {
@@ -1091,7 +1103,7 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store,
1091
1103
if (ret )
1092
1104
goto done ;
1093
1105
1094
- ret = read_ref_without_reload (refs , be -> stack , "HEAD" ,
1106
+ ret = read_ref_without_reload (be -> stack , "HEAD" ,
1095
1107
& head_oid , & head_referent , & head_type );
1096
1108
if (ret < 0 )
1097
1109
goto done ;
@@ -1167,7 +1179,7 @@ static int reftable_be_transaction_prepare(struct ref_store *ref_store,
1167
1179
string_list_insert (& affected_refnames , new_update -> refname );
1168
1180
}
1169
1181
1170
- ret = read_ref_without_reload (refs , be -> stack , rewritten_ref ,
1182
+ ret = read_ref_without_reload (be -> stack , rewritten_ref ,
1171
1183
& current_oid , & referent , & u -> type );
1172
1184
if (ret < 0 )
1173
1185
goto done ;
@@ -1733,7 +1745,7 @@ static int write_copy_table(struct reftable_writer *writer, void *cb_data)
1733
1745
memcpy (logs [logs_nr ].value .update .old_hash , old_ref .value .val1 , GIT_MAX_RAWSZ );
1734
1746
logs_nr ++ ;
1735
1747
1736
- ret = read_ref_without_reload (arg -> refs , arg -> stack , "HEAD" , & head_oid ,
1748
+ ret = read_ref_without_reload (arg -> stack , "HEAD" , & head_oid ,
1737
1749
& head_referent , & head_type );
1738
1750
if (ret < 0 )
1739
1751
goto done ;
0 commit comments