From: Junio C Hamano Date: Tue, 16 Jun 2026 14:52:59 GMT Subject: Re: [PATCH 3/4] builtin/refs: add "update" subcommand Message-ID: In-Reply-To: <20260616-pks-refs-writing-subcommands-v1-3-9f5219b6109d@pks.im> Patrick Steinhardt writes: > git refs delete [--message=] [--no-deref] [] > +git refs update [--message=] [--no-deref] [--create-reflog] [] " vs " is good, we should update "delete" to use "" to match. > DESCRIPTION > ----------- > @@ -58,6 +59,12 @@ delete:: > reference is only deleted after verifying that it currently contains > ``. > > +update:: > + Update the given reference to point at ``. This subcommand > + mirrors `git update-ref` (see linkgit:git-update-ref[1]). When > + `` is given, the reference is only updated after verifying > + that it currently contains ``. As to the lack of "create", among the two potential changes, I have a slight preference for adding "create" and failing "update" that does not refer to an existing ref. If we go that route, the "--create-reflog" option should move to "create", as "update" will never be used to create a new ref. > + if (repo_get_oid_with_flags(repo, argv[1], &newoid, > + GET_OID_SKIP_AMBIGUITY_CHECK)) > + die(_("invalid new object ID: %s"), argv[1]); > + if (argc == 3 && > + repo_get_oid_with_flags(repo, argv[2], &oldoid, > + GET_OID_SKIP_AMBIGUITY_CHECK)) > + die(_("invalid old object ID: %s"), argv[2]); On the "delete" side, these messages quote the object name, i.e., die(_("invalid old object ID: '%s'"), argv[1]); We should be consistent.