]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-show-ref.c
git-show-ref --verify: Fail if called without a reference
[thirdparty/git.git] / builtin-show-ref.c
index 853f13f6ae9df60e340a6988a9d74bb246df4df6..75211e64f9a850be95de3b85edaafdf0d9a5886a 100644 (file)
@@ -221,9 +221,11 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix)
        }
 
        if (verify) {
-               unsigned char sha1[20];
-
+               if (!pattern)
+                       die("--verify requires a reference");
                while (*pattern) {
+                       unsigned char sha1[20];
+
                        if (!strncmp(*pattern, "refs/", 5) &&
                            resolve_ref(*pattern, sha1, 1, NULL)) {
                                if (!quiet)