summaryrefslogtreecommitdiff
path: root/t/t3404-rebase-interactive.sh
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2012-04-07 10:20:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-04-09 22:08:18 (GMT)
commita6754cda4362d129738d42d2683d07d433379e99 (patch)
treedbc792393be4cb289019c8f25ed410e67c67b29f /t/t3404-rebase-interactive.sh
parentb1bcfbe34439ff6d1a04d0bddb01eebe4df418a5 (diff)
downloadgit-a6754cda4362d129738d42d2683d07d433379e99.zip
git-a6754cda4362d129738d42d2683d07d433379e99.tar.gz
git-a6754cda4362d129738d42d2683d07d433379e99.tar.bz2
rebase -i continue: don't skip commits that only change submodules
When git-rebase--interactive stops due to a conflict and the only change to be committed is in a submodule, the test for whether there is anything to be committed ignores the staged submodule change. This leads rebase to skip creating the commit for the change. While unstaged submodule changes should be ignored to avoid needing to update submodules during a rebase, it is safe to remove the --ignore-submodules option to diff-index because --cached ensures that it is only checking the index. This was discussed in [1] and a test is included to ensure that unstaged changes are still ignored correctly. [1] http://thread.gmane.org/gmane.comp.version-control.git/188713 Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3404-rebase-interactive.sh')
-rwxr-xr-xt/t3404-rebase-interactive.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index b981572..7fd2127 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -624,8 +624,38 @@ test_expect_success 'submodule rebase -i' '
FAKE_LINES="1 squash 2 3" git rebase -i A
'
+test_expect_success 'submodule conflict setup' '
+ git tag submodule-base &&
+ git checkout HEAD^ &&
+ (
+ cd sub && git checkout HEAD^ && echo 4 >elif &&
+ git add elif && git commit -m "submodule conflict"
+ ) &&
+ git add sub &&
+ test_tick &&
+ git commit -m "Conflict in submodule" &&
+ git tag submodule-topic
+'
+
+test_expect_success 'rebase -i continue with only submodule staged' '
+ test_must_fail git rebase -i submodule-base &&
+ git add sub &&
+ git rebase --continue &&
+ test $(git rev-parse submodule-base) != $(git rev-parse HEAD)
+'
+
+test_expect_success 'rebase -i continue with unstaged submodule' '
+ git checkout submodule-topic &&
+ git reset --hard &&
+ test_must_fail git rebase -i submodule-base &&
+ git reset &&
+ git rebase --continue &&
+ test $(git rev-parse submodule-base) = $(git rev-parse HEAD)
+'
+
test_expect_success 'avoid unnecessary reset' '
git checkout master &&
+ git reset --hard &&
test-chmtime =123456789 file3 &&
git update-index --refresh &&
HEAD=$(git rev-parse HEAD) &&