-
Notifications
You must be signed in to change notification settings - Fork 141
rebase -i: always update HEAD before rewording #312
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
rebase -i: always update HEAD before rewording #312
Conversation
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 picked commit and then running 'git commit --amend' to do the reword. The first commit is performed by the sequencer without forking git commit and does not impact on the speed of rebase. In a test rewording 100 commits with GIT_EDITOR=true GIT_SEQUENCE_EDITOR='sed -i s/pick/reword/' \ ../bin-wrappers/git rebase -i --root and taking the best of three runs the current master took 957ms and with this patch it took 961ms. This change fixes rewording the new root commit when rearranging commits with --root. Note that the new code no longer updates CHERRY_PICK_HEAD after creating a root commit - I'm not sure why the old code was that creating that ref after a successful commit, everywhere else it is removed after a successful commit. [1] https://public-inbox.org/git/[email protected]/T/#m133009cb91cf0917bcf667300f061178be56680a Reported-by: SZEDER Gábor <[email protected]> Signed-off-by: Phillip Wood <[email protected]>
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 extend this to rewords and squashes. It only costs a single stat call to do this so it should not affect the speed of the rebase (especially as it has just stopped for the user to edit a message) Note that for squashes the editor may be opened on a different pick to the squash itself as we edit the message at the end of a chain fixups and squashes. Signed-off-by: Phillip Wood <[email protected]>
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: Phillip Wood <[email protected]>
a737c6b
to
3c3b459
Compare
/submit |
Submitted as [email protected] |
@@ -869,34 +869,6 @@ static char *get_author(const char *message) | |||
return NULL; |
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, Eric Sunshine wrote (reply to this):
On Mon, Aug 19, 2019 at 5:18 AM Phillip Wood via GitGitGadget
<[email protected]> wrote:
> 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
s/The/This/
> special case code for creating the root commit and reduces the number of
> commit code paths we have to worry about.
>
> Signed-off-by: Phillip Wood <[email protected]>
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):
On 19/08/2019 17:09, Eric Sunshine wrote:
> On Mon, Aug 19, 2019 at 5:18 AM Phillip Wood via GitGitGadget
> <[email protected]> wrote:
>> 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
>
> s/The/This/
Thanks Eric - well spotted as ever. Thanks Junio for fixing this up in pu.
Best Wishes
Phillip
>> special case code for creating the root commit and reduces the number of
>> commit code paths we have to worry about.
>>
>> Signed-off-by: Phillip Wood <[email protected]>
This branch is now known as |
This patch series was integrated into pu via git@88a9d4a. |
This patch series was integrated into pu via git@3335578. |
This patch series was integrated into pu via git@d4d2c7a. |
This patch series was integrated into pu via git@80bb26d. |
This patch series was integrated into pu via git@5dc69ff. |
This patch series was integrated into pu via git@627a1df. |
This patch series was integrated into pu via git@283c8d8. |
This patch series was integrated into pu via git@0e20c75. |
This patch series was integrated into pu via git@c46b85f. |
This patch series was integrated into pu via git@c6efc8a. |
This patch series was integrated into pu via git@aa02063. |
This patch series was integrated into pu via git@8b56832. |
This patch series was integrated into pu via git@a054d6f. |
This patch series was integrated into pu via git@a008757. |
This patch series was integrated into pu via git@baa8c84. |
This patch series was integrated into pu via git@cb3eed2. |
This patch series was integrated into pu via git@c438e26. |
This patch series was integrated into next via git@ab3d7ee. |
This patch series was integrated into pu via git@3492bec. |
This patch series was integrated into pu via git@ec65760. |
This patch series was integrated into pu via git@660494b. |
This patch series was integrated into pu via git@144d3f8. |
This patch series was integrated into pu via git@5072b4b. |
This patch series was integrated into pu via git@4608a02. |
This patch series was integrated into next via git@4608a02. |
This patch series was integrated into master via git@4608a02. |
Closed via 4608a02. |
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.
Cc: SZEDER Gábor [email protected], Johannes Schindelin [email protected]