From: Junio C Hamano <gitster@pobox.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org, Jonathan Nieder <jrnieder@gmail.com>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH v3 5/9] sequencer: run post-rewrite hook
Date: Thu, 06 Jun 2013 11:40:25 -0700 [thread overview]
Message-ID: <7v7gi7yteu.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1370509144-31974-6-git-send-email-felipe.contreras@gmail.com> (Felipe Contreras's message of "Thu, 6 Jun 2013 03:59:00 -0500")
Felipe Contreras <felipe.contreras@gmail.com> writes:
> As we should.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
> sequencer.c | 42 +++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 41 insertions(+), 1 deletion(-)
>
> diff --git a/sequencer.c b/sequencer.c
> index 76ff2ff..74480d7 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -127,6 +127,37 @@ static void add_rewritten(unsigned char *from, unsigned char *to)
> rewritten.nr++;
> }
>
> +static void run_rewrite_hook(const char *name)
> +{
> + struct strbuf buf = STRBUF_INIT;
> + struct child_process proc;
> + const char *argv[3];
> + int code, i;
> +
> + argv[0] = find_hook("post-rewrite");
> + if (!argv[0])
> + return;
> +
> + argv[1] = name;
> + argv[2] = NULL;
> +
> + memset(&proc, 0, sizeof(proc));
> + proc.argv = argv;
> + proc.in = -1;
> + proc.stdout_to_stderr = 1;
> +
> + code = start_command(&proc);
> + if (code)
> + return;
> + for (i = 0; i < rewritten.nr; i++) {
> + struct rewritten_list_item *item = &rewritten.items[i];
> + strbuf_addf(&buf, "%s %s\n", sha1_to_hex(item->from), sha1_to_hex(item->to));
> + }
> + write_in_full(proc.in, buf.buf, buf.len);
> + close(proc.in);
> + finish_command(&proc);
> +}
It probably is worth inserting a commit before 4/9 that adds
rewrite.[ch], and
- introduces "struct rewritten_list[_item]";
- moves run_rewrite_hook() in builtin/commit.c to rewrite.c;
- changes its function signature so that it takes "char
*action_name" and "struct rewritten *" as parameters; and
- adjust its sole call site in cmd_commit() to feed a single-item
rewritten_list to it.
Then 4/9 can teach cherry-pick to prepare the rewritten-list and
probably this commit can be part of that to call run_rewrite_hook().
next prev parent reply other threads:[~2013-06-06 18:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-06 8:58 [PATCH v3 0/9] cherry-pick: improvements Felipe Contreras
2013-06-06 8:58 ` [PATCH v3 1/9] sequencer: remove useless indentation Felipe Contreras
2013-06-06 8:58 ` [PATCH v3 2/9] sequencer: trivial fix Felipe Contreras
2013-06-06 8:58 ` [PATCH v3 3/9] cherry-pick: add --skip-empty option Felipe Contreras
2013-06-06 18:30 ` Junio C Hamano
2013-06-06 18:34 ` Felipe Contreras
2013-06-06 19:21 ` Junio C Hamano
2013-06-06 19:21 ` Junio C Hamano
2013-06-07 20:28 ` Felipe Contreras
2013-06-06 8:58 ` [PATCH v3 4/9] cherry-pick: store rewritten commits Felipe Contreras
2013-06-06 8:59 ` [PATCH v3 5/9] sequencer: run post-rewrite hook Felipe Contreras
2013-06-06 18:40 ` Junio C Hamano [this message]
2013-06-09 15:19 ` Felipe Contreras
2013-06-06 8:59 ` [PATCH v3 6/9] cherry-pick: add support to copy notes Felipe Contreras
2013-06-06 12:17 ` Felipe Contreras
2013-06-06 8:59 ` [PATCH v3 7/9] revert/cherry-pick: add --quiet option Felipe Contreras
2013-06-06 8:59 ` [PATCH v3 8/9] revert/cherry-pick: add --skip option Felipe Contreras
2013-06-06 8:59 ` [PATCH v3 9/9] cherry-pick: don't barf when there's nothing to do Felipe Contreras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v7gi7yteu.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=artagnon@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).