git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Toon Claes <toon@iotcl.com>
Date
Jan 10, 2024, 14:15 UTC
Message-ID
<20240110141559.387815-1-toon@iotcl.com>

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

Next: Toon Claes
Message 1 of 8 in “Fix error message in git-show-ref(1) --exists”
  1. 0/1 Fix error message in git-show-ref(1) --existsToon Claes, Jan 10, 2024
  2. 1/1 builtin/show-ref: treat directory directory as non-existing in --existsToon Claes, Jan 10, 2024
  3. Eric SunshineJan 10, 2024
  4. Toon ClaesJan 10, 2024
  5. Patrick SteinhardtJan 17, 2024
  6. Junio C HamanoJan 17, 2024
  7. Toon ClaesJan 18, 2024
  8. Junio C HamanoJan 18, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.