forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
built-in rebase: pick up the ORIG_HEAD fix early #2112
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
Merged
dscho
merged 4 commits into
git-for-windows:master
from
dscho:gfw/rebase-am-and-orig-head
Mar 7, 2019
Merged
built-in rebase: pick up the ORIG_HEAD fix early #2112
dscho
merged 4 commits into
git-for-windows:master
from
dscho:gfw/rebase-am-and-orig-head
Mar 7, 2019
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the case that the rebase boils down to a fast-forward, the built-in rebase reset the working tree twice: once to start the rebase at `onto`, then realizing that the original (pre-rebase) HEAD was an ancestor and we basically already fast-forwarded to the post-rebase HEAD, `reset_head()` was called to update the original ref and to point HEAD back to it. That second `reset_head()` call does not need to touch the working tree, though, as it does not change the actual tip commit (and therefore the working tree should stay unchanged anyway): only the ref needs to be updated (because the rebase detached the HEAD, and we want to go back to the branch on which the rebase was started). But that second `reset_head()` was called without the flag to leave the working tree alone (the reason: when that call was introduced, that flag was not yet even thought of). Let's avoid that unnecessary work by passing that flag. Signed-off-by: Johannes Schindelin <[email protected]>
By mistake, we used the reflog intended for ORIG_HEAD. Signed-off-by: Johannes Schindelin <[email protected]>
The ORIG_HEAD pseudo ref is supposed to refer to the original, pre-rebase state after a successful rebase. Let's add a regression test to prove that this regressed: With GIT_TEST_REBASE_USE_BUILTIN=false, this test case passes, with GIT_TEST_REBASE_USE_BUILTIN=true (or unset), it fails. Reported by Nazri Ramliy. Signed-off-by: Johannes Schindelin <[email protected]>
Technically, the scripted version set ORIG_HEAD only in two spots (which really could have been one, because it called `git checkout $onto^0` to start the rebase and also if it could take a shortcut, and in both cases it called `git update-ref $orig_head`). Practically, it *implicitly* reset ORIG_HEAD whenever `git reset --hard` was called. However, what we really want is that it is set exactly once, at the beginning of the rebase. So let's do that. Signed-off-by: Johannes Schindelin <[email protected]>
👍 |
orgads
approved these changes
Mar 7, 2019
@orgads thank you for reviewing! |
git-for-windows-ci
pushed a commit
that referenced
this pull request
Mar 7, 2019
built-in rebase: pick up the ORIG_HEAD fix early
git-for-windows-ci
pushed a commit
that referenced
this pull request
Mar 7, 2019
built-in rebase: pick up the ORIG_HEAD fix early
dscho
added a commit
that referenced
this pull request
Mar 11, 2019
built-in rebase: pick up the ORIG_HEAD fix early
dscho
added a commit
that referenced
this pull request
Mar 11, 2019
built-in rebase: pick up the ORIG_HEAD fix early
dscho
added a commit
that referenced
this pull request
Mar 11, 2019
built-in rebase: pick up the ORIG_HEAD fix early
dscho
added a commit
that referenced
this pull request
Mar 11, 2019
built-in rebase: pick up the ORIG_HEAD fix early
git-for-windows-ci
pushed a commit
that referenced
this pull request
Mar 18, 2019
built-in rebase: pick up the ORIG_HEAD fix early
git-for-windows-ci
pushed a commit
that referenced
this pull request
Apr 5, 2019
built-in rebase: pick up the ORIG_HEAD fix early
git-for-windows-ci
pushed a commit
that referenced
this pull request
Apr 5, 2019
built-in rebase: pick up the ORIG_HEAD fix early
git-for-windows-ci
pushed a commit
that referenced
this pull request
Apr 11, 2019
built-in rebase: pick up the ORIG_HEAD fix early
git-for-windows-ci
pushed a commit
that referenced
this pull request
Apr 16, 2019
built-in rebase: pick up the ORIG_HEAD fix early
dscho
added a commit
that referenced
this pull request
Apr 27, 2019
built-in rebase: pick up the ORIG_HEAD fix early
git-for-windows-ci
pushed a commit
that referenced
this pull request
May 8, 2019
built-in rebase: pick up the ORIG_HEAD fix early
git-for-windows-ci
pushed a commit
that referenced
this pull request
May 9, 2019
built-in rebase: pick up the ORIG_HEAD fix early
git-for-windows-ci
pushed a commit
that referenced
this pull request
May 10, 2019
built-in rebase: pick up the ORIG_HEAD fix early
dscho
added a commit
to dscho/git
that referenced
this pull request
May 13, 2019
…orig-head built-in rebase: pick up the ORIG_HEAD fix early
git-for-windows-ci
pushed a commit
that referenced
this pull request
May 14, 2019
built-in rebase: pick up the ORIG_HEAD fix early
dscho
added a commit
that referenced
this pull request
May 21, 2019
built-in rebase: pick up the ORIG_HEAD fix early
dscho
added a commit
that referenced
this pull request
May 22, 2019
built-in rebase: pick up the ORIG_HEAD fix early
dscho
added a commit
that referenced
this pull request
May 25, 2019
built-in rebase: pick up the ORIG_HEAD fix early
dscho
added a commit
that referenced
this pull request
Jun 4, 2019
built-in rebase: pick up the ORIG_HEAD fix early
dscho
added a commit
that referenced
this pull request
Jun 8, 2019
built-in rebase: pick up the ORIG_HEAD fix early
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It was reported (a bit belatedly) that there was a regression in v2.21.0 where the built-in rebase would update
ORIG_HEAD
one times too many, so that it would not point at the pre-rebase state immediately after a rebase completed.This regression is related (but not identical) to one that was already reported in early January (which was fixed immediately), and for which a regression test had been promised, but which did not materialize until after v2.21.0. Which is too bad, because that re-regression was totally avoidable.
This patch series fixes that problem, and adds a regression test (better late than never, right?) to avoid re-introducing that regression a third time.
This made it (in a slightly different form, see range-diff below) into git.git's
next
already, via git@f805f820b4b4. Let's take this early, to let Git for Windows' users benefit from the fix as soon as possible.The range-diff (demonstrating that the
RESET_HEAD_RUN_POST_CHECKOUT_HOOK
constant requires an adjustment to theRESET_ORIG_HEAD
constant):