{"thread":{"id":"46619","subject":"[PATCH/RFC] git-grep: correct exit code with --quiet and -L","startedAt":"2017-08-18T01:39:13Z","lastAt":"2017-08-18T02:22:20Z","messageCount":2,"participants":["Anthony Sottile","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"326660","messageId":"20170818013851.16753-1-asottile@umich.edu","threadId":"46619","inReplyTo":null,"subject":"[PATCH/RFC] git-grep: correct exit code with --quiet and -L","fromName":"Anthony Sottile","fromEmail":"asottile@umich.edu","sentAt":"2017-08-18T01:38:51Z","receivedAt":"2017-08-18T01:39:13Z","isPatch":true,"sender":{"key":"asottile@umich.edu","avatar":"https://avatars.githubusercontent.com/u/1810591?v=4"},"body":"The handling of `status_only` no longer interferes with the handling of\n`unmatch_name_only`.  `--quiet` no longer affects the exit code when using\n`-L`/`--files-without-match`.\n\nSigned-off-by: Anthony Sottile <asottile@umich.edu>\n---\n grep.c          | 2 +-\n t/t7810-grep.sh | 5 +++++\n 2 files changed, 6 insertions(+), 1 deletion(-)\n\ndiff --git a/grep.c b/grep.c\nindex 2efec0e..c9e7cc7 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -1821,7 +1821,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle\n \t\treturn 0;\n \n \tif (opt->status_only)\n-\t\treturn 0;\n+\t\treturn opt->unmatch_name_only;\n \tif (opt->unmatch_name_only) {\n \t\t/* We did not see any hit, so we want to show this */\n \t\tshow_name(opt, gs->name);\ndiff --git a/t/t7810-grep.sh b/t/t7810-grep.sh\nindex f106387..2a6679c 100755\n--- a/t/t7810-grep.sh\n+++ b/t/t7810-grep.sh\n@@ -374,6 +374,11 @@ test_expect_success 'grep -L -C' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'grep --files-without-match --quiet' '\n+\tgit grep --files-without-match --quiet nonexistent_string >actual &&\n+\ttest_cmp /dev/null actual\n+'\n+\n cat >expected <<EOF\n file:foo mmap bar_mmap\n EOF\n-- \n2.7.4\n\n"},{"id":"326668","messageId":"xmqq4lt5ehtc.fsf@gitster.mtv.corp.google.com","threadId":"46619","inReplyTo":"20170818013851.16753-1-asottile@umich.edu","subject":"Re: [PATCH/RFC] git-grep: correct exit code with --quiet and -L","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-08-18T02:22:07Z","receivedAt":"2017-08-18T02:22:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Anthony Sottile <asottile@umich.edu> writes:\n\n> The handling of `status_only` no longer interferes with the handling of\n> `unmatch_name_only`.  `--quiet` no longer affects the exit code when using\n> `-L`/`--files-without-match`.\n>\n> Signed-off-by: Anthony Sottile <asottile@umich.edu>\n> ---\n\nThanks, Will queue.\n\n>  grep.c          | 2 +-\n>  t/t7810-grep.sh | 5 +++++\n>  2 files changed, 6 insertions(+), 1 deletion(-)\n>\n> diff --git a/grep.c b/grep.c\n> index 2efec0e..c9e7cc7 100644\n> --- a/grep.c\n> +++ b/grep.c\n> @@ -1821,7 +1821,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle\n>  \t\treturn 0;\n>  \n>  \tif (opt->status_only)\n> -\t\treturn 0;\n> +\t\treturn opt->unmatch_name_only;\n>  \tif (opt->unmatch_name_only) {\n>  \t\t/* We did not see any hit, so we want to show this */\n>  \t\tshow_name(opt, gs->name);\n> diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh\n> index f106387..2a6679c 100755\n> --- a/t/t7810-grep.sh\n> +++ b/t/t7810-grep.sh\n> @@ -374,6 +374,11 @@ test_expect_success 'grep -L -C' '\n>  \ttest_cmp expected actual\n>  '\n>  \n> +test_expect_success 'grep --files-without-match --quiet' '\n> +\tgit grep --files-without-match --quiet nonexistent_string >actual &&\n> +\ttest_cmp /dev/null actual\n> +'\n> +\n>  cat >expected <<EOF\n>  file:foo mmap bar_mmap\n>  EOF\n"}]}