summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2013-03-25 14:01:07 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-03-25 14:01:07 -0700
commit870987dec752fe2a6752f7813fe1892b5e1a8d32 (patch)
tree64744e8b48696fb0a27411fdd2966dd8c2928d6e /object.c
parentMerge branch 'jk/fast-export-object-lookup' (diff)
parentpack-refs: add fully-peeled trait (diff)
downloadtgif-870987dec752fe2a6752f7813fe1892b5e1a8d32.tar.xz
Merge branch 'jk/fully-peeled-packed-ref'
Not that we do not actively encourage having annotated tags outside refs/tags/ hierarchy, but they were not advertised correctly to the ls-remote and fetch with recent version of Git. * jk/fully-peeled-packed-ref: pack-refs: add fully-peeled trait pack-refs: write peeled entry for non-tags use parse_object_or_die instead of die("bad object") avoid segfaults on parse_object failure
Diffstat (limited to 'object.c')
-rw-r--r--object.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/object.c b/object.c
index 4af3451bf8..20703f52ed 100644
--- 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;