threads / patch / 6929

patchgit-show-ref --verify: Fail if called without a reference

Subject: [PATCH] git-show-ref --verify: Fail if called without a reference

## tl;dr

One message between Feb 23, 2007 and Feb 23, 2007. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Dmitry V. Levin· Feb 23, 2007, 17:12 UTC · lore

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>
---
 builtin-show-ref.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Show changes to builtin-show-ref.c +4 −2
diff --git a/builtin-show-ref.c b/builtin-show-ref.c
index 853f13f..75211e6 100644
--- a/builtin-show-ref.c
+++ b/builtin-show-ref.c
@@ -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)
-- 
1.5.0.1.GIT

← back to recent threads