[PATCH 04/12] builtin/show-ref: fix dead code when passing patterns
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 24, 2023, 13:10 UTC
- Message-ID
- <29c0c0c6c9728f286efd0b78996f9a1394957862.1698152926.git.ps@pks.im>
- In-Reply-To
- <cover.1698152926.git.ps@pks.im>
When passing patterns to `git show-ref` we have some code that will cause us to die of `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 <ps@pks.im> --- builtin/show-ref.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/builtin/show-ref.c b/builtin/show-ref.c index 761669d28de..eb60f940a3c 100644 --- a/builtin/show-ref.c +++ b/builtin/show-ref.c @@ -182,11 +182,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; }
-- 2.42.0