git-show-ref --verify: Fail if called without a reference
builtin-show-ref.c (cmd_show_ref): Fail if called with --verify option but without a reference. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Dmitry V. Levin committed
Feb 23, 2007 at 20:12 UTC
8ab40a20053aa4a0f8d92d08ece88ff09b771435
1 file changed
+4
-2
builtin-show-ref.c
+4
-2
@@ -221,9 +221,11 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix)
221
}
222
223
if (verify) {
224
- unsigned char sha1[20];
225
-
224
+ if (!pattern)
225
+ die("--verify requires a reference");
226
while (*pattern) {
227
+ unsigned char sha1[20];
228
+
229
if (!strncmp(*pattern, "refs/", 5) &&
230
resolve_ref(*pattern, sha1, 1, NULL)) {
231
if (!quiet)