Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
lock_ref_for_update(): add a files_ref_store argument
author
Michael Haggerty
<mhagger@alum.mit.edu>
Sun, 4 Sep 2016 16:08:33 +0000
(18:08 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 9 Sep 2016 22:28:13 +0000
(15:28 -0700)
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
f18a789
)
diff --git
a/refs/files-backend.c
b/refs/files-backend.c
index 82d9148b8283e6e363664207f7e227e6b75f4447..7e869ba0377ab934b20e756db92cb24b98cd1fc4 100644
(file)
--- a/
refs/files-backend.c
+++ b/
refs/files-backend.c
@@
-3482,20
+3482,21
@@
static const char *original_update_refname(struct ref_update *update)
* - If it is an update of head_ref, add a corresponding REF_LOG_ONLY
* update of HEAD.
*/
* - If it is an update of head_ref, add a corresponding REF_LOG_ONLY
* update of HEAD.
*/
-static int lock_ref_for_update(struct ref_update *update,
+static int lock_ref_for_update(struct files_ref_store *refs,
+ struct ref_update *update,
struct ref_transaction *transaction,
const char *head_ref,
struct string_list *affected_refnames,
struct strbuf *err)
{
struct ref_transaction *transaction,
const char *head_ref,
struct string_list *affected_refnames,
struct strbuf *err)
{
- struct files_ref_store *refs =
- get_files_ref_store(NULL, "lock_ref_for_update");
struct strbuf referent = STRBUF_INIT;
int mustexist = (update->flags & REF_HAVE_OLD) &&
!is_null_sha1(update->old_sha1);
int ret;
struct ref_lock *lock;
struct strbuf referent = STRBUF_INIT;
int mustexist = (update->flags & REF_HAVE_OLD) &&
!is_null_sha1(update->old_sha1);
int ret;
struct ref_lock *lock;
+ assert_main_repository(&refs->base, "lock_ref_for_update");
+
if ((update->flags & REF_HAVE_NEW) && is_null_sha1(update->new_sha1))
update->flags |= REF_DELETING;
if ((update->flags & REF_HAVE_NEW) && is_null_sha1(update->new_sha1))
update->flags |= REF_DELETING;
@@
-3720,8
+3721,8
@@
static int files_transaction_commit(struct ref_store *ref_store,
for (i = 0; i < transaction->nr; i++) {
struct ref_update *update = transaction->updates[i];
for (i = 0; i < transaction->nr; i++) {
struct ref_update *update = transaction->updates[i];
- ret = lock_ref_for_update(
update, transaction, head_ref
,
- &affected_refnames, err);
+ ret = lock_ref_for_update(
refs, update, transaction
,
+
head_ref,
&affected_refnames, err);
if (ret)
goto cleanup;
}
if (ret)
goto cleanup;
}