From: Patrick Steinhardt Date: Tue, 31 Oct 2023 08:16:25 +0000 (+0100) Subject: builtin/show-ref: fix dead code when passing patterns X-Git-Tag: v2.43.0-rc1~10^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=53921d5f8e63eb98cb306ea0b58f76a07bbaf36b;p=thirdparty%2Fgit.git builtin/show-ref: fix dead code when passing patterns When passing patterns to `git show-ref` we have some code that will cause us to die if `verify && !quiet` is true. But because `verify` indicates a different subcommand of git-show-ref(1) that causes us to execute `cmd_show_ref__verify()` and not `cmd_show_ref__patterns()`, the condition cannot ever be true. Let's remove this dead code. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- diff --git a/builtin/show-ref.c b/builtin/show-ref.c index e55c38af47..f95418d3d1 100644 --- a/builtin/show-ref.c +++ b/builtin/show-ref.c @@ -183,11 +183,8 @@ static int cmd_show_ref__patterns(const char **patterns) } else { for_each_ref(show_ref, &show_ref_data); } - if (!found_match) { - if (verify && !quiet) - die("No match"); + if (!found_match) return 1; - } return 0; }