summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ed9f7c9)
raw | patch | inline | side by side (parent: ed9f7c9)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 18 Dec 2006 02:08:52 +0000 (18:08 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 18 Dec 2006 02:26:53 +0000 (18:26 -0800) |
If you want to verify a ref, it is overkill to first read all loose refs
into a linked list, and then check if the desired ref is there.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
into a linked list, and then check if the desired ref is there.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
builtin-show-ref.c | patch | blob | history |
diff --git a/builtin-show-ref.c b/builtin-show-ref.c
index b36f15eeaa1d8ab4416f4716eda9149ef60ca763..23e0ff8fbfea1ca29e4beb18c95475dd8bdae05b 100644 (file)
--- a/builtin-show-ref.c
+++ b/builtin-show-ref.c
return exclude_existing(arg + 19);
usage(show_ref_usage);
}
+
+ if (verify) {
+ unsigned char sha1[20];
+
+ while (*pattern) {
+ if (resolve_ref(*pattern, sha1, 1, NULL))
+ printf("%s %s\n", sha1_to_hex(sha1),
+ *pattern);
+ else if (!quiet)
+ die("'%s' - not a valid ref", *pattern);
+ else
+ return 1;
+ pattern++;
+ }
+ return 0;
+ }
+
if (show_head)
head_ref(show_ref, NULL);
for_each_ref(show_ref, NULL);