git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: git@vger.kernel.org
Subject: [PATCH] git-show-ref --verify: Fail if called without a reference
Date: Fri, 23 Feb 2007 20:12:33 +0300	[thread overview]
Message-ID: <20070223171232.GA3936@nomad.office.altlinux.org> (raw)

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(-)

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

                 reply	other threads:[~2007-02-23 17:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070223171232.GA3936@nomad.office.altlinux.org \
    --to=ldv@altlinux.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).