Re: [PATCH v3 1/4] replace: add --graft option

2014-06-30 Thread Christian Couder
On Mon, Jun 30, 2014 at 8:37 AM, Junio C Hamano wrote: > Christian Couder writes: > >> Now, after having read the recent thread about "git verify-commit", I >> understand >> that you also want me to drop the signature of a tag that was merged, because >> such signatures are added to the commit m

Re: [PATCH v3 1/4] replace: add --graft option

2014-06-29 Thread Junio C Hamano
Christian Couder writes: > Now, after having read the recent thread about "git verify-commit", I > understand > that you also want me to drop the signature of a tag that was merged, because > such signatures are added to the commit message. Huh? I am not sure if I follow. Perhaps we are talki

Re: [PATCH v3 1/4] replace: add --graft option

2014-06-28 Thread Christian Couder
On Sun, Jun 8, 2014 at 10:18 AM, Junio C Hamano wrote: > > On Sat, Jun 7, 2014 at 11:49 PM, Christian Couder > wrote: >> >> On Fri, Jun 6, 2014 at 5:44 PM, Christian Couder >> wrote: >> > >> > /* find existing parents */ >> > strbuf_addstr(&buf, commit->buffer); >> >> Unfortunate

Re: [PATCH v3 1/4] replace: add --graft option

2014-06-09 Thread Junio C Hamano
Jeff King writes: > I think it would make sense to actually take this one step further, > though, and move commit->buffer into the slab, as well. That has two > advantages: > > 1. It further decreases the size of "struct commit" for callers who do > not use save_commit_buffer. > > 2. It

Re: [PATCH v3 1/4] replace: add --graft option

2014-06-08 Thread Jeff King
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, >

Re: [PATCH v3 1/4] replace: add --graft option

2014-06-08 Thread Jeff King
On Sun, Jun 08, 2014 at 07:23:33AM -0400, Jeff King wrote: > 4. Keep a static commit_slab that points to the length for each parsed > commit. We pay the same memory cost as (2), but as it's not part of > the struct, the cache effects are minimized. I think I favor this solution, which

Re: [PATCH v3 1/4] replace: add --graft option

2014-06-08 Thread Jeff King
On Sun, Jun 08, 2014 at 08:49:45AM +0200, Christian Couder wrote: > On Fri, Jun 6, 2014 at 5:44 PM, Christian Couder > wrote: > > > > /* find existing parents */ > > strbuf_addstr(&buf, commit->buffer); > > Unfortunately, it looks like the above will not work if the commit->buffe

Re: [PATCH v3 1/4] replace: add --graft option

2014-06-07 Thread Christian Couder
On Fri, Jun 6, 2014 at 5:44 PM, Christian Couder wrote: > > /* find existing parents */ > strbuf_addstr(&buf, commit->buffer); Unfortunately, it looks like the above will not work if the commit->buffer contains an embedded NUL. I wonder if it is a real problem or not. -- To unsubs

Re: [PATCH v3 1/4] replace: add --graft option

2014-06-06 Thread Junio C Hamano
Christian Couder writes: > On Thu, Jun 5, 2014 at 11:49 PM, Junio C Hamano wrote: >> Christian Couder writes: >> >>> +static int create_graft(int argc, const char **argv, int force) >>> +{ >>> + unsigned char old[20], new[20]; >>> + const char *old_ref = argv[0]; >>> + struct commit

Re: [PATCH v3 1/4] replace: add --graft option

2014-06-06 Thread Christian Couder
On Fri, Jun 6, 2014 at 5:29 PM, Christian Couder wrote: > > 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); > >

Re: [PATCH v3 1/4] replace: add --graft option

2014-06-06 Thread Christian Couder
On Thu, Jun 5, 2014 at 11:49 PM, Junio C Hamano wrote: > Christian Couder writes: > >> +static int create_graft(int argc, const char **argv, int force) >> +{ >> + unsigned char old[20], new[20]; >> + const char *old_ref = argv[0]; >> + struct commit *commit; >> + struct strbuf buf

Re: [PATCH v3 1/4] replace: add --graft option

2014-06-05 Thread Junio C Hamano
Christian Couder writes: > +static int create_graft(int argc, const char **argv, int force) > +{ > + unsigned char old[20], new[20]; > + const char *old_ref = argv[0]; > + struct commit *commit; > + struct strbuf buf = STRBUF_INIT; > + struct strbuf new_parents = STRBUF_INIT;