From: Jeff King Date: Sun, 08 Jun 2014 12:09:36 GMT Subject: Re: [PATCH v3 1/4] replace: add --graft option Message-ID: <20140608120936.GB21827@sigill.intra.peff.net> In-Reply-To: <20140608120439.GA21827@sigill.intra.peff.net> 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. -Peff