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

Re: [PATCH/RFC] git-grep: correct exit code with --quiet and -L

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 15, 2017, 22:24 UTC
Message-ID
<xmqqlgmkpizm.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CA+dzEBnMOoXYaP7QadQ+gzKKJ7OzJKAPwbW=zr=1fksCQNBVcw@mail.gmail.com>
Anthony Sottile <asottile@umich.edu> writes:
Show 9 quoted lines
> Ah yes, I didn't intend to include the first hunk (forgot to amend it
> out when formatting the patch).
>
> I think git's exit codes for -L actually make more sense than the GNU
> exit codes (especially when comparing with `grep` vs `grep -v`) --
> that is, produce `0` when the search is successful (producing
> *something* on stdout) and `1` when the search fails.
>
> Shall I create a new mail with the adjusted patch as suggested above?

I do not mind seeing an updated patch that does not change the exit status (as you seem to like what we have currently that contradicts what GNU grep does) but makes it consistent between "--quiet" and "--no-quiet". But I would not be surprised if people seeing this exchange from the sideline are already working on fixing the exit status and also making sure that the fixed code would produce the same corrected exit status with or without "--quiet", so an updated patch from you will likely conflict with their effort.

So if I were you, I'd wait to see what other people would say about the actual exit codes we give when "git grep -L" is run without the "--quiet" option, and if they are also happy with the current exit code, then send in an updated patch.

Thanks.
Previous: Anthony SottileNext: Anthony Sottile
Message 4 of 5 in “git-grep: correct exit code with --quiet and -L”
  1. git-grep: correct exit code with --quiet and -LAnthony Sottile, Aug 15, 2017
  2. Junio C HamanoAug 15, 2017
  3. Anthony SottileAug 15, 2017
  4. Junio C HamanoAug 15, 2017
  5. Anthony SottileAug 15, 2017

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.