git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>, git@vger.kernel.org
Cc: Emily Shaffer <emilyshaffer@google.com>,
	Junio C Hamano <gitster@pobox.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Felipe Contreras <felipe.contreras@gmail.com>,
	Taylor Blau <me@ttaylorr.com>,
	Michael Strawbridge <michael.strawbridge@amd.com>
Subject: Re: [PATCH 4/5] sequencer: use the new hook API for the simpler "post-rewrite" call
Date: Fri, 27 Jan 2023 15:08:28 +0000	[thread overview]
Message-ID: <5a905a5e-1c1e-2072-a7cd-e39b85df41c9@dunelm.org.uk> (raw)
In-Reply-To: <a2810f20-c093-ba73-0fed-5d179e3e954b@dunelm.org.uk>

Hi Ævar

On 24/01/2023 14:46, Phillip Wood wrote:
> Hi Ævar
> 
> On 23/01/2023 17:15, Ævar Arnfjörð Bjarmason wrote:
>> From: Emily Shaffer <emilyshaffer@google.com>
>>
>> Change the invocation of the "post-rewrite" hook added in
>> 795160457db (sequencer (rebase -i): run the post-rewrite hook, if
>> needed, 2017-01-02) to use the new hook API.
>>
>> This leaves the more complex "post-rewrite" invocation added in
>> a87a6f3c98e (commit: move post-rewrite code to libgit, 2017-11-17)
>> here in sequencer.c unconverted. That'll be done in a subsequent
>> commit.
> 
> As a reader I'd find it more helpful to explain why the conversion isn't 
> done here rather than leaving be to run "git show" to figure it out. If 
> you re-roll perhaps we could replace the commit citation with something 
> like
> 
> sequencer.c also contains an invocation of the "post-rewrite" hook in 
> run_rewrite_hook() that is not converted as the hook API does not allow 
> us to pass the hook input as a string yet.

Sorry, I forgot to say in my previous reply that I like the code change 
here - it is a nice simplification for callers. builtin/am.c has a 
similar function to the one that is converted here.

Best Wishes

Phillip

> Best Wishes
> 
> Phillip
> 
>> Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>> ---
>>   sequencer.c | 18 ++++--------------
>>   1 file changed, 4 insertions(+), 14 deletions(-)
>>
>> diff --git a/sequencer.c b/sequencer.c
>> index 3e4a1972897..d8d59d05dd4 100644
>> --- a/sequencer.c
>> +++ b/sequencer.c
>> @@ -4834,8 +4834,7 @@ static int pick_commits(struct repository *r,
>>           if (!stat(rebase_path_rewritten_list(), &st) &&
>>                   st.st_size > 0) {
>>               struct child_process child = CHILD_PROCESS_INIT;
>> -            const char *post_rewrite_hook =
>> -                find_hook("post-rewrite");
>> +            struct run_hooks_opt hook_opt = RUN_HOOKS_OPT_INIT;
>>               child.in = open(rebase_path_rewritten_list(), O_RDONLY);
>>               child.git_cmd = 1;
>> @@ -4845,18 +4844,9 @@ static int pick_commits(struct repository *r,
>>               /* we don't care if this copying failed */
>>               run_command(&child);
>> -            if (post_rewrite_hook) {
>> -                struct child_process hook = CHILD_PROCESS_INIT;
>> -
>> -                hook.in = open(rebase_path_rewritten_list(),
>> -                    O_RDONLY);
>> -                hook.stdout_to_stderr = 1;
>> -                hook.trace2_hook_name = "post-rewrite";
>> -                strvec_push(&hook.args, post_rewrite_hook);
>> -                strvec_push(&hook.args, "rebase");
>> -                /* we don't care if this hook failed */
>> -                run_command(&hook);
>> -            }
>> +            hook_opt.path_to_stdin = rebase_path_rewritten_list();
>> +            strvec_push(&hook_opt.args, "rebase");
>> +            run_hooks_opt("post-rewrite", &hook_opt);
>>           }
>>           apply_autostash(rebase_path_autostash());

  reply	other threads:[~2023-01-27 15:08 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 17:15 [PATCH 0/5] hook API: support stdin, convert post-rewrite Ævar Arnfjörð Bjarmason
2023-01-23 17:15 ` [PATCH 1/5] run-command.c: remove dead assignment in while-loop Ævar Arnfjörð Bjarmason
2023-01-23 22:48   ` Junio C Hamano
2023-01-23 17:15 ` [PATCH 2/5] run-command: allow stdin for run_processes_parallel Ævar Arnfjörð Bjarmason
2023-01-23 22:52   ` Junio C Hamano
2023-01-23 17:15 ` [PATCH 3/5] hook API: support passing stdin to hooks, convert am's 'post-rewrite' Ævar Arnfjörð Bjarmason
2023-01-23 23:10   ` Junio C Hamano
2023-01-23 23:13   ` Junio C Hamano
2023-01-23 17:15 ` [PATCH 4/5] sequencer: use the new hook API for the simpler "post-rewrite" call Ævar Arnfjörð Bjarmason
2023-01-24 14:46   ` Phillip Wood
2023-01-27 15:08     ` Phillip Wood [this message]
2023-01-23 17:15 ` [PATCH 5/5] hook: support a --to-stdin=<path> option for testing Ævar Arnfjörð Bjarmason
2023-01-24  0:55   ` Junio C Hamano
2023-01-24  0:59     ` Michael Strawbridge
2023-02-08 19:21 ` [PATCH v2 0/5] hook API: support stdin, convert post-rewrite Ævar Arnfjörð Bjarmason
2023-02-08 19:21   ` [PATCH v2 1/5] run-command.c: remove dead assignment in while-loop Ævar Arnfjörð Bjarmason
2023-02-08 21:03     ` Junio C Hamano
2023-02-08 19:21   ` [PATCH v2 2/5] run-command: allow stdin for run_processes_parallel Ævar Arnfjörð Bjarmason
2023-02-08 21:09     ` Junio C Hamano
2023-02-08 19:21   ` [PATCH v2 3/5] hook API: support passing stdin to hooks, convert am's 'post-rewrite' Ævar Arnfjörð Bjarmason
2023-02-08 21:12     ` Junio C Hamano
2023-02-08 19:21   ` [PATCH v2 4/5] sequencer: use the new hook API for the simpler "post-rewrite" call Ævar Arnfjörð Bjarmason
2023-02-08 21:17     ` Junio C Hamano
2023-02-08 19:21   ` [PATCH v2 5/5] hook: support a --to-stdin=<path> option Ævar Arnfjörð Bjarmason
2023-02-08 21:22     ` Junio C Hamano
2023-02-09  1:56       ` Ævar Arnfjörð Bjarmason
2023-02-08 21:23   ` [PATCH v2 0/5] hook API: support stdin, convert post-rewrite Junio C Hamano

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=5a905a5e-1c1e-2072-a7cd-e39b85df41c9@dunelm.org.uk \
    --to=phillip.wood123@gmail.com \
    --cc=avarab@gmail.com \
    --cc=emilyshaffer@google.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    --cc=michael.strawbridge@amd.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sunshine@sunshineco.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).