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

[PATCH 2/3] ls-files --others --directory: give trailing slash

From
Junio C Hamano <junkio@cox.net>
Date
Jan 7, 2006, 22:31 UTC
Message-ID
<7vy81racv7.fsf@assigned-by-dhcp.cox.net>

This adds a trailing slash to directory names in the output when "--others --directory" option shows only untracked directories and not their contents, to make them stand out.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * Likes, dislikes?  This suits better for *my* purpose of
   calling this from git-status, but it might be undesirable for
   your Porcelain.
 ls-files.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
02e90a13cce6041263ec90da77f2ba929055b448
diff --git a/ls-files.c b/ls-files.c
index cc5b32e..7e2fdea 100644
--- a/ls-files.c
+++ b/ls-files.c
@@ -294,8 +294,10 @@ static void read_directory(const char *p
 			case DT_DIR:
 				memcpy(fullname + baselen + len, "/", 2);
 				if (show_other_directories &&
-				    !dir_exists(fullname, baselen + len + 1))
+				    !dir_exists(fullname, baselen + len + 1)) {
+					len++;
 					break;
+				}
 				read_directory(fullname, fullname,
 					       baselen + len + 1);
 				continue;
-- 
1.0.7-g0263
Next: Linus Torvalds
Message 1 of 3 in “ls-files --others --directory: give trailing slash”
  1. 2/3 ls-files --others --directory: give trailing slashJunio C Hamano, Jan 7, 2006
  2. Linus TorvaldsJan 7, 2006
  3. Darrin ThompsonJan 9, 2006

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.