-
Notifications
You must be signed in to change notification settings - Fork 140
sequencer: start running post-commit hook again #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sequencer: start running post-commit hook again #388
Conversation
febc50e
to
acaa086
Compare
/submit |
Submitted as [email protected] WARNING: phillipwood has no public email address set on GitHub |
@@ -1443,28 +1443,6 @@ static int git_commit_config(const char *k, const char *v, void *cb) | |||
return git_status_config(k, v, s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Johannes Schindelin wrote (reply to this):
Hi Phillip,
On Thu, 10 Oct 2019, Phillip Wood via GitGitGadget wrote:
> From: Phillip Wood <[email protected]>
>
> This simplifies the implementation of run_prepare_commit_msg_hook() and
> will be used in the next commit.
>
> Signed-off-by: Phillip Wood <[email protected]>
> ---
> builtin/commit.c | 22 ----------------------
> commit.h | 3 ---
> sequencer.c | 45 ++++++++++++++++++++++++++++++++++-----------
> sequencer.h | 2 ++
> 4 files changed, 36 insertions(+), 36 deletions(-)
Hmm. I would have thought that `commit.c` would be a more logical home
for that function (and that the declaration could remain in `commit.h`)?
The general thrust is good, of course: `commit.h` is supposedly a
`libgit.a` header, but `builtin/commit.o` is _not_ included in
`libgit.a`...
Thanks,
Dscho
>
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 1921401117..d898a57f5d 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -1443,28 +1443,6 @@ static int git_commit_config(const char *k, const=
char *v, void *cb)
> return git_status_config(k, v, s);
> }
>
> -int run_commit_hook(int editor_is_used, const char *index_file, const c=
har *name, ...)
> -{
> - struct argv_array hook_env =3D ARGV_ARRAY_INIT;
> - va_list args;
> - int ret;
> -
> - argv_array_pushf(&hook_env, "GIT_INDEX_FILE=3D%s", index_file);
> -
> - /*
> - * Let the hook know that no editor will be launched.
> - */
> - if (!editor_is_used)
> - argv_array_push(&hook_env, "GIT_EDITOR=3D:");
> -
> - va_start(args, name);
> - ret =3D run_hook_ve(hook_env.argv,name, args);
> - va_end(args);
> - argv_array_clear(&hook_env);
> -
> - return ret;
> -}
> -
> int cmd_commit(int argc, const char **argv, const char *prefix)
> {
> const char *argv_gc_auto[] =3D {"gc", "--auto", NULL};
> diff --git a/commit.h b/commit.h
> index f5295ca7f3..37684a35f0 100644
> --- a/commit.h
> +++ b/commit.h
> @@ -389,7 +389,4 @@ void verify_merge_signature(struct commit *commit, i=
nt verbose);
> int compare_commits_by_commit_date(const void *a_, const void *b_, void=
*unused);
> int compare_commits_by_gen_then_commit_date(const void *a_, const void =
*b_, void *unused);
>
> -LAST_ARG_MUST_BE_NULL
> -int run_commit_hook(int editor_is_used, const char *index_file, const c=
har *name, ...);
> -
> #endif /* COMMIT_H */
> diff --git a/sequencer.c b/sequencer.c
> index 2adcf5a639..3ce578c40b 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -1123,28 +1123,51 @@ void commit_post_rewrite(struct repository *r,
> run_rewrite_hook(&old_head->object.oid, new_head);
> }
>
> +int run_commit_hook(int editor_is_used, const char *index_file,
> + const char *name, ...)
> +{
> + struct argv_array hook_env =3D ARGV_ARRAY_INIT;
> + va_list args;
> + int ret;
> +
> + argv_array_pushf(&hook_env, "GIT_INDEX_FILE=3D%s", index_file);
> +
> + /*
> + * Let the hook know that no editor will be launched.
> + */
> + if (!editor_is_used)
> + argv_array_push(&hook_env, "GIT_EDITOR=3D:");
> +
> + va_start(args, name);
> + ret =3D run_hook_ve(hook_env.argv,name, args);
> + va_end(args);
> + argv_array_clear(&hook_env);
> +
> + return ret;
> +}
> +
> static int run_prepare_commit_msg_hook(struct repository *r,
> struct strbuf *msg,
> const char *commit)
> {
> struct argv_array hook_env =3D ARGV_ARRAY_INIT;
> - int ret;
> - const char *name;
> + int ret =3D 0;
> + const char *name, *arg1 =3D NULL, *arg2 =3D NULL;
>
> name =3D git_path_commit_editmsg();
> if (write_message(msg->buf, msg->len, name, 0))
> return -1;
>
> - argv_array_pushf(&hook_env, "GIT_INDEX_FILE=3D%s", r->index_file);
> - argv_array_push(&hook_env, "GIT_EDITOR=3D:");
> - if (commit)
> - ret =3D run_hook_le(hook_env.argv, "prepare-commit-msg", name,
> - "commit", commit, NULL);
> - else
> - ret =3D run_hook_le(hook_env.argv, "prepare-commit-msg", name,
> - "message", NULL);
> - if (ret)
> + if (commit) {
> + arg1 =3D "commit";
> + arg2 =3D commit;
> + } else {
> + arg1 =3D "message";
> + }
> + if (run_commit_hook(0, r->index_file, "prepare-commit-msg", name,
> + arg1, arg2, NULL))
> ret =3D error(_("'prepare-commit-msg' hook failed"));
> +
> argv_array_clear(&hook_env);
>
> return ret;
> diff --git a/sequencer.h b/sequencer.h
> index ac66892d71..b0419d6ddb 100644
> --- a/sequencer.h
> +++ b/sequencer.h
> @@ -201,4 +201,6 @@ int write_basic_state(struct replay_opts *opts, cons=
t char *head_name,
> void sequencer_post_commit_cleanup(struct repository *r);
> int sequencer_get_last_command(struct repository* r,
> enum replay_action *action);
> +LAST_ARG_MUST_BE_NULL
> +int run_commit_hook(int editor_is_used, const char *index_file, const c=
har *name, ...);
> #endif /* SEQUENCER_H */
> --
> gitgitgadget
>
>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Junio C Hamano wrote (reply to this):
Johannes Schindelin <[email protected]> writes:
>> builtin/commit.c | 22 ----------------------
>> commit.h | 3 ---
>> sequencer.c | 45 ++++++++++++++++++++++++++++++++++-----------
>> sequencer.h | 2 ++
>> 4 files changed, 36 insertions(+), 36 deletions(-)
>
> Hmm. I would have thought that `commit.c` would be a more logical home
> for that function (and that the declaration could remain in `commit.h`)?
Good correction.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Phillip Wood wrote (reply to this):
Hi Dscho & Junio
On 11/10/2019 05:24, Junio C Hamano wrote:
> Johannes Schindelin <[email protected]> writes:
>
>>> builtin/commit.c | 22 ----------------------
>>> commit.h | 3 ---
>>> sequencer.c | 45 ++++++++++++++++++++++++++++++++++-----------
>>> sequencer.h | 2 ++
>>> 4 files changed, 36 insertions(+), 36 deletions(-)
>>
>> Hmm. I would have thought that `commit.c` would be a more logical home
>> for that function (and that the declaration could remain in `commit.h`)?
>
> Good correction.
There are some other public commit related functions in sequencer.c -
print_commit_summary(), commit_post_rewrite(), rest_is_empty(),
cleanup_message(), message_is_empty(), template_untouched(),
update_head_with_reflog() . Would you like to see them moved to commit.c
(probably as a separate series)?
Best Wishes
Phillip
>
> Thanks.
>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Johannes Schindelin wrote (reply to this):
Hi Phillip,
On Mon, 14 Oct 2019, Phillip Wood wrote:
> Hi Dscho & Junio
>
> On 11/10/2019 05:24, Junio C Hamano wrote:
> > Johannes Schindelin <[email protected]> writes:
> >
> >>> builtin/commit.c | 22 ----------------------
> >>> commit.h | 3 ---
> >>> sequencer.c | 45 ++++++++++++++++++++++++++++++++++-----------
> >>> sequencer.h | 2 ++
> >>> 4 files changed, 36 insertions(+), 36 deletions(-)
> >>
> >> Hmm. I would have thought that `commit.c` would be a more logical hom=
e
> >> for that function (and that the declaration could remain in `commit.h=
`)?
> >
> > Good correction.
>
> There are some other public commit related functions in sequencer.c -
> print_commit_summary(), commit_post_rewrite(), rest_is_empty(),
> cleanup_message(), message_is_empty(), template_untouched(),
> update_head_with_reflog() . Would you like to see them moved to commit.c
> (probably as a separate series)?
I don't think that it is necessary to move any of those functions out of
their existing habitat just yet. While I haven't looked more closely
which of these functions are specific to the sequencer and which are
more generic, I would argue that moving any of them is outside of the
goals of your patch series.
Thanks,
Dscho
@@ -1443,28 +1443,6 @@ static int git_commit_config(const char *k, const char *v, void *cb) | |||
return git_status_config(k, v, s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Johannes Schindelin wrote (reply to this):
Hi Phillip,
On Thu, 10 Oct 2019, Phillip Wood via GitGitGadget wrote:
> From: Phillip Wood <[email protected]>
>
> Prior to commit 356ee4659b ("sequencer: try to commit without forking
> 'git commit'", 2017-11-24) the sequencer would always run the
> post-commit hook after each pick or revert as it forked `git commit` to
> create the commit. The conversion to committing without forking `git
> commit` omitted to call the post-commit hook after creating the commit.
>
> Signed-off-by: Phillip Wood <[email protected]>
Makes sense.
> ---
> builtin/commit.c | 2 +-
> sequencer.c | 5 +++++
> sequencer.h | 1 +
> t/t3404-rebase-interactive.sh | 17 +++++++++++++++++
> 4 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/commit.c b/builtin/commit.c
> index d898a57f5d..adb8c89c60 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -1653,7 +1653,7 @@ int cmd_commit(int argc, const char **argv, const =
char *prefix)
>
> repo_rerere(the_repository, 0);
> run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
> - run_commit_hook(use_editor, get_index_file(), "post-commit", NULL);
> + run_post_commit_hook(use_editor, get_index_file());
Does it really make sense to abstract the hook name away? It adds a lot
of churn for just two callers...
> if (amend && !no_post_rewrite) {
> commit_post_rewrite(the_repository, current_head, &oid);
> }
> diff --git a/sequencer.c b/sequencer.c
> index 3ce578c40b..b4947f6969 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -1173,6 +1173,10 @@ static int run_prepare_commit_msg_hook(struct rep=
ository *r,
> return ret;
> }
>
> +void run_post_commit_hook(int editor_is_used, const char *index_file) {
> + run_commit_hook(editor_is_used, index_file, "post-commit", NULL);
> +}
> +
If we must have a separate `run_post_commit_hook()`, then it should be
an `inline` function, defined in the header. Or even a macro to begin
with.
> static const char implicit_ident_advice_noconfig[] =3D
> N_("Your name and email address were configured automatically based\n"
> "on your username and hostname. Please check that they are accurate.\n"
> @@ -1427,6 +1431,7 @@ static int try_to_commit(struct repository *r,
> goto out;
> }
>
> + run_post_commit_hook(0, r->index_file);
So this is the _actual_ change of this patch.
> if (flags & AMEND_MSG)
> commit_post_rewrite(r, current_head, oid);
>
> diff --git a/sequencer.h b/sequencer.h
> index b0419d6ddb..e3e73c5635 100644
> --- a/sequencer.h
> +++ b/sequencer.h
> @@ -203,4 +203,5 @@ int sequencer_get_last_command(struct repository* r,
> enum replay_action *action);
> LAST_ARG_MUST_BE_NULL
> int run_commit_hook(int editor_is_used, const char *index_file, const c=
har *name, ...);
> +void run_post_commit_hook(int editor_is_used, const char *index_file);
> #endif /* SEQUENCER_H */
> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.=
sh
> index d2f1d5bd23..d9217235b6 100755
> --- a/t/t3404-rebase-interactive.sh
> +++ b/t/t3404-rebase-interactive.sh
> @@ -1467,4 +1467,21 @@ test_expect_success 'valid author header when aut=
hor contains single quote' '
> test_cmp expected actual
> '
>
> +test_expect_success 'post-commit hook is called' '
> + test_when_finished "rm -f .git/hooks/post-commit commits" &&
> + mkdir -p .git/hooks &&
> + write_script .git/hooks/post-commit <<-\EOS &&
> + git rev-parse HEAD >>commits
Should `commits` be initialized before this script is written, e.g.
using
>commits &&
?
> + EOS
> + set_fake_editor &&
The `set_fake_editor` function sets a global environment variable, and
therefore needs to be run in a subshell. Therefore, this line (as well
as the next one) need to be enclosed in `( ... )`.
> + FAKE_LINES=3D"edit 4 1 reword 2 fixup 3" git rebase -i A E &&
> + echo x>file3 &&
We usually leave no space after the `>`, but we _do_ leave a space
_before_ the `>`.
> + git add file3 &&
> + FAKE_COMMIT_MESSAGE=3Dedited git rebase --continue &&
> + # rev-list does not support -g --reverse
> + git rev-list --no-walk=3Dunsorted HEAD@{5} HEAD@{4} HEAD@{3} HEAD@{2} =
\
> + HEAD@{1} HEAD >expected &&
Wouldn't this be better as:
git rev-parse HEAD@{5} HEAD@{4} HEAD@{3} HEAD@{2} HEAD@{1} HEAD \
>expect &&
> + test_cmp expected commits
We usually use the name `expect` instead of `expected` in the test
suite.
Thanks,
Dscho
> +'
> +
> test_done
> --
> gitgitgadget
>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Junio C Hamano wrote (reply to this):
Johannes Schindelin <[email protected]> writes:
>> diff --git a/builtin/commit.c b/builtin/commit.c
>> index d898a57f5d..adb8c89c60 100644
>> --- a/builtin/commit.c
>> +++ b/builtin/commit.c
>> @@ -1653,7 +1653,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
>>
>> repo_rerere(the_repository, 0);
>> run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
>> - run_commit_hook(use_editor, get_index_file(), "post-commit", NULL);
>> + run_post_commit_hook(use_editor, get_index_file());
>
> Does it really make sense to abstract the hook name away? It adds a lot
> of churn for just two callers...
After looking at the three patches, I do not think so.
>> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
>> index d2f1d5bd23..d9217235b6 100755
>> --- a/t/t3404-rebase-interactive.sh
>> +++ b/t/t3404-rebase-interactive.sh
>> @@ -1467,4 +1467,21 @@ test_expect_success 'valid author header when author contains single quote' '
>> test_cmp expected actual
>> '
>>
>> +test_expect_success 'post-commit hook is called' '
>> + test_when_finished "rm -f .git/hooks/post-commit commits" &&
>> + mkdir -p .git/hooks &&
>> + write_script .git/hooks/post-commit <<-\EOS &&
>> + git rev-parse HEAD >>commits
>
> Should `commits` be initialized before this script is written, e.g.
> using
>
> >commits &&
Yes.
>> + git rev-list --no-walk=unsorted HEAD@{5} HEAD@{4} HEAD@{3} HEAD@{2} \
>> + HEAD@{1} HEAD >expected &&
>
> Wouldn't this be better as:
>
> git rev-parse HEAD@{5} HEAD@{4} HEAD@{3} HEAD@{2} HEAD@{1} HEAD \
> >expect &&
>
Yes.
>> + test_cmp expected commits
>
> We usually use the name `expect` instead of `expected` in the test
> suite.
And the actual output file is called 'actual'.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Phillip Wood wrote (reply to this):
Hi Dscho
On 10/10/2019 22:31, Johannes Schindelin wrote:
> Hi Phillip,
>
> On Thu, 10 Oct 2019, Phillip Wood via GitGitGadget wrote:
>
>> From: Phillip Wood <[email protected]>
>>
>> Prior to commit 356ee4659b ("sequencer: try to commit without forking
>> 'git commit'", 2017-11-24) the sequencer would always run the
>> post-commit hook after each pick or revert as it forked `git commit` to
>> create the commit. The conversion to committing without forking `git
>> commit` omitted to call the post-commit hook after creating the commit.
>>
>> Signed-off-by: Phillip Wood <[email protected]>
>
> Makes sense.
>
>> ---
>> builtin/commit.c | 2 +-
>> sequencer.c | 5 +++++
>> sequencer.h | 1 +
>> t/t3404-rebase-interactive.sh | 17 +++++++++++++++++
>> 4 files changed, 24 insertions(+), 1 deletion(-)
>>
>> diff --git a/builtin/commit.c b/builtin/commit.c
>> index d898a57f5d..adb8c89c60 100644
>> --- a/builtin/commit.c
>> +++ b/builtin/commit.c
>> @@ -1653,7 +1653,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
>>
>> repo_rerere(the_repository, 0);
>> run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
>> - run_commit_hook(use_editor, get_index_file(), "post-commit", NULL);
>> + run_post_commit_hook(use_editor, get_index_file());
>
> Does it really make sense to abstract the hook name away? It adds a lot
> of churn for just two callers...
I'll drop the new function in the reroll
>> if (amend && !no_post_rewrite) {
>> commit_post_rewrite(the_repository, current_head, &oid);
>> }
>> diff --git a/sequencer.c b/sequencer.c
>> index 3ce578c40b..b4947f6969 100644
>> --- a/sequencer.c
>> +++ b/sequencer.c
>> @@ -1173,6 +1173,10 @@ static int run_prepare_commit_msg_hook(struct repository *r,
>> return ret;
>> }
>>
>> +void run_post_commit_hook(int editor_is_used, const char *index_file) {
>> + run_commit_hook(editor_is_used, index_file, "post-commit", NULL);
>> +}
>> +
>
> If we must have a separate `run_post_commit_hook()`, then it should be
> an `inline` function, defined in the header. Or even a macro to begin
> with.
>
>> static const char implicit_ident_advice_noconfig[] =
>> N_("Your name and email address were configured automatically based\n"
>> "on your username and hostname. Please check that they are accurate.\n"
>> @@ -1427,6 +1431,7 @@ static int try_to_commit(struct repository *r,
>> goto out;
>> }
>>
>> + run_post_commit_hook(0, r->index_file);
>
> So this is the _actual_ change of this patch.
>
>> if (flags & AMEND_MSG)
>> commit_post_rewrite(r, current_head, oid);
>>
>> diff --git a/sequencer.h b/sequencer.h
>> index b0419d6ddb..e3e73c5635 100644
>> --- a/sequencer.h
>> +++ b/sequencer.h
>> @@ -203,4 +203,5 @@ int sequencer_get_last_command(struct repository* r,
>> enum replay_action *action);
>> LAST_ARG_MUST_BE_NULL
>> int run_commit_hook(int editor_is_used, const char *index_file, const char *name, ...);
>> +void run_post_commit_hook(int editor_is_used, const char *index_file);
>> #endif /* SEQUENCER_H */
>> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
>> index d2f1d5bd23..d9217235b6 100755
>> --- a/t/t3404-rebase-interactive.sh
>> +++ b/t/t3404-rebase-interactive.sh
>> @@ -1467,4 +1467,21 @@ test_expect_success 'valid author header when author contains single quote' '
>> test_cmp expected actual
>> '
>>
>> +test_expect_success 'post-commit hook is called' '
>> + test_when_finished "rm -f .git/hooks/post-commit commits" &&
>> + mkdir -p .git/hooks &&
>> + write_script .git/hooks/post-commit <<-\EOS &&
>> + git rev-parse HEAD >>commits
>
> Should `commits` be initialized before this script is written, e.g.
> using
>
> >commits &&
Good point, especially if it is renamed to actual as Junio suggests
>> + EOS
>> + set_fake_editor &&
>
> The `set_fake_editor` function sets a global environment variable, and
> therefore needs to be run in a subshell. Therefore, this line (as well
> as the next one) need to be enclosed in `( ... )`.
There are ~80 instances of
set_fake_editor/test_set_editor/set_cat_todo_editor in that file that
are not in subshells. I've converted them in a preparatory patch (that
was fun), removing about 20 that can now safely rely on EDITOR=:
(hopefully that will ameliorate the performance hit of ~60 extra
subshells a little)
>> + FAKE_LINES="edit 4 1 reword 2 fixup 3" git rebase -i A E &&
>> + echo x>file3 &&
>
> We usually leave no space after the `>`, but we _do_ leave a space
> _before_ the `>`.
>
>> + git add file3 &&
>> + FAKE_COMMIT_MESSAGE=edited git rebase --continue &&
>> + # rev-list does not support -g --reverse
>> + git rev-list --no-walk=unsorted HEAD@{5} HEAD@{4} HEAD@{3} HEAD@{2} \
>> + HEAD@{1} HEAD >expected &&
>
> Wouldn't this be better as:
>
> git rev-parse HEAD@{5} HEAD@{4} HEAD@{3} HEAD@{2} HEAD@{1} HEAD \
> >expect &&
Good point
>> + test_cmp expected commits
>
> We usually use the name `expect` instead of `expected` in the test
> suite.
OK
Thanks for looking at this series
Phillip
> Thanks,
> Dscho
>
>> +'
>> +
>> test_done
>> --
>> gitgitgadget
>>
c872bdd
to
1ebf780
Compare
Neither of the commands executed in the subshell change any shell variables or the current directory so there is no need for them to be executed in a subshell. Signed-off-by: Phillip Wood <[email protected]>
1ebf780
to
3199063
Compare
As $EDITOR is exported setting it in one test affects all subsequent tests. Avoid this by always setting it in a subshell. This commit leaves 20 calls to set_fake_editor that are not in subshells as they can safely be removed in the next commit once all the other editor setting is done inside subshells. I have moved the call to set_fake_editor in some tests so it comes immediately before the call to 'git rebase' to avoid moving unrelated commands into the subshell. In one case ('rebase -ix with --autosquash') the call to set_fake_editor is moved past an invocation of 'git rebase'. This is safe as that invocation of 'git rebase' requires EDITOR=: or EDITOR=fake-editor.sh without FAKE_LINES being set which will be the case as the preceding tests either set their editor in a subshell or call set_fake_editor without setting FAKE_LINES. In a one test ('auto-amend only edited commits after "edit"') a call to test_tick are now in a subshell. I think this is OK as it is there to set the date for the next commit which is executed in the same subshell rather than updating GIT_COMMITTER_DATE for later tests (the next test calls test_tick before doing anything else). Signed-off-by: Phillip Wood <[email protected]>
Some tests were calling set_fake_editor to ensure they had a sane no-op editor set. Now that all the editor setting is done in subshells these tests can rely on EDITOR=: and so do not need to call set_fake_editor. Also add a test at the end to detect any future additions messing with the exported value of $EDITOR. Signed-off-by: Phillip Wood <[email protected]>
Commit 6585068 ("rebase -i: rewrite write_basic_state() in C", 2018-08-28) accidentially added new function declarations after the #endif at the end of the include guard. Signed-off-by: Phillip Wood <[email protected]>
3199063
to
dfaca45
Compare
@phillipwood please note that I restarted one PR build job, as I encountered this type of problem in the past (it does not happen too often, and might be caused by some latent background job or something):
In other words, I think this is a transient failure that is not caused by the changes in this PR. |
This function was declared in commit.h but was implemented in builtin/commit.c so was not part of libgit. Move it to libgit so we can use it in the sequencer. This simplifies the implementation of run_prepare_commit_msg_hook() and will be used in the next commit. Signed-off-by: Phillip Wood <[email protected]>
Prior to commit 356ee46 ("sequencer: try to commit without forking 'git commit'", 2017-11-24) the sequencer would always run the post-commit hook after each pick or revert as it forked `git commit` to create the commit. The conversion to committing without forking `git commit` omitted to call the post-commit hook after creating the commit. Signed-off-by: Phillip Wood <[email protected]>
dfaca45
to
67a7117
Compare
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
I edited the build definition to account for that Homebrew issue described in #391, then restarted the build. |
/submit |
Submitted as [email protected] WARNING: phillipwood has no public email address set on GitHub |
This comment has been minimized.
This comment has been minimized.
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
This branch is now known as |
This patch series was integrated into pu via git@0f7a08c. |
This patch series was integrated into pu via git@bc3eb3d. |
This patch series was integrated into pu via git@c57110b. |
This patch series was integrated into next via git@15b41a0. |
This patch series was integrated into pu via git@af496b5. |
This patch series was integrated into pu via git@6fc3f8c. |
This patch series was integrated into pu via git@b7a1f5c. |
This patch series was integrated into pu via git@faefe86. |
This patch series was integrated into pu via git@71b456d. |
This patch series was integrated into pu via git@ac704c0. |
This patch series was integrated into pu via git@99f491c. |
This patch series was integrated into pu via git@ed6e111. |
This patch series was integrated into pu via git@2ad8fc9. |
This patch series was integrated into pu via git@ef5914a. |
This patch series was integrated into pu via git@84cac1f. |
This patch series was integrated into pu via git@b9e7864. |
This patch series was integrated into pu via git@e8bc188. |
This patch series was integrated into pu via git@5c8c0a0. |
This patch series was integrated into master via git@5c8c0a0. |
Closed via 5c8c0a0. |
When I converted the sequencer to avoid forking git commit i forgot about the post-commit hook. These patches are based on pw/rebase-i-show-HEAD-to-reword, otherwise the new test fails as that branch changes the number of commits we make.
Thanks to Dscho & Junio for their comments on V1. I've made the
following changes:
Patches 1-3
These are new patches in response to Dscho's request to set $EDITOR
in a subshell. There were ~80 other tests that weren't doing that
and they are fixed in these patches. Patch 2 contains the main
action, unfortunately due to a combination of having to remove the
trailing ' &&' from the last line moved into the subshell and
re-wrapping some lines due to the increased indentation
--color-moved and --color-moved-ws are of limited use when viewing
this patch.
Patch 4 (was 1)
Unchanged
Patch 5 (was 2)
I've moved the function definition to commit.c rather than
sequencer.c as suggested. I've also removed an unused struct argv_array from
run_prepare_commit_msg_hook() (There wasn't a compiler warning as it
was still calling argv_array_clear() at the end of the function) and
reworded the commit message.
Patch 6 (was 3)
I've tided up the test and removed the wrapper function for running
the post-commit hook as suggested.
Cc: Johannes Schindelin [email protected]