Re: [PATCH v3 1/4] replace: add --graft option
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Jun 6, 2014, 15:44 UTC
- Message-ID
- <CAP8UFD2u-DReCv2ZXhAzH_UMW5P--+a=AKS-N88xE6zmdWBLqQ@mail.gmail.com>
- In-Reply-To
- <CAP8UFD3k98_6Uh+noJgt4xqEooATVMAEf58FFkuy6rHBnP10zw@mail.gmail.com>
On Fri, Jun 6, 2014 at 5:29 PM, Christian Couder <christian.couder@gmail.com> wrote:
Show 14 quoted lines
>
> Yeah, or I could just rely on the fact that lookup_commit_or_die()
> already parses the commit, with something like this:
>
> if (get_sha1(old_ref, old) < 0)
> die(_("Not a valid object name: '%s'"), old_ref);
>
> /* parse the commit buffer to make sure the commit is not corrupt */
> commit = lookup_commit_or_die(old, old_ref);
>
> /* find existing parents */
> parent_start = buf.buf;
> parent_start += 46; /* "tree " + "hex sha1" + "\n" */
> parent_end = parent_start;This last part should be:
/* find existing parents */
strbuf_addstr(&buf, commit->buffer);
parent_start = buf.buf;
parent_start += 46; /* "tree " + "hex sha1" + "\n" */
parent_end = parent_start;
...I will send an updated patch series soon.