diff options
Diffstat (limited to 't')
-rwxr-xr-x | t/t0021-conversion.sh | 4 | ||||
-rwxr-xr-x | t/t3407-rebase-abort.sh | 71 | ||||
-rwxr-xr-x | t/t6031-merge-recursive.sh | 49 | ||||
-rwxr-xr-x | t/t7003-filter-branch.sh | 24 | ||||
-rwxr-xr-x | t/t7005-editor.sh | 27 |
5 files changed, 174 insertions, 1 deletions
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh index cb860296ed..8fc39d77ce 100755 --- a/t/t0021-conversion.sh +++ b/t/t0021-conversion.sh @@ -5,7 +5,9 @@ test_description='blob conversion via gitattributes' . ./test-lib.sh cat <<\EOF >rot13.sh -tr '[a-zA-Z]' '[n-za-mN-ZA-M]' +tr \ + 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' \ + 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM' EOF chmod +x rot13.sh diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh new file mode 100755 index 0000000000..37944c39a3 --- /dev/null +++ b/t/t3407-rebase-abort.sh @@ -0,0 +1,71 @@ +#!/bin/sh + +test_description='git rebase --abort tests' + +. ./test-lib.sh + +test_expect_success setup ' + echo a > a && + git add a && + git commit -m a && + git branch to-rebase && + + echo b > a && + git commit -a -m b && + echo c > a && + git commit -a -m c && + + git checkout to-rebase && + echo d > a && + git commit -a -m "merge should fail on this" && + echo e > a && + git commit -a -m "merge should fail on this, too" && + git branch pre-rebase +' + +testrebase() { + type=$1 + dotest=$2 + + test_expect_success "rebase$type --abort" ' + # Clean up the state from the previous one + git reset --hard pre-rebase + test_must_fail git rebase'"$type"' master && + test -d '$dotest' && + git rebase --abort && + test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) && + test ! -d '$dotest' + ' + + test_expect_success "rebase$type --abort after --skip" ' + # Clean up the state from the previous one + git reset --hard pre-rebase + test_must_fail git rebase'"$type"' master && + test -d '$dotest' && + test_must_fail git rebase --skip && + test $(git rev-parse HEAD) = $(git rev-parse master) && + git-rebase --abort && + test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) && + test ! -d '$dotest' + ' + + test_expect_success "rebase$type --abort after --continue" ' + # Clean up the state from the previous one + git reset --hard pre-rebase + test_must_fail git rebase'"$type"' master && + test -d '$dotest' && + echo c > a && + echo d >> a && + git add a && + test_must_fail git rebase --continue && + test $(git rev-parse HEAD) != $(git rev-parse master) && + git rebase --abort && + test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) && + test ! -d '$dotest' + ' +} + +testrebase "" .dotest +testrebase " --merge" .git/.dotest-merge + +test_done diff --git a/t/t6031-merge-recursive.sh b/t/t6031-merge-recursive.sh new file mode 100755 index 0000000000..5bb6b93780 --- /dev/null +++ b/t/t6031-merge-recursive.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +test_description='merge-recursive: handle file mode' +. ./test-lib.sh + +test_expect_success 'mode change in one branch: keep changed version' ' + : >file1 && + git add file1 && + git commit -m initial && + git checkout -b a1 master && + : >dummy && + git add dummy && + git commit -m a && + git checkout -b b1 master && + chmod +x file1 && + git add file1 && + git commit -m b1 && + git checkout a1 && + git merge-recursive master -- a1 b1 && + test -x file1 +' + +test_expect_success 'mode change in both branches: expect conflict' ' + git reset --hard HEAD && + git checkout -b a2 master && + : >file2 && + H=$(git hash-object file2) && + chmod +x file2 && + git add file2 && + git commit -m a2 && + git checkout -b b2 master && + : >file2 && + git add file2 && + git commit -m b2 && + git checkout a2 && + ( + git merge-recursive master -- a2 b2 + test $? = 1 + ) && + git ls-files -u >actual && + ( + echo "100755 $H 2 file2" + echo "100644 $H 3 file2" + ) >expect && + diff -u actual expect && + test -x file2 +' + +test_done diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 868babc4b2..6e14bf1c7f 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -179,4 +179,28 @@ test_expect_success 'Name needing quotes' ' ' +test_expect_success 'Subdirectory filter with disappearing trees' ' + git reset --hard && + git checkout master && + + mkdir foo && + touch foo/bar && + git add foo && + test_tick && + git commit -m "Adding foo" && + + git rm -r foo && + test_tick && + git commit -m "Removing foo" && + + mkdir foo && + touch foo/bar && + git add foo && + test_tick && + git commit -m "Re-adding foo" && + + git filter-branch -f --subdirectory-filter foo && + test $(git rev-list master | wc -l) = 3 +' + test_done diff --git a/t/t7005-editor.sh b/t/t7005-editor.sh index c1cec55306..6a74b3acfd 100755 --- a/t/t7005-editor.sh +++ b/t/t7005-editor.sh @@ -89,6 +89,33 @@ do ' done +test_expect_success 'editor with a space' ' + + if echo "echo space > \"\$1\"" > "e space.sh" + then + chmod a+x "e space.sh" && + GIT_EDITOR="./e\ space.sh" git commit --amend && + test space = "$(git show -s --pretty=format:%s)" + else + say "Skipping; FS does not support spaces in filenames" + fi + +' + +unset GIT_EDITOR +test_expect_success 'core.editor with a space' ' + + if test -f "e space.sh" + then + git config core.editor \"./e\ space.sh\" && + git commit --amend && + test space = "$(git show -s --pretty=format:%s)" + else + say "Skipping; FS does not support spaces in filenames" + fi + +' + TERM="$OLD_TERM" test_done |