Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2015-02-17 20:00:16 +0300
committerJunio C Hamano <gitster@pobox.com>2015-02-17 22:23:48 +0300
commitfb5a6bb61c215546b94156bbb54d43225424f7d0 (patch)
treee157715e73f2e574d82205e7a8a06b40a205f377 /refs.c
parent1d147bdff0b8132d3aa53a46df8dbab7b673b796 (diff)
ref_transaction_delete(): remove "have_old" parameter
Instead, verify the reference's old value if and only if old_sha1 is non-NULL. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/refs.c b/refs.c
index e88817c623..e3c4ab5fd5 100644
--- a/refs.c
+++ b/refs.c
@@ -2576,7 +2576,7 @@ static void prune_ref(struct ref_to_prune *r)
transaction = ref_transaction_begin(&err);
if (!transaction ||
ref_transaction_delete(transaction, r->name, r->sha1,
- REF_ISPRUNING, 1, NULL, &err) ||
+ REF_ISPRUNING, NULL, &err) ||
ref_transaction_commit(transaction, &err)) {
ref_transaction_free(transaction);
error("%s", err.buf);
@@ -2753,8 +2753,9 @@ int delete_ref(const char *refname, const unsigned char *sha1, unsigned int flag
transaction = ref_transaction_begin(&err);
if (!transaction ||
- ref_transaction_delete(transaction, refname, sha1, flags,
- sha1 && !is_null_sha1(sha1), NULL, &err) ||
+ ref_transaction_delete(transaction, refname,
+ (sha1 && !is_null_sha1(sha1)) ? sha1 : NULL,
+ flags, NULL, &err) ||
ref_transaction_commit(transaction, &err)) {
error("%s", err.buf);
ref_transaction_free(transaction);
@@ -3696,11 +3697,11 @@ int ref_transaction_create(struct ref_transaction *transaction,
int ref_transaction_delete(struct ref_transaction *transaction,
const char *refname,
const unsigned char *old_sha1,
- unsigned int flags, int have_old, const char *msg,
+ unsigned int flags, const char *msg,
struct strbuf *err)
{
return ref_transaction_update(transaction, refname,
- null_sha1, have_old ? old_sha1 : NULL,
+ null_sha1, old_sha1,
flags, msg, err);
}