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

2014-06-30 Thread Junio C Hamano
Christian Couder christian.cou...@gmail.com 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.

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 gits...@pobox.com wrote: Christian Couder christian.cou...@gmail.com 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

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

2014-06-29 Thread Christian Couder
On Sun, Jun 8, 2014 at 10:18 AM, Junio C Hamano gits...@pobox.com wrote: On Sat, Jun 7, 2014 at 11:49 PM, Christian Couder christian.cou...@gmail.com wrote: On Fri, Jun 6, 2014 at 5:44 PM, Christian Couder christian.cou...@gmail.com wrote: /* find existing parents */

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

2014-06-09 Thread Junio C Hamano
Jeff King p...@peff.net 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.

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

2014-06-08 Thread Christian Couder
On Fri, Jun 6, 2014 at 5:44 PM, Christian Couder christian.cou...@gmail.com 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

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 christian.cou...@gmail.com wrote: /* find existing parents */ strbuf_addstr(buf, commit-buffer); Unfortunately, it looks like the above will not work if

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: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-06 Thread Christian Couder
On Thu, Jun 5, 2014 at 11:49 PM, Junio C Hamano gits...@pobox.com wrote: Christian Couder chrisc...@tuxfamily.org 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 christian.cou...@gmail.com 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'),

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

2014-06-06 Thread Junio C Hamano
Christian Couder christian.cou...@gmail.com writes: On Thu, Jun 5, 2014 at 11:49 PM, Junio C Hamano gits...@pobox.com wrote: Christian Couder chrisc...@tuxfamily.org writes: +static int create_graft(int argc, const char **argv, int force) +{ + unsigned char old[20], new[20]; +

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

2014-06-05 Thread Junio C Hamano
Christian Couder chrisc...@tuxfamily.org 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

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

2014-06-04 Thread Christian Couder
The usage string for this option is: git replace [-f] --graft commit [parent...] First we create a new commit that is the same as commit except that its parents are [parents...] Then we create a replace ref that replace commit with the commit we just created. With this new option, it should be