Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2022-07-19 21:33:40 +0300
committerJunio C Hamano <gitster@pobox.com>2022-07-19 22:49:04 +0300
commit89fc0b53fdb4ea2f9581ea728577f4d2a4947672 (patch)
treeb6d8559ef8a9ee3803e2a64af1ad2c412e90a551 /t/t2407-worktree-heads.sh
parent900b50c242dfa6b47033cbb495d2fd9d06752ff1 (diff)
rebase: update refs from 'update-ref' commands
The previous change introduced the 'git rebase --update-refs' option which added 'update-ref <ref>' commands to the todo list of an interactive rebase. Teach Git to record the HEAD position when reaching these 'update-ref' commands. The ref/before/after triple is stored in the $GIT_DIR/rebase-merge/update-refs file. A previous change parsed this file to avoid having other processes updating the refs in that file while the rebase is in progress. Not only do we update the file when the sequencer reaches these 'update-ref' commands, we then update the refs themselves at the end of the rebase sequence. If the rebase is aborted before this final step, then the refs are not updated. The 'before' value is used to ensure that we do not accidentally obliterate a ref that was updated concurrently (say, by an older version of Git or a third-party tool). Now that the 'git rebase --update-refs' command is implemented to write to the update-refs file, we can remove the fake construction of the update-refs file from a test in t2407-worktree-heads.sh. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2407-worktree-heads.sh')
-rwxr-xr-xt/t2407-worktree-heads.sh21
1 files changed, 6 insertions, 15 deletions
diff --git a/t/t2407-worktree-heads.sh b/t/t2407-worktree-heads.sh
index 8a03f14df8..50815acd3e 100755
--- a/t/t2407-worktree-heads.sh
+++ b/t/t2407-worktree-heads.sh
@@ -81,25 +81,16 @@ test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase (mer
grep "cannot force update the branch '\''wt-2'\'' checked out at.*wt-2" err
'
-test_expect_success 'refuse to overwrite: worktree in rebase with --update-refs' '
- test_when_finished rm -rf .git/worktrees/wt-3/rebase-merge &&
-
- mkdir -p .git/worktrees/wt-3/rebase-merge &&
- touch .git/worktrees/wt-3/rebase-merge/interactive &&
+test_expect_success !SANITIZE_LEAK 'refuse to overwrite: worktree in rebase with --update-refs' '
+ test_when_finished git -C wt-3 rebase --abort &&
- cat >.git/worktrees/wt-3/rebase-merge/update-refs <<-EOF &&
- refs/heads/fake-3
- $(git rev-parse HEAD~1)
- $(git rev-parse HEAD)
- refs/heads/fake-4
- $(git rev-parse HEAD)
- $(git rev-parse HEAD)
- EOF
+ git branch -f can-be-updated wt-3 &&
+ test_must_fail git -C wt-3 rebase --update-refs conflict-3 &&
for i in 3 4
do
- test_must_fail git branch -f fake-$i HEAD 2>err &&
- grep "cannot force update the branch '\''fake-$i'\'' checked out at.*wt-3" err ||
+ test_must_fail git branch -f can-be-updated HEAD 2>err &&
+ grep "cannot force update the branch '\''can-be-updated'\'' checked out at.*wt-3" err ||
return 1
done
'