summaryrefslogtreecommitdiff
path: root/builtin-show-ref.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2007-02-23 20:12:33 +0300
committerJunio C Hamano <junkio@cox.net>2007-02-24 00:17:38 -0800
commit8ab40a20053aa4a0f8d92d08ece88ff09b771435 (patch)
tree9bd91e22bd1aef81a0498de47a4f24cecb48cf9d /builtin-show-ref.c
parent75b62b489af7b62a5518c3f199d2a2776205e088 (diff)
downloadgit-8ab40a20053aa4a0f8d92d08ece88ff09b771435.tar.gz
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>
Diffstat (limited to 'builtin-show-ref.c')
-rw-r--r--builtin-show-ref.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin-show-ref.c b/builtin-show-ref.c
index 853f13f6ae..75211e64f9 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)