git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Add quiet option to git-ls-files
Date: Thu, 07 Jan 2010 12:19:01 -0800	[thread overview]
Message-ID: <7v1vi14qiy.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <f3271551001071137u6158fa4fm1bf7a51a83354574@mail.gmail.com> (Ramkumar Ramachandra's message of "Fri\, 8 Jan 2010 01\:07\:20 +0530")

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> 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.

> 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.

  reply	other threads:[~2010-01-07 20:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-07 19:37 [PATCH] Add quiet option to git-ls-files Ramkumar Ramachandra
2010-01-07 20:19 ` Junio C Hamano [this message]
2010-01-08  2:17   ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v1vi14qiy.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).