* [PATCH 2/3] ls-files --others --directory: give trailing slash
@ 2006-01-07 22:31 Junio C Hamano
2006-01-07 23:35 ` Linus Torvalds
2006-01-09 15:17 ` Darrin Thompson
0 siblings, 2 replies; 3+ messages in thread
From: Junio C Hamano @ 2006-01-07 22:31 UTC (permalink / raw)
To: git, Darrin Thompson
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/3] ls-files --others --directory: give trailing slash
2006-01-07 22:31 [PATCH 2/3] ls-files --others --directory: give trailing slash Junio C Hamano
@ 2006-01-07 23:35 ` Linus Torvalds
2006-01-09 15:17 ` Darrin Thompson
1 sibling, 0 replies; 3+ messages in thread
From: Linus Torvalds @ 2006-01-07 23:35 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Darrin Thompson
On Sat, 7 Jan 2006, Junio C Hamano wrote:
>
> * Likes, dislikes? This suits better for *my* purpose of
> calling this from git-status, but it might be undesirable for
> your Porcelain.
Likes.
However, I'd re-write it as just
memcpy(fullname + baselen + len, "/", 2);
len++;
if (show_other_directories &&
!dir_exists(fullname, baselen + len))
break;
read_directory(fullname, fullname, baselen + len);
because let's face it, every user wants the "+1", so just do it once
up-front instead of adding one in three different places.
Linus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/3] ls-files --others --directory: give trailing slash
2006-01-07 22:31 [PATCH 2/3] ls-files --others --directory: give trailing slash Junio C Hamano
2006-01-07 23:35 ` Linus Torvalds
@ 2006-01-09 15:17 ` Darrin Thompson
1 sibling, 0 replies; 3+ messages in thread
From: Darrin Thompson @ 2006-01-09 15:17 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Sat, 2006-01-07 at 14:31 -0800, Junio C Hamano wrote:
> * Likes, dislikes? This suits better for *my* purpose of
> calling this from git-status, but it might be undesirable for
> your Porcelain.
>
+1 likes.
--
Darrin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-01-09 15:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-07 22:31 [PATCH 2/3] ls-files --others --directory: give trailing slash Junio C Hamano
2006-01-07 23:35 ` Linus Torvalds
2006-01-09 15:17 ` Darrin Thompson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).