Skip to content

Fix error message in git-show-ref(1) --exists

Toon Claes git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1builtin/show-ref: treat directory directory as non-existing in --existsbuiltin/show-ref.c t/t1403-show-ref.sh+3 -36 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/1] Fix error message in git-show-ref(1) --exists

References can validly contain forward slashes in their name. With the ref files backend, these are stored as a directory tree. This means when you look up a reference, you might find a directory where you expected a file.

This causes the option --exists, recently added to git-show-ref(1), to return the following error:

error: failed to look up reference: Is a directory

Other backends, like reftables, might store refs with forward slashes differently. So they will not encounter the same error.

To make the error consistent across refs backend implementations, and to be more clear to user, hide the error about having found a directory as a generic error:

error: reference does not exist

Toon Claes (1):
builtin/show-ref: treat directory directory as non-existing in
--exists

 builtin/show-ref.c  | 2 +-
 t/t1403-show-ref.sh | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

base-commit: a54a84b333adbecf7bc4483c0e36ed5878cac17b --
2.42.1