X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-show-ref.c;h=9463ff0e69b15fc0e544259e64960bc942a98368;hb=d6d96f835cace1c108100cf88e216a59debcb937;hp=ae0edddac1ad63b849dc341c8dd6519181c1e18e;hpb=e79cbbea9e5a9b08722f35dbca3d04c7f40a1aa1;p=git.git diff --git a/builtin-show-ref.c b/builtin-show-ref.c index ae0edddac..a323633e2 100644 --- a/builtin-show-ref.c +++ b/builtin-show-ref.c @@ -1,3 +1,4 @@ +#include "builtin.h" #include "cache.h" #include "refs.h" #include "object.h" @@ -85,6 +86,9 @@ match: sha1_to_hex(sha1)); if (obj->type == OBJ_TAG) { obj = deref_tag(obj, refname, 0); + if (!obj) + die("git-show-ref: bad tag at ref %s (%s)", refname, + sha1_to_hex(sha1)); hex = find_unique_abbrev(obj->sha1, abbrev); printf("%s %s^{}\n", hex, refname); } @@ -221,9 +225,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 (!prefixcmp(*pattern, "refs/") && resolve_ref(*pattern, sha1, 1, NULL)) { if (!quiet)