Skip to content

Commit f18a789

Browse files
mhaggergitster
authored andcommitted
commit_ref_update(): add a files_ref_store argument
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent f7b0a98 commit f18a789

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

refs/files-backend.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,12 +2574,14 @@ static int files_verify_refname_available(struct ref_store *ref_store,
25742574

25752575
static int write_ref_to_lockfile(struct ref_lock *lock,
25762576
const unsigned char *sha1, struct strbuf *err);
2577-
static int commit_ref_update(struct ref_lock *lock,
2577+
static int commit_ref_update(struct files_ref_store *refs,
2578+
struct ref_lock *lock,
25782579
const unsigned char *sha1, const char *logmsg,
25792580
struct strbuf *err);
25802581

25812582
int rename_ref(const char *oldrefname, const char *newrefname, const char *logmsg)
25822583
{
2584+
struct files_ref_store *refs = get_files_ref_store(NULL, "rename_ref");
25832585
unsigned char sha1[20], orig_sha1[20];
25842586
int flag = 0, logmoved = 0;
25852587
struct ref_lock *lock;
@@ -2652,7 +2654,7 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms
26522654
hashcpy(lock->old_oid.hash, orig_sha1);
26532655

26542656
if (write_ref_to_lockfile(lock, orig_sha1, &err) ||
2655-
commit_ref_update(lock, orig_sha1, logmsg, &err)) {
2657+
commit_ref_update(refs, lock, orig_sha1, logmsg, &err)) {
26562658
error("unable to write current sha1 into %s: %s", newrefname, err.buf);
26572659
strbuf_release(&err);
26582660
goto rollback;
@@ -2672,7 +2674,7 @@ int rename_ref(const char *oldrefname, const char *newrefname, const char *logms
26722674
flag = log_all_ref_updates;
26732675
log_all_ref_updates = 0;
26742676
if (write_ref_to_lockfile(lock, orig_sha1, &err) ||
2675-
commit_ref_update(lock, orig_sha1, NULL, &err)) {
2677+
commit_ref_update(refs, lock, orig_sha1, NULL, &err)) {
26762678
error("unable to write current sha1 into %s: %s", oldrefname, err.buf);
26772679
strbuf_release(&err);
26782680
}
@@ -2908,12 +2910,12 @@ static int write_ref_to_lockfile(struct ref_lock *lock,
29082910
* to the loose reference lockfile. Also update the reflogs if
29092911
* necessary, using the specified lockmsg (which can be NULL).
29102912
*/
2911-
static int commit_ref_update(struct ref_lock *lock,
2913+
static int commit_ref_update(struct files_ref_store *refs,
2914+
struct ref_lock *lock,
29122915
const unsigned char *sha1, const char *logmsg,
29132916
struct strbuf *err)
29142917
{
2915-
struct files_ref_store *refs =
2916-
get_files_ref_store(NULL, "commit_ref_update");
2918+
assert_main_repository(&refs->base, "commit_ref_update");
29172919

29182920
clear_loose_ref_cache(refs);
29192921
if (log_ref_write(lock->ref_name, lock->old_oid.hash, sha1, logmsg, 0, err)) {

0 commit comments

Comments
 (0)