{"thread":{"id":"56223","subject":"[PATCH] refs: drop unused \"flags\" parameter to lock_ref_oid_basic()","startedAt":"2021-08-06T00:46:55Z","lastAt":"2021-08-06T00:46:55Z","messageCount":1,"participants":["Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"432147","messageId":"YQyGe9qOPRA0nf5v@coredump.intra.peff.net","threadId":"56223","inReplyTo":null,"subject":"[PATCH] refs: drop unused \"flags\" parameter to lock_ref_oid_basic()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-08-06T00:46:51Z","receivedAt":"2021-08-06T00:46:55Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Commit 1578215dab (refs/files: remove unused REF_DELETING in\nlock_ref_oid_basic(), 2021-07-20), dropped the last use of this flag\nparameter.\n\nAll of the callers do pass REF_NO_DEREF, but that has been ignored\ncompletely since 7a418f3a17 (lock_ref_sha1_basic(): only handle\nREF_NODEREF mode, 2016-04-22).\n\nSo we can simply get rid of the parameter entirely.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nOn top of ab/refs-files-cleanup, which is in 'next'. I notice that\nhn/refs-errno-cleanup is based on that branch, but I think it is OK for\nthem to diverge. This is pure cleanup on top that does not conflict\ntextually or semantically.\n\n refs/files-backend.c | 11 +++++------\n 1 file changed, 5 insertions(+), 6 deletions(-)\n\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex 5d12003471..9a20d2bfc6 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -876,8 +876,7 @@ static int create_reflock(const char *path, void *cb)\n  * On failure errno is set to something meaningful.\n  */\n static struct ref_lock *lock_ref_oid_basic(struct files_ref_store *refs,\n-\t\t\t\t\t   const char *refname,\n-\t\t\t\t\t   unsigned int flags, int *type,\n+\t\t\t\t\t   const char *refname, int *type,\n \t\t\t\t\t   struct strbuf *err)\n {\n \tstruct strbuf ref_file = STRBUF_INIT;\n@@ -1345,7 +1344,7 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,\n \n \tlogmoved = log;\n \n-\tlock = lock_ref_oid_basic(refs, newrefname, REF_NO_DEREF, NULL, &err);\n+\tlock = lock_ref_oid_basic(refs, newrefname, NULL, &err);\n \tif (!lock) {\n \t\tif (copy)\n \t\t\terror(\"unable to copy '%s' to '%s': %s\", oldrefname, newrefname, err.buf);\n@@ -1367,7 +1366,7 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,\n \tgoto out;\n \n  rollback:\n-\tlock = lock_ref_oid_basic(refs, oldrefname, REF_NO_DEREF, NULL, &err);\n+\tlock = lock_ref_oid_basic(refs, oldrefname, NULL, &err);\n \tif (!lock) {\n \t\terror(\"unable to lock %s for rollback: %s\", oldrefname, err.buf);\n \t\tstrbuf_release(&err);\n@@ -1774,7 +1773,7 @@ static int files_create_symref(struct ref_store *ref_store,\n \tstruct ref_lock *lock;\n \tint ret;\n \n-\tlock = lock_ref_oid_basic(refs, refname, REF_NO_DEREF, NULL, &err);\n+\tlock = lock_ref_oid_basic(refs, refname, NULL, &err);\n \tif (!lock) {\n \t\terror(\"%s\", err.buf);\n \t\tstrbuf_release(&err);\n@@ -2992,7 +2991,7 @@ static int files_reflog_expire(struct ref_store *ref_store,\n \t * reference itself, plus we might need to update the\n \t * reference if --updateref was specified:\n \t */\n-\tlock = lock_ref_oid_basic(refs, refname, REF_NO_DEREF, &type, &err);\n+\tlock = lock_ref_oid_basic(refs, refname, &type, &err);\n \tif (!lock) {\n \t\terror(\"cannot lock ref '%s': %s\", refname, err.buf);\n \t\tstrbuf_release(&err);\n-- \n2.33.0.rc0.523.g07fb5e6bbb\n"}]}