@@ -1523,23 +1523,23 @@ static void unlock_ref(struct ref_lock *lock)
15231523 * avoided, namely if we were successfully able to read the ref
15241524 * - Generate informative error messages in the case of failure
15251525 */
1526- static int lock_raw_ref (const char * refname , int mustexist ,
1526+ static int lock_raw_ref (struct files_ref_store * refs ,
1527+ const char * refname , int mustexist ,
15271528 const struct string_list * extras ,
15281529 const struct string_list * skip ,
15291530 struct ref_lock * * lock_p ,
15301531 struct strbuf * referent ,
15311532 unsigned int * type ,
15321533 struct strbuf * err )
15331534{
1534- struct ref_store * ref_store = get_ref_store (NULL );
1535- struct files_ref_store * refs =
1536- files_downcast (ref_store , 0 , "lock_raw_ref" );
15371535 struct ref_lock * lock ;
15381536 struct strbuf ref_file = STRBUF_INIT ;
15391537 int attempts_remaining = 3 ;
15401538 int ret = TRANSACTION_GENERIC_ERROR ;
15411539
15421540 assert (err );
1541+ assert_main_repository (& refs -> base , "lock_raw_ref" );
1542+
15431543 * type = 0 ;
15441544
15451545 /* First lock the file so it can't change out from under us. */
@@ -1623,7 +1623,7 @@ static int lock_raw_ref(const char *refname, int mustexist,
16231623 * fear that its value will change.
16241624 */
16251625
1626- if (files_read_raw_ref (ref_store , refname ,
1626+ if (files_read_raw_ref (& refs -> base , refname ,
16271627 lock -> old_oid .hash , referent , type )) {
16281628 if (errno == ENOENT ) {
16291629 if (mustexist ) {
@@ -3486,6 +3486,8 @@ static int lock_ref_for_update(struct ref_update *update,
34863486 struct string_list * affected_refnames ,
34873487 struct strbuf * err )
34883488{
3489+ struct files_ref_store * refs =
3490+ get_files_ref_store (NULL , "lock_ref_for_update" );
34893491 struct strbuf referent = STRBUF_INIT ;
34903492 int mustexist = (update -> flags & REF_HAVE_OLD ) &&
34913493 !is_null_sha1 (update -> old_sha1 );
@@ -3502,7 +3504,7 @@ static int lock_ref_for_update(struct ref_update *update,
35023504 return ret ;
35033505 }
35043506
3505- ret = lock_raw_ref (update -> refname , mustexist ,
3507+ ret = lock_raw_ref (refs , update -> refname , mustexist ,
35063508 affected_refnames , NULL ,
35073509 & update -> lock , & referent ,
35083510 & update -> type , err );
0 commit comments