]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin/show-ref: fix dead code when passing patterns
authorPatrick Steinhardt <ps@pks.im>
Tue, 31 Oct 2023 08:16:25 +0000 (09:16 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 1 Nov 2023 03:09:00 +0000 (12:09 +0900)
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 <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/show-ref.c

index e55c38af478bb7e0706809275b15dedf2b6d2e37..f95418d3d16a81daa3e032a3f2747dd038e2e533 100644 (file)
@@ -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;
 }