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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 7, 2010, 20:19 UTC
Message-ID
<7v1vi14qiy.fsf@alter.siamese.dyndns.org>
In-Reply-To
<f3271551001071137u6158fa4fm1bf7a51a83354574@mail.gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 13 quoted lines
> 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.
Show 15 quoted lines
> 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.

Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 2 of 3 in “Add quiet option to git-ls-files”
  1. Add quiet option to git-ls-filesRamkumar Ramachandra, Jan 7, 2010
  2. Junio C HamanoJan 7, 2010
  3. Ramkumar RamachandraJan 8, 2010

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.