cat-file: use a single strbuf for all output
[gitweb.git] / blame.c
diff --git a/blame.c b/blame.c
index cf102276bea1101b594737e56912e4badd169a42..58a7036847d9be574bbc3863d7ba4deb548628b7 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -176,7 +176,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt,
        struct strbuf buf = STRBUF_INIT;
        const char *ident;
        time_t now;
-       int size, len;
+       int len;
        struct cache_entry *ce;
        unsigned mode;
        struct strbuf msg = STRBUF_INIT;
@@ -274,8 +274,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt,
                        /* Let's not bother reading from HEAD tree */
                        mode = S_IFREG | 0644;
        }
-       size = cache_entry_size(len);
-       ce = xcalloc(1, size);
+       ce = make_empty_cache_entry(&the_index, len);
        oidcpy(&ce->oid, &origin->blob_oid);
        memcpy(ce->name, path, len);
        ce->ce_flags = create_ce_flags(0);
@@ -1674,7 +1673,7 @@ static struct commit *find_single_final(struct rev_info *revs,
                struct object *obj = revs->pending.objects[i].item;
                if (obj->flags & UNINTERESTING)
                        continue;
-               obj = deref_tag(obj, NULL, 0);
+               obj = deref_tag(the_repository, obj, NULL, 0);
                if (obj->type != OBJ_COMMIT)
                        die("Non commit %s?", revs->pending.objects[i].name);
                if (found)
@@ -1705,7 +1704,7 @@ static struct commit *dwim_reverse_initial(struct rev_info *revs,
 
        /* Is that sole rev a committish? */
        obj = revs->pending.objects[0].item;
-       obj = deref_tag(obj, NULL, 0);
+       obj = deref_tag(the_repository, obj, NULL, 0);
        if (obj->type != OBJ_COMMIT)
                return NULL;
 
@@ -1741,7 +1740,7 @@ static struct commit *find_single_initial(struct rev_info *revs,
                struct object *obj = revs->pending.objects[i].item;
                if (!(obj->flags & UNINTERESTING))
                        continue;
-               obj = deref_tag(obj, NULL, 0);
+               obj = deref_tag(the_repository, obj, NULL, 0);
                if (obj->type != OBJ_COMMIT)
                        die("Non commit %s?", revs->pending.objects[i].name);
                if (found)