Skip to content

Commit a4da338

Browse files
committed
Merge branch 'jk/rebase-i-submodule-conflict-only' into maint
Giving "--continue" to a conflicted "rebase -i" session skipped a commit that only results in changes to submodules. By John Keeping * jk/rebase-i-submodule-conflict-only: rebase -i continue: don't skip commits that only change submodules
2 parents 520d2ce + a6754cd commit a4da338

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

git-rebase--interactive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ rearrange_squash () {
672672
case "$action" in
673673
continue)
674674
# do we have anything to commit?
675-
if git diff-index --cached --quiet --ignore-submodules HEAD --
675+
if git diff-index --cached --quiet HEAD --
676676
then
677677
: Nothing to commit -- skip this
678678
else

t/t3404-rebase-interactive.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,38 @@ test_expect_success 'submodule rebase -i' '
624624
FAKE_LINES="1 squash 2 3" git rebase -i A
625625
'
626626

627+
test_expect_success 'submodule conflict setup' '
628+
git tag submodule-base &&
629+
git checkout HEAD^ &&
630+
(
631+
cd sub && git checkout HEAD^ && echo 4 >elif &&
632+
git add elif && git commit -m "submodule conflict"
633+
) &&
634+
git add sub &&
635+
test_tick &&
636+
git commit -m "Conflict in submodule" &&
637+
git tag submodule-topic
638+
'
639+
640+
test_expect_success 'rebase -i continue with only submodule staged' '
641+
test_must_fail git rebase -i submodule-base &&
642+
git add sub &&
643+
git rebase --continue &&
644+
test $(git rev-parse submodule-base) != $(git rev-parse HEAD)
645+
'
646+
647+
test_expect_success 'rebase -i continue with unstaged submodule' '
648+
git checkout submodule-topic &&
649+
git reset --hard &&
650+
test_must_fail git rebase -i submodule-base &&
651+
git reset &&
652+
git rebase --continue &&
653+
test $(git rev-parse submodule-base) = $(git rev-parse HEAD)
654+
'
655+
627656
test_expect_success 'avoid unnecessary reset' '
628657
git checkout master &&
658+
git reset --hard &&
629659
test-chmtime =123456789 file3 &&
630660
git update-index --refresh &&
631661
HEAD=$(git rev-parse HEAD) &&

0 commit comments

Comments
 (0)