diff options
Diffstat (limited to 't')
-rwxr-xr-x | t/t3000-ls-files-others.sh | 34 | ||||
-rwxr-xr-x | t/t3401-rebase-partial.sh | 53 | ||||
-rwxr-xr-x | t/t3500-cherry.sh | 53 | ||||
-rwxr-xr-x | t/t6022-merge-rename.sh | 37 |
4 files changed, 171 insertions, 6 deletions
diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh index 1f461e3e81..adcbe03d56 100755 --- a/t/t3000-ls-files-others.sh +++ b/t/t3000-ls-files-others.sh @@ -11,24 +11,46 @@ filesystem. path0 - a file path1 - a symlink path2/file2 - a file in a directory + path3-junk - a file to confuse things + path3/file3 - a file in a directory ' . ./test-lib.sh date >path0 ln -s xyzzy path1 -mkdir path2 +mkdir path2 path3 date >path2/file2 -test_expect_success \ - 'git-ls-files --others to show output.' \ - 'git-ls-files --others >output' -cat >expected <<EOF +date >path2-junk +date >path3/file3 +date >path3-junk +git-update-index --add path3-junk path3/file3 + +cat >expected1 <<EOF +expected1 +expected2 output path0 path1 +path2-junk path2/file2 EOF +sed -e 's|path2/file2|path2/|' <expected1 >expected2 + +test_expect_success \ + 'git-ls-files --others to show output.' \ + 'git-ls-files --others >output' test_expect_success \ 'git-ls-files --others should pick up symlinks.' \ - 'diff output expected' + 'diff output expected1' + +test_expect_success \ + 'git-ls-files --others --directory to show output.' \ + 'git-ls-files --others --directory >output' + + +test_expect_success \ + 'git-ls-files --others --directory should not get confused.' \ + 'diff output expected2' + test_done diff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh new file mode 100755 index 0000000000..32dc9c5e74 --- /dev/null +++ b/t/t3401-rebase-partial.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# +# Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland +# + +test_description='git rebase should detect patches integrated upstream + +This test cherry-picks one local change of two into master branch, and +checks that git rebase succeeds with only the second patch in the +local branch. +' +. ./test-lib.sh + +test_expect_success \ + 'prepare repository with topic branch' \ + 'echo First > A && + git-update-index --add A && + git-commit -m "Add A." && + + git-checkout -b my-topic-branch && + + echo Second > B && + git-update-index --add B && + git-commit -m "Add B." && + + echo AnotherSecond > C && + git-update-index --add C && + git-commit -m "Add C." && + + git-checkout -f master && + + echo Third >> A && + git-update-index A && + git-commit -m "Modify A." +' + +test_expect_success \ + 'pick top patch from topic branch into master' \ + 'git-cherry-pick my-topic-branch^0 && + git-checkout -f my-topic-branch +' + +test_debug \ + 'git-cherry master && + git-format-patch -k --stdout --full-index master >/dev/null && + gitk --all & sleep 1 +' + +test_expect_success \ + 'rebase topic branch against new master and check git-am did not get halted' \ + 'git-rebase master && test ! -d .dotest' + +test_done diff --git a/t/t3500-cherry.sh b/t/t3500-cherry.sh new file mode 100755 index 0000000000..b141f89de2 --- /dev/null +++ b/t/t3500-cherry.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# +# Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland +# + +test_description='git-cherry should detect patches integrated upstream + +This test cherry-picks one local change of two into master branch, and +checks that git-cherry only returns the second patch in the local branch +' +. ./test-lib.sh + +export GIT_AUTHOR_EMAIL=bogus_email_address + +test_expect_success \ + 'prepare repository with topic branch, and check cherry finds the 2 patches from there' \ + 'echo First > A && + git-update-index --add A && + git-commit -m "Add A." && + + git-checkout -b my-topic-branch && + + echo Second > B && + git-update-index --add B && + git-commit -m "Add B." && + + sleep 2 && + echo AnotherSecond > C && + git-update-index --add C && + git-commit -m "Add C." && + + git-checkout -f master && + + echo Third >> A && + git-update-index A && + git-commit -m "Modify A." && + + expr "$(echo $(git-cherry master my-topic-branch) )" : "+ [^ ]* + .*" +' + +test_expect_success \ + 'check that cherry with limit returns only the top patch'\ + 'expr "$(echo $(git-cherry master my-topic-branch my-topic-branch^1) )" : "+ [^ ]*" +' + +test_expect_success \ + 'cherry-pick one of the 2 patches, and check cherry recognized one and only one as new' \ + 'git-cherry-pick my-topic-branch^0 && + echo $(git-cherry master my-topic-branch) && + expr "$(echo $(git-cherry master my-topic-branch) )" : "+ [^ ]* - .*" +' + +test_done diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh index 153b9e49f2..1292cafd7f 100755 --- a/t/t6022-merge-rename.sh +++ b/t/t6022-merge-rename.sh @@ -161,4 +161,41 @@ test_expect_success 'pull unrenaming branch into renaming one' \ } ' +test_expect_success 'pull conflicting renames' \ +' + git reset --hard + git show-branch + git pull . blue && { + echo "BAD: should have conflicted" + exit 1 + } + test "$(git ls-files -u A | wc -l)" -eq 1 || { + echo "BAD: should have left a stage" + exit 1 + } + test "$(git ls-files -u B | wc -l)" -eq 1 || { + echo "BAD: should have left a stage" + exit 1 + } + test "$(git ls-files -u C | wc -l)" -eq 1 || { + echo "BAD: should have left a stage" + exit 1 + } + test "$(git ls-files -s N | wc -l)" -eq 1 || { + echo "BAD: should have merged N" + exit 1 + } + sed -ne "/^g/{ + p + q + }" B | grep red || { + echo "BAD: should have listed our change first" + exit 1 + } + test "$(git diff white N | wc -l)" -eq 0 || { + echo "BAD: should have taken colored branch" + exit 1 + } +' + test_done |