On Sun, Jun 08, 2014 at 08:04:39AM -0400, Jeff King wrote:

> diff --git a/builtin/blame.c b/builtin/blame.c
> index a52a279..1945ea4 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -2313,7 +2313,7 @@ static struct commit *fake_working_tree_commit(struct 
> diff_options *opt,
>                   ident, ident, path,
>                   (!contents_from ? path :
>                    (!strcmp(contents_from, "-") ? "standard input" : 
> contents_from)));
> -     commit->buffer = strbuf_detach(&msg, NULL);
> +     set_commit_buffer(commit, strbuf_detach(&msg, NULL), msg.len);

Side note: this is wrong, as the fake commit created by blame here does
not have its "index" field set. This is a bug waiting to happen the
first time somebody uses a slab in builtin/blame.c. It looks like
merge-recursive does the same thing in make_virtual_commit.

We probably want to provide a function to allocate a commit, including
the index, and use it consistently.

I'll try to work up a series doing that, and the fuller slab API I
mentioned in the previous message, but probably not until tomorrow.

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to