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

[PATCH] cg-status: handle subdirs when listing heads

From
Jonas Fonseca <fonseca@diku.dk>
Date
Dec 11, 2005, 19:49 UTC
Message-ID
<20051211194926.GG2960@diku.dk>
In-Reply-To
<20051211190305.GD2960@diku.dk>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
 And here's one which handles empty directories and is cleaner.
diff --git a/cg-status b/cg-status
index a4c5e7a..bd4d0ce 100755
--- a/cg-status
+++ b/cg-status
@@ -123,9 +123,9 @@ if [ "$gitstatus" ]; then
 	fi
 
 	echo "Heads:"
-	for head in $_git/refs/heads/*; do
+	find "$_git/refs/heads" ! -type d | sort | while read head; do 
 		headsha1=$(cat "$head")
-		headname=$(basename "$head")
+		headname=${head#$_git/refs/heads/}
 		[ "$headname" = "cg-seek-point" ] && continue
 		cf=" "; rf=" "
 		[ "$headname" = "$_git_head" ] && cf=">"
-- 
Jonas Fonseca
Previous: Jonas Fonseca
Message 2 of 2 in “cg-status: handle subdirs when listing heads”
  1. cg-status: handle subdirs when listing headsJonas Fonseca, Dec 11, 2005
  2. cg-status: handle subdirs when listing headsJonas Fonseca, Dec 11, 2005

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.