summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9945d98)
raw | patch | inline | side by side (parent: 9945d98)
author | Junio C Hamano <junkio@cox.net> | |
Fri, 15 Apr 2005 18:11:01 +0000 (11:11 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Fri, 15 Apr 2005 18:11:01 +0000 (11:11 -0700) |
This adds NUL-terminated output (-z) to show-files. This is necessary
for merge-trees script to deal with filenames with embedded newlines.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
for merge-trees script to deal with filenames with embedded newlines.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
show-files.c | patch | blob | history |
diff --git a/show-files.c b/show-files.c
index 7d3797f27e7d022d4504e6847b0deea22bac8063..c9027cc4167530fab7053b424c38068bf60bb69b 100644 (file)
--- a/show-files.c
+++ b/show-files.c
static int show_cached = 0;
static int show_others = 0;
static int show_ignored = 0;
+static int line_terminator = '\n';
static const char **dir;
static int nr_dir;
}
if (show_others) {
for (i = 0; i < nr_dir; i++)
- printf("%s\n", dir[i]);
+ printf("%s%c", dir[i], line_terminator);
}
if (show_cached) {
for (i = 0; i < active_nr; i++) {
struct cache_entry *ce = active_cache[i];
- printf("%s\n", ce->name);
+ printf("%s%c", ce->name, line_terminator);
}
}
if (show_deleted) {
struct stat st;
if (!stat(ce->name, &st))
continue;
- printf("%s\n", ce->name);
+ printf("%s%c", ce->name, line_terminator);
}
}
if (show_ignored) {
for (i = 1; i < argc; i++) {
char *arg = argv[i];
+ if (!strcmp(arg, "-z")) {
+ line_terminator = 0;
+ continue;
+ }
+
if (!strcmp(arg, "--cached")) {
show_cached = 1;
continue;