[PATCH v2 5/6] move run_commit_hook() to libgit and use it there

2019-10-15 Thread Phillip Wood via GitGitGadget
From: Phillip Wood 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

[PATCH v2 4/6] sequencer.h fix placement of #endif

2019-10-15 Thread Phillip Wood via GitGitGadget
From: Phillip Wood Commit 65850686cf ("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 --- sequencer.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)

[PATCH v2 2/6] t3404: set $EDITOR in subshell

2019-10-15 Thread Phillip Wood via GitGitGadget
From: Phillip Wood 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

[PATCH v2 0/6] sequencer: start running post-commit hook again

2019-10-15 Thread Phillip Wood via GitGitGadget
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

[PATCH v2 1/6] t3404: remove unnecessary subshell

2019-10-15 Thread Phillip Wood via GitGitGadget
From: Phillip Wood 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 --- t/t3404-rebase-interactive.sh | 6 ++ 1 file changed, 2 insertions(+), 4 deleti

[PATCH v2 6/6] sequencer: run post-commit hook

2019-10-15 Thread Phillip Wood via GitGitGadget
From: Phillip Wood 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 commi

[PATCH v2 3/6] t3404: remove uneeded calls to set_fake_editor

2019-10-15 Thread Phillip Wood via GitGitGadget
From: Phillip Wood 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 messi

[PATCH 3/3] sequencer: run post-commit hook

2019-10-10 Thread Phillip Wood via GitGitGadget
From: Phillip Wood 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 commi

[PATCH 1/3] sequencer.h fix placement of #endif

2019-10-10 Thread Phillip Wood via GitGitGadget
From: Phillip Wood Commit 65850686cf ("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 --- sequencer.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)

[PATCH 2/3] sequencer: use run_commit_hook()

2019-10-10 Thread Phillip Wood via GitGitGadget
From: Phillip Wood This simplifies the implementation of run_prepare_commit_msg_hook() and will be used in the next commit. Signed-off-by: Phillip Wood --- builtin/commit.c | 22 -- commit.h | 3 --- sequencer.c | 45 ++-

[PATCH 0/3] sequencer: start running post-commit hook again

2019-10-10 Thread Phillip Wood via GitGitGadget
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. Phillip Wood (3): sequencer.h fix placement of #endif s

[PATCH 0/3] rebase -i: always update HEAD before rewording

2019-08-19 Thread Phillip Wood via GitGitGadget
This series contains a couple of patches to make the C version of rebase --interactive behave more like the scripted version. The third patch is not strictly related to the first two but is included here to avoid merge conflicts. Phillip Wood (3): rebase -i: always update HEAD before rewording

[PATCH 1/3] rebase -i: always update HEAD before rewording

2019-08-19 Thread Phillip Wood via GitGitGadget
From: Phillip Wood If the user runs git log while rewording a commit it is confusing if sometimes we're amending the commit that's being reworded and at other times we're creating a new commit depending on whether we could fast-forward or not[1]. Fix this inconsistency by always committing the pi

[PATCH 3/3] sequencer: simplify root commit creation

2019-08-19 Thread Phillip Wood via GitGitGadget
From: Phillip Wood Adapt try_to_commit() to create a new root commit rather than special casing this in run_git_commit(). The significantly reduces the amount of special case code for creating the root commit and reduces the number of commit code paths we have to worry about. Signed-off-by: Phil

[PATCH 2/3] rebase -i: check for updated todo after squash and reword

2019-08-19 Thread Phillip Wood via GitGitGadget
From: Phillip Wood While a rebase is stopped for the user to edit a commit message it can be convenient for them to also edit the todo list. The scripted version of rebase supported this but the C version does not. We already check to see if the todo list has been updated by an exec command so ex

[PATCH v2 1/1] t3420: remove progress lines before comparing output

2019-07-04 Thread Phillip Wood via GitGitGadget
From: Phillip Wood Some of the tests check the output of rebase is what we expect. These were added after a regression that added unwanted stash output when using --autostash. They are useful as they prevent unintended changes to the output of the various rebase commands. However they also includ

[PATCH v2 0/1] t3420 remove progress from output

2019-07-04 Thread Phillip Wood via GitGitGadget
Remove ugliness in the tests that check the output of git rebase I've updated this to avoid repeated calls to printf as suggested by Junio Based-On: sg/rebase-progress Phillip Wood (1): t3420: remove progress lines before comparing output t/t3420-rebase-autostash.sh | 19 +++

[PATCH 1/1] git-prompt: improve cherry-pick/revert detection

2019-07-01 Thread Phillip Wood via GitGitGadget
From: Phillip Wood If the user commits or resets a conflict resolution in the middle of a sequence of cherry-picks or reverts then CHERRY_PICK_HEAD/REVERT_HEAD will be removed and so in the absence of those files we need to check .git/sequencer/todo to see if there is a cherry-pick or revert in p

[PATCH 0/1] git-prompt: improve cherry-pick/revert detection

2019-07-01 Thread Phillip Wood via GitGitGadget
Fix the detection of in-progress cherry-picks and reverts when the user commits or resets a conflict resolution in the middle of a sequence of picks/reverts. Phillip Wood (1): git-prompt: improve cherry-pick/revert detection contrib/completion/git-prompt.sh | 37 ---

[PATCH 1/1] t3420: remove progress lines before comparing output

2019-07-01 Thread Phillip Wood via GitGitGadget
From: Phillip Wood Some of the tests check the output of rebase is what we expect. These were added after a regression that added unwanted stash output when using --autostash. They are useful as they prevent unintended changes to the output of the various rebase commands. However they also includ

[PATCH 0/1] t3420 remove progress from output

2019-07-01 Thread Phillip Wood via GitGitGadget
Remove ugliness in the tests that check the output of git rebase Based-On: sg/rebase-progress Cc: SZEDER Gábor szeder@gmail.com [szeder@gmail.com] Phillip Wood (1): t3420: remove progress lines before comparing output t/t3420-rebase-autostash.sh | 16 +--- 1 file changed,

[PATCH v2 3/3] status: do not report errors in sequencer/todo

2019-06-27 Thread Phillip Wood via GitGitGadget
From: Phillip Wood commit 4a72486de9 ("fix cherry-pick/revert status after commit", 2019-04-16) used parse_insn_line() to parse the first line of the todo list to check if it was a pick or revert. However if the todo list is left over from an old cherry-pick or revert and references a commit that

[PATCH v2 2/3] sequencer: factor out todo command name parsing

2019-06-27 Thread Phillip Wood via GitGitGadget
From: Phillip Wood Factor out the code that parses the name of the command at the start of each line in the todo file into its own function so that it can be used in the next commit. As I don't want to burden other callers with having to pass in a pointer to the end of the line the test for an a

[PATCH v2 1/3] sequencer: always allow tab after command name

2019-06-27 Thread Phillip Wood via GitGitGadget
From: Phillip Wood The code that parses the todo list allows an unabbreviated command name to be followed by a space or a tab, but if the command name is abbreviated it only allows a space after it. Fix this inconsistency. Signed-off-by: Phillip Wood --- sequencer.c | 2 +- 1 file changed, 1 i

[PATCH v2 0/3] Quieter sequencer status parsing

2019-06-27 Thread Phillip Wood via GitGitGadget
Thanks for the comments on v1. I've updated the commit message of the second patch to try and explain why the new function is not a straight-forward copy of the old code If we cannot parse the oid in the sequencer todo file do not show an error when running git status but instead report that a che

[PATCH 0/3] Wip/quieter sequencer status parsing

2019-06-25 Thread Phillip Wood via GitGitGadget
If we cannot parse the oid in the sequencer todo file do not show an error when running git status but instead report that a cherry-pick or revert is in progress. This addresses a confusing error message reported in https://public-inbox.org/git/3bc58c33-4268-4e7c-bf1a-fe349b3cb...@www.fastmail.com

[PATCH 2/3] sequencer: factor out todo command name parsing

2019-06-25 Thread Phillip Wood via GitGitGadget
From: Phillip Wood Factor out the code that parses the name of the command at the start of each line in the todo file into it's own function so that it can be used in the next commit. Signed-off-by: Phillip Wood --- sequencer.c | 19 +-- 1 file changed, 13 insertions(+), 6 dele

[PATCH 1/3] sequencer: always allow tab after command name

2019-06-25 Thread Phillip Wood via GitGitGadget
From: Phillip Wood The code that parses the todo list allows an unabbreviated command name to be followed by a space or a tab, but if the command name is abbreviated it only allows a space after it. Fix this inconsistency. Signed-off-by: Phillip Wood --- sequencer.c | 2 +- 1 file changed, 1 i

[PATCH 3/3] status: do not report errors in sequencer/todo

2019-06-25 Thread Phillip Wood via GitGitGadget
From: Phillip Wood commit 4a72486de9 ("fix cherry-pick/revert status after commit", 2019-04-16) used parse_insn_line() to parse the first line of the todo list to check if it was a pick or revert. However if the todo list is left over from an old cherry-pick or revert and references a commit that

[PATCH 1/1] add -p: fix checkout -p with pathological context

2019-06-12 Thread Phillip Wood via GitGitGadget
From: Phillip Wood Commit fecc6f3a68 ("add -p: adjust offsets of subsequent hunks when one is skipped", 2018-03-01) fixed adding hunks in the correct place when a previous hunk has been skipped. However it did not address patches that are applied in reverse. In that case we need to adjust the pre

[PATCH 0/1] add -p: fix checkout -p with pathological context

2019-06-12 Thread Phillip Wood via GitGitGadget
When I fixed the hunk offsets in add -p when hunks are skipped I forgot that the reverse patch case needs to be handled differently. Phillip Wood (1): add -p: fix checkout -p with pathological context git-add--interactive.perl | 6 +- t/t3701-add-interactive.sh | 8 2 files chang