diff options
Diffstat (limited to 't')
-rw-r--r-- | t/.gitattributes | 3 | ||||
-rwxr-xr-x | t/t1006-cat-file.sh | 26 | ||||
-rwxr-xr-x | t/t4126-apply-empty.sh | 4 | ||||
-rwxr-xr-x | t/t5505-remote.sh | 37 | ||||
-rwxr-xr-x | t/t6033-merge-crlf.sh | 52 | ||||
-rwxr-xr-x | t/t9122-git-svn-author.sh | 16 | ||||
-rw-r--r-- | t/test-lib.sh | 2 |
7 files changed, 129 insertions, 11 deletions
diff --git a/t/.gitattributes b/t/.gitattributes index 562b12e16e..ab6edbf19e 100644 --- a/t/.gitattributes +++ b/t/.gitattributes @@ -1 +1,2 @@ -* -whitespace +t[0-9][0-9][0-9][0-9]-*.sh -whitespace +t[0-9][0-9][0-9][0-9]/* -whitespace diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh index cb1fbe5820..d8b7f2ffbc 100755 --- a/t/t1006-cat-file.sh +++ b/t/t1006-cat-file.sh @@ -74,7 +74,7 @@ $content" test -z "$content" || test_expect_success "--batch output of $type is correct" ' expect="$(maybe_remove_timestamp "$batch_output" $no_ts)" - actual="$(maybe_remove_timestamp "$(echo $sha1 | git cat-file --batch)" no_ts)" + actual="$(maybe_remove_timestamp "$(echo $sha1 | git cat-file --batch)" $no_ts)" if test "z$expect" = "z$actual" then : happy @@ -174,9 +174,27 @@ do ' done -test_expect_success "--batch-check for a non-existent object" ' - test "deadbeef missing" = \ - "$(echo_without_newline deadbeef | git cat-file --batch-check)" +test_expect_success "--batch-check for a non-existent named object" ' + test "foobar42 missing +foobar84 missing" = \ + "$( ( echo foobar42; echo_without_newline foobar84; ) | git cat-file --batch-check)" +' + +test_expect_success "--batch-check for a non-existent hash" ' + test "0000000000000000000000000000000000000042 missing +0000000000000000000000000000000000000084 missing" = \ + "$( ( echo 0000000000000000000000000000000000000042; + echo_without_newline 0000000000000000000000000000000000000084; ) \ + | git cat-file --batch-check)" +' + +test_expect_success "--batch for an existent and a non-existent hash" ' + test "$tag_sha1 tag $tag_size +$tag_content +0000000000000000000000000000000000000000 missing" = \ + "$( ( echo $tag_sha1; + echo_without_newline 0000000000000000000000000000000000000000; ) \ + | git cat-file --batch)" ' test_expect_success "--batch-check for an emtpy line" ' diff --git a/t/t4126-apply-empty.sh b/t/t4126-apply-empty.sh index 0cfd47cfcf..ceb6a79fe0 100755 --- a/t/t4126-apply-empty.sh +++ b/t/t4126-apply-empty.sh @@ -26,7 +26,6 @@ test_expect_success setup ' test_expect_success 'apply empty' ' git reset --hard && - >empty && rm -f missing && git apply patch0 && test_cmp expect empty @@ -34,7 +33,6 @@ test_expect_success 'apply empty' ' test_expect_success 'apply --index empty' ' git reset --hard && - >empty && rm -f missing && git apply --index patch0 && test_cmp expect empty && @@ -43,7 +41,6 @@ test_expect_success 'apply --index empty' ' test_expect_success 'apply create' ' git reset --hard && - >empty && rm -f missing && git apply patch1 && test_cmp expect missing @@ -51,7 +48,6 @@ test_expect_success 'apply create' ' test_expect_success 'apply --index create' ' git reset --hard && - >empty && rm -f missing && git apply --index patch1 && test_cmp expect missing && diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index 0d7ed1f99b..1e192a2207 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -138,6 +138,25 @@ test_expect_success 'show' ' test_cmp expect output) ' +cat > test/expect << EOF +* remote origin + URL: $(pwd)/one/.git + Remote branch merged with 'git pull' while on branch master + master + Tracked remote branches + master side + Local branches pushed with 'git push' + master:upstream +refs/tags/lastbackup +EOF + +test_expect_success 'show -n' ' + (mv one one.unreachable && + cd test && + git remote show -n origin > output && + mv ../one.unreachable ../one && + test_cmp expect output) +' + test_expect_success 'prune' ' (cd one && git branch -m side side2) && @@ -148,6 +167,24 @@ test_expect_success 'prune' ' ! git rev-parse refs/remotes/origin/side) ' +cat > test/expect << EOF +Pruning origin +URL: $(pwd)/one/.git + * [would prune] origin/side2 +EOF + +test_expect_success 'prune --dry-run' ' + (cd one && + git branch -m side2 side) && + (cd test && + git remote prune --dry-run origin > output && + git rev-parse refs/remotes/origin/side2 && + ! git rev-parse refs/remotes/origin/side && + (cd ../one && + git branch -m side side2) && + test_cmp expect output) +' + test_expect_success 'add --mirror && prune' ' (mkdir mirror && cd mirror && diff --git a/t/t6033-merge-crlf.sh b/t/t6033-merge-crlf.sh new file mode 100755 index 0000000000..75d9602de4 --- /dev/null +++ b/t/t6033-merge-crlf.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +append_cr () { + sed -e 's/$/Q/' | tr Q '\015' +} + +remove_cr () { + tr '\015' Q | sed -e 's/Q$//' +} + +test_description='merge conflict in crlf repo + + b---M + / / + initial---a + +' + +. ./test-lib.sh + +test_expect_success setup ' + git config core.autocrlf true && + echo foo | append_cr >file && + git add file && + git commit -m "Initial" && + git tag initial && + git branch side && + echo line from a | append_cr >file && + git commit -m "add line from a" file && + git tag a && + git checkout side && + echo line from b | append_cr >file && + git commit -m "add line from b" file && + git tag b && + git checkout master +' + +test_expect_success 'Check "ours" is CRLF' ' + git reset --hard initial && + git merge side -s ours && + cat file | remove_cr | append_cr >file.temp && + test_cmp file file.temp +' + +test_expect_success 'Check that conflict file is CRLF' ' + git reset --hard a && + test_must_fail git merge side && + cat file | remove_cr | append_cr >file.temp && + test_cmp file file.temp +' + +test_done diff --git a/t/t9122-git-svn-author.sh b/t/t9122-git-svn-author.sh index 8c58f0b8d7..1190576a65 100755 --- a/t/t9122-git-svn-author.sh +++ b/t/t9122-git-svn-author.sh @@ -64,7 +64,21 @@ test_expect_success 'interact with it via git-svn' ' # Make sure --add-author-from with --use-log-author affected # the authorship information - grep "^Author: A U Thor " actual.4 + grep "^Author: A U Thor " actual.4 && + + # Make sure there are no commit messages with excess blank lines + test $(grep "^ " actual.2 | wc -l) = 3 && + test $(grep "^ " actual.3 | wc -l) = 5 && + test $(grep "^ " actual.4 | wc -l) = 5 && + + # Make sure there are no svn commit messages with excess blank lines + ( + cd work.svn && + svn up && + + test $(svn log -r2:2 | wc -l) = 5 && + test $(svn log -r4:4 | wc -l) = 7 + ) ' test_done diff --git a/t/test-lib.sh b/t/test-lib.sh index 7a8bd27abc..e9c9081edf 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -168,7 +168,7 @@ trap 'die' exit # environment variables to work around this. # # In particular, quoting isn't enough, as the path may contain the same quote -# that we're using. +# that we're using. test_set_editor () { FAKE_EDITOR="$1" export FAKE_EDITOR |