@ -47,7 +47,23 @@ test_expect_success 'rebase ignores empty commit' '
|
||||
git commit --allow-empty -m empty &&
|
||||
test_commit D &&
|
||||
git rebase C &&
|
||||
test $(git log --format=%s C..) = "D"
|
||||
test "$(git log --format=%s C..)" = "D"
|
||||
'
|
||||
|
||||
test_expect_success 'rebase --keep-empty' '
|
||||
git reset --hard D &&
|
||||
git rebase --keep-empty C &&
|
||||
test "$(git log --format=%s C..)" = "D
|
||||
empty"
|
||||
'
|
||||
|
||||
test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' '
|
||||
git reset --hard A &&
|
||||
git commit --allow-empty -m also-empty &&
|
||||
git rebase --keep-empty D &&
|
||||
test "$(git log --format=%s A..)" = "also-empty
|
||||
D
|
||||
empty"
|
||||
'
|
||||
|
||||
test_done
|
||||
|
@ -66,5 +66,35 @@ test_expect_success 'suppress deletion diff with -B -D' '
|
||||
grep -v "Linus Torvalds" actual
|
||||
'
|
||||
|
||||
test_expect_success 'prepare a file that ends with an incomplete line' '
|
||||
test_seq 1 99 >seq &&
|
||||
printf 100 >>seq &&
|
||||
git add seq &&
|
||||
git commit seq -m seq
|
||||
'
|
||||
|
||||
test_expect_success 'rewrite the middle 90% of sequence file and terminate with newline' '
|
||||
test_seq 1 5 >seq &&
|
||||
test_seq 9331 9420 >>seq &&
|
||||
test_seq 96 100 >>seq
|
||||
'
|
||||
|
||||
test_expect_success 'confirm that sequence file is considered a rewrite' '
|
||||
git diff -B seq >res &&
|
||||
grep "dissimilarity index" res
|
||||
'
|
||||
|
||||
test_expect_success 'no newline at eof is on its own line without -B' '
|
||||
git diff seq >res &&
|
||||
grep "^\\\\ " res &&
|
||||
! grep "^..*\\\\ " res
|
||||
'
|
||||
|
||||
test_expect_success 'no newline at eof is on its own line with -B' '
|
||||
git diff -B seq >res &&
|
||||
grep "^\\\\ " res &&
|
||||
! grep "^..*\\\\ " res
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
|
@ -258,6 +258,27 @@ test_expect_success 'init should register submodule url in .git/config' '
|
||||
test_cmp expect url
|
||||
'
|
||||
|
||||
test_failure_with_unknown_submodule () {
|
||||
test_must_fail git submodule $1 no-such-submodule 2>output.err &&
|
||||
grep "^error: .*no-such-submodule" output.err
|
||||
}
|
||||
|
||||
test_expect_success 'init should fail with unknown submodule' '
|
||||
test_failure_with_unknown_submodule init
|
||||
'
|
||||
|
||||
test_expect_success 'update should fail with unknown submodule' '
|
||||
test_failure_with_unknown_submodule update
|
||||
'
|
||||
|
||||
test_expect_success 'status should fail with unknown submodule' '
|
||||
test_failure_with_unknown_submodule status
|
||||
'
|
||||
|
||||
test_expect_success 'sync should fail with unknown submodule' '
|
||||
test_failure_with_unknown_submodule sync
|
||||
'
|
||||
|
||||
test_expect_success 'update should fail when path is used by a file' '
|
||||
echo hello >expect &&
|
||||
|
||||
@ -418,10 +439,7 @@ test_expect_success 'moving to a commit without submodule does not leave empty d
|
||||
'
|
||||
|
||||
test_expect_success 'submodule <invalid-path> warns' '
|
||||
|
||||
git submodule no-such-submodule 2> output.err &&
|
||||
grep "^error: .*no-such-submodule" output.err
|
||||
|
||||
test_failure_with_unknown_submodule
|
||||
'
|
||||
|
||||
test_expect_success 'add submodules without specifying an explicit path' '
|
||||
|
@ -123,6 +123,18 @@ test_expect_success 'submodule update should throw away changes with --force ' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'submodule update --force forcibly checks out submodules' '
|
||||
(cd super &&
|
||||
(cd submodule &&
|
||||
rm -f file
|
||||
) &&
|
||||
git submodule update --force submodule &&
|
||||
(cd submodule &&
|
||||
test "$(git status -s file)" = ""
|
||||
)
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'submodule update --rebase staying on master' '
|
||||
(cd super/submodule &&
|
||||
git checkout master
|
||||
@ -367,7 +379,7 @@ test_expect_success 'submodule update continues after checkout error' '
|
||||
git submodule init &&
|
||||
git commit -am "new_submodule" &&
|
||||
(cd submodule2 &&
|
||||
git rev-parse --max-count=1 HEAD > ../expect
|
||||
git rev-parse --verify HEAD >../expect
|
||||
) &&
|
||||
(cd submodule &&
|
||||
test_commit "update_submodule" file
|
||||
@ -384,7 +396,7 @@ test_expect_success 'submodule update continues after checkout error' '
|
||||
git checkout HEAD^ &&
|
||||
test_must_fail git submodule update &&
|
||||
(cd submodule2 &&
|
||||
git rev-parse --max-count=1 HEAD > ../actual
|
||||
git rev-parse --verify HEAD >../actual
|
||||
) &&
|
||||
test_cmp expect actual
|
||||
)
|
||||
@ -413,7 +425,7 @@ test_expect_success 'submodule update continues after recursive checkout error'
|
||||
test_commit "update_submodule_again_again" file
|
||||
) &&
|
||||
(cd submodule2 &&
|
||||
git rev-parse --max-count=1 HEAD > ../expect &&
|
||||
git rev-parse --verify HEAD >../expect &&
|
||||
test_commit "update_submodule2_again" file
|
||||
) &&
|
||||
git add submodule &&
|
||||
@ -428,7 +440,7 @@ test_expect_success 'submodule update continues after recursive checkout error'
|
||||
) &&
|
||||
test_must_fail git submodule update --recursive &&
|
||||
(cd submodule2 &&
|
||||
git rev-parse --max-count=1 HEAD > ../actual
|
||||
git rev-parse --verify HEAD >../actual
|
||||
) &&
|
||||
test_cmp expect actual
|
||||
)
|
||||
@ -460,12 +472,12 @@ test_expect_success 'submodule update exit immediately in case of merge conflict
|
||||
) &&
|
||||
git checkout HEAD^ &&
|
||||
(cd submodule2 &&
|
||||
git rev-parse --max-count=1 HEAD > ../expect
|
||||
git rev-parse --verify HEAD >../expect
|
||||
) &&
|
||||
git config submodule.submodule.update merge &&
|
||||
test_must_fail git submodule update &&
|
||||
(cd submodule2 &&
|
||||
git rev-parse --max-count=1 HEAD > ../actual
|
||||
git rev-parse --verify HEAD >../actual
|
||||
) &&
|
||||
test_cmp expect actual
|
||||
)
|
||||
@ -495,12 +507,12 @@ test_expect_success 'submodule update exit immediately after recursive rebase er
|
||||
) &&
|
||||
git checkout HEAD^ &&
|
||||
(cd submodule2 &&
|
||||
git rev-parse --max-count=1 HEAD > ../expect
|
||||
git rev-parse --verify HEAD >../expect
|
||||
) &&
|
||||
git config submodule.submodule.update rebase &&
|
||||
test_must_fail git submodule update &&
|
||||
(cd submodule2 &&
|
||||
git rev-parse --max-count=1 HEAD > ../actual
|
||||
git rev-parse --verify HEAD >../actual
|
||||
) &&
|
||||
test_cmp expect actual
|
||||
)
|
||||
|
@ -55,6 +55,16 @@ test_expect_success 'setup' '
|
||||
git rm file12 &&
|
||||
git commit -m "branch1 changes" &&
|
||||
|
||||
git checkout -b stash1 master &&
|
||||
echo stash1 change file11 >file11 &&
|
||||
git add file11 &&
|
||||
git commit -m "stash1 changes" &&
|
||||
|
||||
git checkout -b stash2 master &&
|
||||
echo stash2 change file11 >file11 &&
|
||||
git add file11 &&
|
||||
git commit -m "stash2 changes" &&
|
||||
|
||||
git checkout master &&
|
||||
git submodule update -N &&
|
||||
echo master updated >file1 &&
|
||||
@ -193,7 +203,35 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' '
|
||||
git reset --hard
|
||||
'
|
||||
|
||||
test_expect_success 'conflicted stash sets up rerere' '
|
||||
git config rerere.enabled true &&
|
||||
git checkout stash1 &&
|
||||
echo "Conflicting stash content" >file11 &&
|
||||
git stash &&
|
||||
|
||||
git checkout --detach stash2 &&
|
||||
test_must_fail git stash apply &&
|
||||
|
||||
test -n "$(git ls-files -u)" &&
|
||||
conflicts="$(git rerere remaining)" &&
|
||||
test "$conflicts" = "file11" &&
|
||||
output="$(git mergetool --no-prompt)" &&
|
||||
test "$output" != "No files need merging" &&
|
||||
|
||||
git commit -am "save the stash resolution" &&
|
||||
|
||||
git reset --hard stash2 &&
|
||||
test_must_fail git stash apply &&
|
||||
|
||||
test -n "$(git ls-files -u)" &&
|
||||
conflicts="$(git rerere remaining)" &&
|
||||
test -z "$conflicts" &&
|
||||
output="$(git mergetool --no-prompt)" &&
|
||||
test "$output" = "No files need merging"
|
||||
'
|
||||
|
||||
test_expect_success 'mergetool takes partial path' '
|
||||
git reset --hard
|
||||
git config rerere.enabled false &&
|
||||
git checkout -b test12 branch1 &&
|
||||
git submodule update -N &&
|
||||
|
Reference in New Issue
Block a user