Skip to content

Commit

Permalink
Merge branch 'jk/rebase-i-submodule-conflict-only' into maint
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed May 2, 2012
2 parents 520d2ce + a6754cd commit a4da338
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion git-rebase--interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ rearrange_squash () {
case "$action" in
continue)
# do we have anything to commit?
if git diff-index --cached --quiet --ignore-submodules HEAD --
if git diff-index --cached --quiet HEAD --
then
: Nothing to commit -- skip this
else
Expand Down
30 changes: 30 additions & 0 deletions t/t3404-rebase-interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand Down

0 comments on commit a4da338

Please sign in to comment.