git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Dmitry V. Levin <ldv@altlinux.org>
Date
Feb 23, 2007, 17:12 UTC
Message-ID
<20070223171232.GA3936@nomad.office.altlinux.org>

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
Message 1 of 1 in “git-show-ref --verify: Fail if called without a reference”
  1. git-show-ref --verify: Fail if called without a referenceDmitry V. Levin, Feb 23, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.