]> git.ipfire.org Git - thirdparty/git.git/blobdiff - object.c
t3200: test --set-upstream-to with bogus refs
[thirdparty/git.git] / object.c
index 4af3451bf89471a0ab7a148aad4924a8ac8ae053..20703f52ed24aa227d451bec332ac73cc3d49d3a 100644 (file)
--- a/object.c
+++ b/object.c
@@ -185,6 +185,16 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
        return obj;
 }
 
+struct object *parse_object_or_die(const unsigned char *sha1,
+                                  const char *name)
+{
+       struct object *o = parse_object(sha1);
+       if (o)
+               return o;
+
+       die(_("unable to parse object: %s"), name ? name : sha1_to_hex(sha1));
+}
+
 struct object *parse_object(const unsigned char *sha1)
 {
        unsigned long size;