Re: [PATCH] Add quiet option to git-ls-files

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] Add quiet option to git-ls-files

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:59

Ramkumar Ramachandra [off-list ref] writes:
quoted hunk
diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt
index 625723e..0a1f94e 100644
--- a/Documentation/git-ls-files.txt
+++ b/Documentation/git-ls-files.txt
@@ -82,6 +82,12 @@ OPTIONS
 	Skips files matching pattern.
 	Note that pattern is a shell wildcard pattern.
 
+--q::
+--quiet::
+	Only meaningful in --error-unmatch mode. Do not output an
+	error message if <file> does not appear in the index. Instead
+	exit with non-zero status silently.
The code doesn't seem to match the claim.
quoted hunk
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index c9a03e5..40560da 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -547,10 +548,11 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
 
 	if (ps_matched) {
 		int bad;
+		if (!quiet) {
+			bad = report_path_error(ps_matched, pathspec, prefix_offset);
+			if (bad)
+				fprintf(stderr, "Did you forget to 'git add'?\n");
+		}
 		return bad ? 1 : 0;
 	}
You might have seen that the code returns 1 during your testing, but that
is not because ps_matched[] was inspected, but because you are checking an
uninitialized garbage on stack in "bad" that happened to be non-zero.

Re: [PATCH] Add quiet option to git-ls-files

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:47:59

The code doesn't seem to match the claim.
I'm sorry- That was horribly sloppy of me. I figured that passing
`quiet' to report_path_error would break too many things, so I've
dropped that patch altogether. I've removed the reference to ls-files
--quiet in my second patch ( viz.
0002-Replace-redirect-to-dev-null-in-favor-of-quiet-optio.patch) and
attached version 2.

Thanks and regards,
Ramkumar
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help