Skip to contentSkip to conversation

refs: drop unused "flags" parameter to lock_ref_oid_basic()

PATCH New Jeff King 1 participant 1 message Aug 6, 2021

lore
Share & tools
lore

Jeff King

author
#0 lore raw

PATCH 1/1 refs: drop unused "flags" parameter to lock_ref_oid_basic()

Commit 1578215dab (refs/files: remove unused REF_DELETING in lock_ref_oid_basic(), 2021-07-20), dropped the last use of this flag parameter.

All of the callers do pass REF_NO_DEREF, but that has been ignored completely since 7a418f3a17 (lock_ref_sha1_basic(): only handle REF_NODEREF mode, 2016-04-22).

So we can simply get rid of the parameter entirely.

---
On top of ab/refs-files-cleanup, which is in 'next'. I notice that hn/refs-errno-cleanup is based on that branch, but I think it is OK for them to diverge. This is pure cleanup on top that does not conflict textually or semantically.

 refs/files-backend.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
refs/files-backend.c +5 -6
index 5d12003471..9a20d2bfc6 100644
@@ -876,8 +876,7 @@ static int create_reflock(const char *path, void *cb)
  * On failure errno is set to something meaningful.
  */
 static struct ref_lock *lock_ref_oid_basic(struct files_ref_store *refs,
-					   const char *refname,
-					   unsigned int flags, int *type,
+					   const char *refname, int *type,
 					   struct strbuf *err)
 {
 	struct strbuf ref_file = STRBUF_INIT;
@@ -1345,7 +1344,7 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,
 
 	logmoved = log;
 
-	lock = lock_ref_oid_basic(refs, newrefname, REF_NO_DEREF, NULL, &err);
+	lock = lock_ref_oid_basic(refs, newrefname, NULL, &err);
 	if (!lock) {
 		if (copy)
 			error("unable to copy '%s' to '%s': %s", oldrefname, newrefname, err.buf);
@@ -1367,7 +1366,7 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,
 	goto out;
 
  rollback:
-	lock = lock_ref_oid_basic(refs, oldrefname, REF_NO_DEREF, NULL, &err);
+	lock = lock_ref_oid_basic(refs, oldrefname, NULL, &err);
 	if (!lock) {
 		error("unable to lock %s for rollback: %s", oldrefname, err.buf);
 		strbuf_release(&err);
@@ -1774,7 +1773,7 @@ static int files_create_symref(struct ref_store *ref_store,
 	struct ref_lock *lock;
 	int ret;
 
-	lock = lock_ref_oid_basic(refs, refname, REF_NO_DEREF, NULL, &err);
+	lock = lock_ref_oid_basic(refs, refname, NULL, &err);
 	if (!lock) {
 		error("%s", err.buf);
 		strbuf_release(&err);
@@ -2992,7 +2991,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
 	 * reference itself, plus we might need to update the
 	 * reference if --updateref was specified:
 	 */
-	lock = lock_ref_oid_basic(refs, refname, REF_NO_DEREF, &type, &err);
+	lock = lock_ref_oid_basic(refs, refname, &type, &err);
 	if (!lock) {
 		error("cannot lock ref '%s': %s", refname, err.buf);
 		strbuf_release(&err);
Signature · 1 line
2.33.0.rc0.523.g07fb5e6bbb