]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/update-ref.c
update-ref: allow --no-deref with --stdin
authorElijah Newren <newren@gmail.com>
Wed, 5 Sep 2018 17:25:50 +0000 (10:25 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Sep 2018 22:17:17 +0000 (15:17 -0700)
commitd345e9fbe75c8bec6469253f0ee7e34228f41917
tree619ff5285ab156d9d495ae6635ff8c0ab7173318
parente4c34855a26fccd2072d452390a0e3167bcc4da9
update-ref: allow --no-deref with --stdin

If passed both --no-deref and --stdin, update-ref would error out with a
general usage message that did not at all suggest these options were
incompatible.  The manpage for update-ref did suggest through its
synopsis line that --no-deref and --stdin were incompatible, but it sadly
also incorrectly suggested that -d and --no-deref were incompatible.  So
the help around the --no-deref option is buggy in a few ways.

The --stdin option did provide a different mechanism for avoiding
dereferencing symbolic-refs: adding a line reading
  option no-deref
before every other directive in the input.  (Technically, if the user
wants to do the extra work of first determining which refs they want to
update or delete are symbolic, then they only need to put the extra
"option no-deref" lines before the updates of those refs.  But in some
cases, that's more work than just adding the "option no-deref" before
every other directive.)

It's easier to allow the user to just pass --no-deref along with --stdin
in order to tell update-ref that the user doesn't want any symbolic ref
to be dereferenced.  It also makes the update-ref documentation simpler.
Implement that, and update the documentation to match.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-update-ref.txt
builtin/update-ref.c
t/t1400-update-ref.sh