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

[COGITO] fix git-tag-ls in the presence of all-packed tags

From
Nix <nix@esperi.org.uk>
Date
Feb 24, 2007, 00:07 UTC
Message-ID
<87abz4e7v2.fsf@hades.wkstn.nix>

(I don't know if cogito is dead (no changes for two months), but on the off-chance that it isn't here's a tiny patch.)

Rely on the ref walker to determine if there are any tags. (Just consulting refs/tags fails wrongly if all tags are packed.)

Signed-off-by: Nick Alcock <nix@esperi.org.uk>
diff --git a/cg-tag-ls b/cg-tag-ls
index f4c776c..724f428 100755
--- a/cg-tag-ls
+++ b/cg-tag-ls
@@ -28,10 +28,7 @@ _git_wc_unneeded=1
 
 msg_no_tags="no tags present, please see cg-tag(1)"
 
-[ -d "$_git/refs/tags" ] || die "$msg_no_tags"
-
-[ "$(find "$_git/refs/tags" -follow -type f)" ] \
-       || die "$msg_no_tags"
+[ "x$(git-for-each-ref --count=1 --format=present refs/tags)" = "xpresent" ] || die "$msg_no_tags"
 
 maxlen="$(git-for-each-ref --format="%(refname)" refs/tags | column_width "refs/tags/")"
 
-- 
`In the future, company names will be a 32-character hex string.'
  --- Bruce Schneier on the shortage of company names
Message 1 of 1 in “[COGITO] fix git-tag-ls in the presence of all-packed tags”
  1. NixFeb 24, 2007

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.