summaryrefslogtreecommitdiffstats
path: root/t/t3400-rebase.sh
diff options
context:
space:
mode:
authorKristoffer Haugsbakk <code@khaugsbakk.name>2024-11-25 21:13:11 +0100
committerJunio C Hamano <gitster@pobox.com>2024-11-26 02:05:08 +0100
commit94304b9f48e9c68f3214e25527c3aac865d3ce63 (patch)
tree4c960e79befed3096e33a70327a38c672bf1d924 /t/t3400-rebase.sh
parentThe third batch (diff)
downloadgit-94304b9f48e9c68f3214e25527c3aac865d3ce63.tar.xz
git-94304b9f48e9c68f3214e25527c3aac865d3ce63.zip
sequencer: comment checked-out branch properly
`git rebase --update-ref` does not insert commands for dependent/sub- branches which are checked out.[1] Instead it leaves a comment about that fact. The comment char is hardcoded (#). In turn the comment line gets interpreted as an invalid command when `core.commentChar`/ `core.commentString` is in use. † 1: See 900b50c242 (rebase: add --update-refs option, 2022-07-19) Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rwxr-xr-xt/t3400-rebase.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh
index 09f230eefb..7c47af6dcd 100755
--- a/t/t3400-rebase.sh
+++ b/t/t3400-rebase.sh
@@ -456,4 +456,23 @@ test_expect_success 'rebase when inside worktree subdirectory' '
)
'
+test_expect_success 'git rebase --update-ref with core.commentChar and branch on worktree' '
+ test_when_finished git branch -D base topic2 &&
+ test_when_finished git checkout main &&
+ test_when_finished git branch -D wt-topic &&
+ test_when_finished git worktree remove wt-topic &&
+ git checkout main &&
+ git checkout -b base &&
+ git checkout -b topic2 &&
+ test_commit msg2 &&
+ git worktree add wt-topic &&
+ git checkout base &&
+ test_commit msg3 &&
+ git checkout topic2 &&
+ GIT_SEQUENCE_EDITOR="cat >actual" git -c core.commentChar=% \
+ rebase -i --update-refs base &&
+ test_grep "% Ref refs/heads/wt-topic checked out at" actual &&
+ test_grep "% Ref refs/heads/topic2 checked out at" actual
+'
+
test_done