Thread (167 messages) 167 messages, 7 authors, 2025-04-04

Re: [PATCH v2 03/16] builtin/update-ref: skip ambiguity checks when parsing object IDs

From: Patrick Steinhardt <hidden>
Date: 2025-02-20 08:05:31

On Wed, Feb 19, 2025 at 12:21:44PM -0600, Justin Tobler wrote:
quoted
diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index 4d35bdc4b4b..d603f54b770 100644
--- a/builtin/update-ref.c
+++ b/builtin/update-ref.c
@@ -179,7 +179,8 @@ static int parse_next_oid(const char **next, const char *end,
@@ -783,7 +786,8 @@ int cmd_update_ref(int argc,
 			 * must not already exist:
 			 */
 			oidclr(&oldoid, the_repository->hash_algo);
-		else if (repo_get_oid(the_repository, oldval, &oldoid))
+		else if (repo_get_oid_with_flags(the_repository, oldval, &oldoid,
+						 GET_OID_SKIP_AMBIGUITY_CHECK))
 			die("%s: not a valid old SHA1", oldval);
 	}
In builtin/update-ref.c all uses of repo_get_oid() have been converted
to repo_get_oid_with_flags() with the GET_OID_SKIP_AMBIGUITY_CHECK flag
except for one in parse_cmd_symref_update(). Is there reason to leave
that one untouched?
Ah, no, this was a mere oversight. Good catch, fixed.

Patrick
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help