diff options
Diffstat (limited to 't')
147 files changed, 1625 insertions, 770 deletions
diff --git a/t/.gitignore b/t/.gitignore index b27e28008..7dcbb232c 100644 --- a/t/.gitignore +++ b/t/.gitignore @@ -1,2 +1,2 @@ -/trash directory +/trash directory* /test-results diff --git a/t/Makefile b/t/Makefile index 0d65cedaa..ed49c20b1 100644 --- a/t/Makefile +++ b/t/Makefile @@ -14,7 +14,8 @@ SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh) TSVN = $(wildcard t91[0-9][0-9]-*.sh) -all: pre-clean $(T) aggregate-results clean +all: pre-clean + $(MAKE) aggregate-results-and-cleanup $(T): @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS) @@ -25,6 +26,10 @@ pre-clean: clean: $(RM) -r 'trash directory' test-results +aggregate-results-and-cleanup: $(T) + $(MAKE) aggregate-results + $(MAKE) clean + aggregate-results: '$(SHELL_PATH_SQ)' ./aggregate-results.sh test-results/t*-* @@ -34,4 +39,3 @@ full-svn-test: $(MAKE) $(TSVN) GIT_SVN_NO_OPTIMIZE_COMMITS=0 LC_ALL=en_US.UTF-8 .PHONY: pre-clean $(T) aggregate-results clean -.NOTPARALLEL: diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh index dc473dfb5..6ac312b90 100644 --- a/t/lib-httpd.sh +++ b/t/lib-httpd.sh @@ -14,7 +14,7 @@ fi LIB_HTTPD_PATH=${LIB_HTTPD_PATH-'/usr/sbin/apache2'} LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'} -TEST_PATH="$PWD"/../lib-httpd +TEST_PATH="$TEST_DIRECTORY"/lib-httpd HTTPD_ROOT_PATH="$PWD"/httpd HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www diff --git a/t/t0022-crlf-rename.sh b/t/t0022-crlf-rename.sh index 7d1ce2d05..f1e1d4886 100755 --- a/t/t0022-crlf-rename.sh +++ b/t/t0022-crlf-rename.sh @@ -6,13 +6,13 @@ test_description='ignore CR in CRLF sequence while computing similiarity' test_expect_success setup ' - cat ../t0022-crlf-rename.sh >sample && + cat "$TEST_DIRECTORY"/t0022-crlf-rename.sh >sample && git add sample && test_tick && git commit -m Initial && - sed -e "s/\$/
/" ../t0022-crlf-rename.sh >elpmas && + sed -e "s/\$/
/" "$TEST_DIRECTORY"/t0022-crlf-rename.sh >elpmas && git add elpmas && rm -f sample && diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh index b177174ef..7edf49db3 100755 --- a/t/t0050-filesystem.sh +++ b/t/t0050-filesystem.sh @@ -85,7 +85,7 @@ $test_case 'add (with different case)' ' rm camelcase && echo 1 >CamelCase && git add CamelCase && - test $(git-ls-files | grep -i camelcase | wc -l) = 1 + test $(git ls-files | grep -i camelcase | wc -l) = 1 ' diff --git a/t/t0055-beyond-symlinks.sh b/t/t0055-beyond-symlinks.sh new file mode 100755 index 000000000..b29c37a5a --- /dev/null +++ b/t/t0055-beyond-symlinks.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +test_description='update-index and add refuse to add beyond symlinks' + +. ./test-lib.sh + +test_expect_success setup ' + >a && + mkdir b && + ln -s b c && + >c/d && + git update-index --add a b/d +' + +test_expect_success 'update-index --add beyond symlinks' ' + test_must_fail git update-index --add c/d && + ! ( git ls-files | grep c/d ) +' + +test_expect_success 'add beyond symlinks' ' + test_must_fail git add c/d && + ! ( git ls-files | grep c/d ) +' + +test_done diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh index 807fb83af..22ba7a544 100755 --- a/t/t1000-read-tree-m-3way.sh +++ b/t/t1000-read-tree-m-3way.sh @@ -72,7 +72,7 @@ In addition: ' . ./test-lib.sh -. ../lib-read-tree-m-3way.sh +. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh ################################################################ # Trivial "majority when 3 stages exist" merge plus #2ALT, #3ALT diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh index aa9dd580a..5e40cec53 100755 --- a/t/t1002-read-tree-m-u-2way.sh +++ b/t/t1002-read-tree-m-u-2way.sh @@ -14,6 +14,8 @@ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" compare_change () { sed >current \ + -e '1{/^diff --git /d;}' \ + -e '2{/^index /d;}' \ -e '/^--- /d; /^+++ /d; /^@@ /d;' \ -e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /' "$1" test_cmp expected current @@ -75,7 +77,7 @@ test_expect_success \ git update-index --add yomin && git read-tree -m -u $treeH $treeM && git ls-files --stage >4.out || return 1 - diff -U0 M.out 4.out >4diff.out + git diff -U0 --no-index M.out 4.out >4diff.out compare_change 4diff.out expected && check_cache_at yomin clean && sum bozbar frotz nitfol >actual4.sum && @@ -94,7 +96,7 @@ test_expect_success \ echo yomin yomin >yomin && git read-tree -m -u $treeH $treeM && git ls-files --stage >5.out || return 1 - diff -U0 M.out 5.out >5diff.out + git diff -U0 --no-index M.out 5.out >5diff.out compare_change 5diff.out expected && check_cache_at yomin dirty && sum bozbar frotz nitfol >actual5.sum && @@ -206,7 +208,7 @@ test_expect_success \ git update-index --add nitfol && git read-tree -m -u $treeH $treeM && git ls-files --stage >14.out || return 1 - diff -U0 M.out 14.out >14diff.out + git diff -U0 --no-index M.out 14.out >14diff.out compare_change 14diff.out expected && sum bozbar frotz >actual14.sum && grep -v nitfol M.sum > expected14.sum && @@ -227,7 +229,7 @@ test_expect_success \ echo nitfol nitfol nitfol >nitfol && git read-tree -m -u $treeH $treeM && git ls-files --stage >15.out || return 1 - diff -U0 M.out 15.out >15diff.out + git diff -U0 --no-index M.out 15.out >15diff.out compare_change 15diff.out expected && check_cache_at nitfol dirty && sum bozbar frotz >actual15.sum && diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh index 1ec053513..fd98e445b 100755 --- a/t/t1007-hash-object.sh +++ b/t/t1007-hash-object.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description="git-hash-object" +test_description="git hash-object" . ./test-lib.sh @@ -49,16 +49,28 @@ setup_repo # Argument checking test_expect_success "multiple '--stdin's are rejected" ' - test_must_fail git hash-object --stdin --stdin < example + echo example | test_must_fail git hash-object --stdin --stdin ' test_expect_success "Can't use --stdin and --stdin-paths together" ' - test_must_fail git hash-object --stdin --stdin-paths && - test_must_fail git hash-object --stdin-paths --stdin + echo example | test_must_fail git hash-object --stdin --stdin-paths && + echo example | test_must_fail git hash-object --stdin-paths --stdin ' test_expect_success "Can't pass filenames as arguments with --stdin-paths" ' - test_must_fail git hash-object --stdin-paths hello < example + echo example | test_must_fail git hash-object --stdin-paths hello +' + +test_expect_success "Can't use --path with --stdin-paths" ' + echo example | test_must_fail git hash-object --stdin-paths --path=foo +' + +test_expect_success "Can't use --stdin-paths with --no-filters" ' + echo example | test_must_fail git hash-object --stdin-paths --no-filters +' + +test_expect_success "Can't use --path with --no-filters" ' + test_must_fail git hash-object --no-filters --path=foo ' # Behavior @@ -93,6 +105,42 @@ test_expect_success 'git hash-object --stdin file1 <file0 first operates on file test "$obname1" = "$obname1new" ' +test_expect_success 'check that appropriate filter is invoke when --path is used' ' + echo fooQ | tr Q "\\015" >file0 && + cp file0 file1 && + echo "file0 -crlf" >.gitattributes && + echo "file1 crlf" >>.gitattributes && + git config core.autocrlf true && + file0_sha=$(git hash-object file0) && + file1_sha=$(git hash-object file1) && + test "$file0_sha" != "$file1_sha" && + path1_sha=$(git hash-object --path=file1 file0) && + path0_sha=$(git hash-object --path=file0 file1) && + test "$file0_sha" = "$path0_sha" && + test "$file1_sha" = "$path1_sha" && + path1_sha=$(cat file0 | git hash-object --path=file1 --stdin) && + path0_sha=$(cat file1 | git hash-object --path=file0 --stdin) && + test "$file0_sha" = "$path0_sha" && + test "$file1_sha" = "$path1_sha" && + git config --unset core.autocrlf +' + +test_expect_success 'check that --no-filters option works' ' + echo fooQ | tr Q "\\015" >file0 && + cp file0 file1 && + echo "file0 -crlf" >.gitattributes && + echo "file1 crlf" >>.gitattributes && + git config core.autocrlf true && + file0_sha=$(git hash-object file0) && + file1_sha=$(git hash-object file1) && + test "$file0_sha" != "$file1_sha" && + nofilters_file1=$(git hash-object --no-filters file1) && + test "$file0_sha" = "$nofilters_file1" && + nofilters_file1=$(cat file1 | git hash-object --stdin) && + test "$file0_sha" = "$nofilters_file1" && + git config --unset core.autocrlf +' + pop_repo for args in "-w --stdin" "--stdin -w"; do diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh index 09a819933..67e637b78 100755 --- a/t/t1200-tutorial.sh +++ b/t/t1200-tutorial.sh @@ -78,7 +78,7 @@ test_expect_success 'git whatchanged -p --root' 'cmp whatchanged.expect whatchan git tag my-first-tag test_expect_success 'git tag my-first-tag' 'cmp .git/refs/heads/master .git/refs/tags/my-first-tag' -# TODO: test git-clone +# TODO: test git clone git checkout -b mybranch test_expect_success 'git checkout -b mybranch' 'cmp .git/refs/heads/master .git/refs/heads/mybranch' diff --git a/t/t1303-wacky-config.sh b/t/t1303-wacky-config.sh index f98f4c517..1983076c7 100755 --- a/t/t1303-wacky-config.sh +++ b/t/t1303-wacky-config.sh @@ -35,7 +35,7 @@ test_expect_success 'add key in different section' ' ' SECTION="test.q\"s\\sq'sp e.key" -test_expect_success 'make sure git-config escapes section names properly' ' +test_expect_success 'make sure git config escapes section names properly' ' git config "$SECTION" bar && check "$SECTION" bar ' diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index b31e4b1ac..04c2b164b 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -228,21 +228,21 @@ test_expect_success \ 'echo TEST >F && git add F && GIT_AUTHOR_DATE="2005-05-26 23:30" \ - GIT_COMMITTER_DATE="2005-05-26 23:30" git-commit -m add -a && + GIT_COMMITTER_DATE="2005-05-26 23:30" git commit -m add -a && h_TEST=$(git rev-parse --verify HEAD) echo The other day this did not work. >M && echo And then Bob told me how to fix it. >>M && echo OTHER >F && GIT_AUTHOR_DATE="2005-05-26 23:41" \ - GIT_COMMITTER_DATE="2005-05-26 23:41" git-commit -F M -a && + GIT_COMMITTER_DATE="2005-05-26 23:41" git commit -F M -a && h_OTHER=$(git rev-parse --verify HEAD) && GIT_AUTHOR_DATE="2005-05-26 23:44" \ - GIT_COMMITTER_DATE="2005-05-26 23:44" git-commit --amend && + GIT_COMMITTER_DATE="2005-05-26 23:44" git commit --amend && h_FIXED=$(git rev-parse --verify HEAD) && echo Merged initial commit and a later commit. >M && echo $h_TEST >.git/MERGE_HEAD && GIT_AUTHOR_DATE="2005-05-26 23:45" \ - GIT_COMMITTER_DATE="2005-05-26 23:45" git-commit -F M && + GIT_COMMITTER_DATE="2005-05-26 23:45" git commit -F M && h_MERGED=$(git rev-parse --verify HEAD) && rm -f M' @@ -253,7 +253,7 @@ $h_OTHER $h_FIXED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151040 +0000 co $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000 commit (merge): Merged initial commit and a later commit. EOF test_expect_success \ - 'git-commit logged updates' \ + 'git commit logged updates' \ "diff expect .git/logs/$m" unset h_TEST h_OTHER h_FIXED h_MERGED diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh index 2ee88d8a0..c039ee3fd 100755 --- a/t/t1501-worktree.sh +++ b/t/t1501-worktree.sh @@ -28,6 +28,7 @@ test_rev_parse() { [ $# -eq 0 ] && return } +EMPTY_TREE=$(git write-tree) mkdir -p work/sub/dir || exit 1 mv .git repo.git || exit 1 @@ -106,12 +107,71 @@ test_expect_success 'repo finds its work tree from work tree, too' ' ' test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' ' - cd repo.git/work/sub/dir && + (cd repo.git/work/sub/dir && GIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \ git diff --exit-code tracked && echo changed > tracked && ! GIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \ - git diff --exit-code tracked + git diff --exit-code tracked) +' +cat > diff-index-cached.expected <<\EOF +:000000 100644 0000000000000000000000000000000000000000 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A sub/dir/tracked +EOF +cat > diff-index.expected <<\EOF +:000000 100644 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 A sub/dir/tracked +EOF + + +test_expect_success 'git diff-index' ' + GIT_DIR=repo.git GIT_WORK_TREE=repo.git/work git diff-index $EMPTY_TREE > result && + test_cmp diff-index.expected result && + GIT_DIR=repo.git git diff-index --cached $EMPTY_TREE > result && + test_cmp diff-index-cached.expected result +' +cat >diff-files.expected <<\EOF +:100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M sub/dir/tracked +EOF + +test_expect_success 'git diff-files' ' + GIT_DIR=repo.git GIT_WORK_TREE=repo.git/work git diff-files > result && + test_cmp diff-files.expected result +' + +cat >diff-TREE.expected <<\EOF +diff --git a/sub/dir/tracked b/sub/dir/tracked +new file mode 100644 +index 0000000..5ea2ed4 +--- /dev/null ++++ b/sub/dir/tracked +@@ -0,0 +1 @@ ++changed +EOF +cat >diff-TREE-cached.expected <<\EOF +diff --git a/sub/dir/tracked b/sub/dir/tracked +new file mode 100644 +index 0000000..e69de29 +EOF +cat >diff-FILES.expected <<\EOF +diff --git a/sub/dir/tracked b/sub/dir/tracked +index e69de29..5ea2ed4 100644 +--- a/sub/dir/tracked ++++ b/sub/dir/tracked +@@ -0,0 +1 @@ ++changed +EOF + +test_expect_success 'git diff' ' + GIT_DIR=repo.git GIT_WORK_TREE=repo.git/work git diff $EMPTY_TREE > result && + test_cmp diff-TREE.expected result && + GIT_DIR=repo.git git diff --cached $EMPTY_TREE > result && + test_cmp diff-TREE-cached.expected result && + GIT_DIR=repo.git GIT_WORK_TREE=repo.git/work git diff > result && + test_cmp diff-FILES.expected result +' + +test_expect_success 'git grep' ' + (cd repo.git/work/sub && + GIT_DIR=../.. GIT_WORK_TREE=.. git grep -l changed | grep -q dir/tracked) ' test_done diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh index 95244c9bc..cc6539494 100755 --- a/t/t1503-rev-parse-verify.sh +++ b/t/t1503-rev-parse-verify.sh @@ -23,7 +23,7 @@ add_line_into_file() fi test_tick - git-commit --quiet -m "$MSG" $_file + git commit --quiet -m "$MSG" $_file } HASH1= diff --git a/t/t2005-checkout-index-symlinks.sh b/t/t2005-checkout-index-symlinks.sh index a84c5a6af..ed12c4d78 100755 --- a/t/t2005-checkout-index-symlinks.sh +++ b/t/t2005-checkout-index-symlinks.sh @@ -13,7 +13,7 @@ file if core.symlinks is false.' test_expect_success \ 'preparation' ' git config core.symlinks false && -l=$(echo -n file | git-hash-object -t blob -w --stdin) && +l=$(echo -n file | git hash-object -t blob -w --stdin) && echo "120000 $l symlink" | git update-index --index-info' test_expect_success \ @@ -23,6 +23,6 @@ test -f symlink' test_expect_success \ 'the file must be the blob we added during the setup' ' -test "$(git-hash-object -t blob symlink)" = $l' +test "$(git hash-object -t blob symlink)" = $l' test_done diff --git a/t/t2050-git-dir-relative.sh b/t/t2050-git-dir-relative.sh index 88f268b9d..b7131d8c0 100755 --- a/t/t2050-git-dir-relative.sh +++ b/t/t2050-git-dir-relative.sh @@ -26,8 +26,8 @@ chmod +x .git/hooks/post-commit' test_expect_success 'post-commit hook used ordinarily' ' echo initial >top && -git-add top -git-commit -m initial && +git add top +git commit -m initial && test -r "${COMMIT_FILE}" ' diff --git a/t/t2101-update-index-reupdate.sh b/t/t2101-update-index-reupdate.sh index 59b560bfd..648184fd9 100755 --- a/t/t2101-update-index-reupdate.sh +++ b/t/t2101-update-index-reupdate.sh @@ -40,7 +40,7 @@ test_expect_success 'update-index --remove --again' \ git ls-files -s >current && cmp current expected' -test_expect_success 'first commit' 'git-commit -m initial' +test_expect_success 'first commit' 'git commit -m initial' cat > expected <<\EOF 100644 53ab446c3f4e42ce9bb728a0ccb283a101be4979 0 dir1/file3 diff --git a/t/t2102-update-index-symlinks.sh b/t/t2102-update-index-symlinks.sh index 19d0894d2..f195aefe3 100755 --- a/t/t2102-update-index-symlinks.sh +++ b/t/t2102-update-index-symlinks.sh @@ -13,7 +13,7 @@ even if a plain file is in the working tree if core.symlinks is false.' test_expect_success \ 'preparation' ' git config core.symlinks false && -l=$(echo -n file | git-hash-object -t blob -w --stdin) && +l=$(echo -n file | git hash-object -t blob -w --stdin) && echo "120000 $l symlink" | git update-index --index-info' test_expect_success \ diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh index f57a6e077..cd9231cf6 100755 --- a/t/t2200-add-update.sh +++ b/t/t2200-add-update.sh @@ -26,7 +26,7 @@ test_expect_success setup ' echo initial >dir2/sub3 && git add check dir1 dir2 top foo && test_tick - git-commit -m initial && + git commit -m initial && echo changed >check && echo changed >top && @@ -40,20 +40,20 @@ test_expect_success update ' ' test_expect_success 'update noticed a removal' ' - test "$(git-ls-files dir1/sub1)" = "" + test "$(git ls-files dir1/sub1)" = "" ' test_expect_success 'update touched correct path' ' - test "$(git-diff-files --name-status dir2/sub3)" = "" + test "$(git diff-files --name-status dir2/sub3)" = "" ' test_expect_success 'update did not touch other tracked files' ' - test "$(git-diff-files --name-status check)" = "M check" && - test "$(git-diff-files --name-status top)" = "M top" + test "$(git diff-files --name-status check)" = "M check" && + test "$(git diff-files --name-status top)" = "M top" ' test_expect_success 'update did not touch untracked files' ' - test "$(git-ls-files dir2/other)" = "" + test "$(git ls-files dir2/other)" = "" ' test_expect_success 'cache tree has not been corrupted' ' diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh index 1caeacafa..8666946b0 100755 --- a/t/t3001-ls-files-others-exclude.sh +++ b/t/t3001-ls-files-others-exclude.sh @@ -96,7 +96,7 @@ cat > expect << EOF # three/ EOF -test_expect_success 'git-status honours core.excludesfile' \ +test_expect_success 'git status honors core.excludesfile' \ 'test_cmp expect output' test_expect_success 'trailing slash in exclude allows directory match(1)' ' diff --git a/t/t3020-ls-files-error-unmatch.sh b/t/t3020-ls-files-error-unmatch.sh index af8c4121a..f4066cbc0 100755 --- a/t/t3020-ls-files-error-unmatch.sh +++ b/t/t3020-ls-files-error-unmatch.sh @@ -13,7 +13,7 @@ line. touch foo bar git update-index --add foo bar -git-commit -m "add foo bar" +git commit -m "add foo bar" test_expect_success \ 'git ls-files --error-unmatch should fail with unmatched path.' \ diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh index aff360303..de0cdb1cf 100755 --- a/t/t3030-merge-recursive.sh +++ b/t/t3030-merge-recursive.sh @@ -241,7 +241,7 @@ test_expect_success 'merge-recursive simple' ' rm -fr [abcd] && git checkout -f "$c2" && - git-merge-recursive "$c0" -- "$c2" "$c1" + git merge-recursive "$c0" -- "$c2" "$c1" status=$? case "$status" in 1) @@ -269,12 +269,23 @@ test_expect_success 'merge-recursive result' ' ' +test_expect_success 'fail if the index has unresolved entries' ' + + rm -fr [abcd] && + git checkout -f "$c1" && + + test_must_fail git merge "$c5" && + test_must_fail git merge "$c5" 2> out && + grep "You are in the middle of a conflicted merge" out + +' + test_expect_success 'merge-recursive remove conflict' ' rm -fr [abcd] && git checkout -f "$c1" && - git-merge-recursive "$c0" -- "$c1" "$c5" + git merge-recursive "$c0" -- "$c1" "$c5" status=$? case "$status" in 1) @@ -306,7 +317,7 @@ test_expect_success 'merge-recursive d/f simple' ' git reset --hard && git checkout -f "$c1" && - git-merge-recursive "$c0" -- "$c1" "$c3" + git merge-recursive "$c0" -- "$c1" "$c3" ' test_expect_success 'merge-recursive result' ' @@ -328,7 +339,7 @@ test_expect_success 'merge-recursive d/f conflict' ' git reset --hard && git checkout -f "$c1" && - git-merge-recursive "$c0" -- "$c1" "$c4" + git merge-recursive "$c0" -- "$c1" "$c4" status=$? case "$status" in 1) @@ -362,7 +373,7 @@ test_expect_success 'merge-recursive d/f conflict the other way' ' git reset --hard && git checkout -f "$c4" && - git-merge-recursive "$c0" -- "$c4" "$c1" + git merge-recursive "$c0" -- "$c4" "$c1" status=$? case "$status" in 1) @@ -396,7 +407,7 @@ test_expect_success 'merge-recursive d/f conflict' ' git reset --hard && git checkout -f "$c1" && - git-merge-recursive "$c0" -- "$c1" "$c6" + git merge-recursive "$c0" -- "$c1" "$c6" status=$? case "$status" in 1) @@ -430,7 +441,7 @@ test_expect_success 'merge-recursive d/f conflict' ' git reset --hard && git checkout -f "$c6" && - git-merge-recursive "$c0" -- "$c6" "$c1" + git merge-recursive "$c0" -- "$c6" "$c1" status=$? case "$status" in 1) diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 7a83fbfe4..2147eacc5 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -14,10 +14,10 @@ test_expect_success \ 'prepare a trivial repository' \ 'echo Hello > A && git update-index --add A && - git-commit -m "Initial commit." && + git commit -m "Initial commit." && echo World >> A && git update-index --add A && - git-commit -m "Second commit." && + git commit -m "Second commit." && HEAD=$(git rev-parse --verify HEAD)' test_expect_success \ @@ -123,7 +123,7 @@ test_expect_success \ test_expect_success 'test tracking setup via --track' \ 'git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --track my1 local/master && test $(git config branch.my1.remote) = local && test $(git config branch.my1.merge) = refs/heads/master' @@ -131,7 +131,7 @@ test_expect_success 'test tracking setup via --track' \ test_expect_success 'test tracking setup (non-wildcard, matching)' \ 'git config remote.local.url . && git config remote.local.fetch refs/heads/master:refs/remotes/local/master && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --track my4 local/master && test $(git config branch.my4.remote) = local && test $(git config branch.my4.merge) = refs/heads/master' @@ -139,7 +139,7 @@ test_expect_success 'test tracking setup (non-wildcard, matching)' \ test_expect_success 'test tracking setup (non-wildcard, not matching)' \ 'git config remote.local.url . && git config remote.local.fetch refs/heads/s:refs/remotes/local/s && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --track my5 local/master && ! test "$(git config branch.my5.remote)" = local && ! test "$(git config branch.my5.merge)" = refs/heads/master' @@ -148,7 +148,7 @@ test_expect_success 'test tracking setup via config' \ 'git config branch.autosetupmerge true && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch my3 local/master && test $(git config branch.my3.remote) = local && test $(git config branch.my3.merge) = refs/heads/master' @@ -157,7 +157,7 @@ test_expect_success 'test overriding tracking setup via --no-track' \ 'git config branch.autosetupmerge true && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --no-track my2 local/master && git config branch.autosetupmerge false && ! test "$(git config branch.my2.remote)" = local && @@ -173,7 +173,7 @@ test_expect_success 'no tracking without .fetch entries' \ test_expect_success 'test tracking setup via --track but deeper' \ 'git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/o/o || git-fetch local) && + (git show-ref -q refs/remotes/local/o/o || git fetch local) && git branch --track my7 local/o/o && test "$(git config branch.my7.remote)" = local && test "$(git config branch.my7.merge)" = refs/heads/o/o' @@ -209,7 +209,7 @@ EOF test_expect_success \ 'git checkout -b g/h/i -l should create a branch and a log' \ 'GIT_COMMITTER_DATE="2005-05-26 23:30" \ - git-checkout -b g/h/i -l master && + git checkout -b g/h/i -l master && test -f .git/refs/heads/g/h/i && test -f .git/logs/refs/heads/g/h/i && diff expect .git/logs/refs/heads/g/h/i' @@ -228,7 +228,7 @@ test_expect_success 'autosetuprebase local on a tracked local branch' ' git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config branch.autosetuprebase local && - (git show-ref -q refs/remotes/local/o || git-fetch local) && + (git show-ref -q refs/remotes/local/o || git fetch local) && git branch mybase && git branch --track myr1 mybase && test "$(git config branch.myr1.remote)" = . && @@ -240,7 +240,7 @@ test_expect_success 'autosetuprebase always on a tracked local branch' ' git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config branch.autosetuprebase always && - (git show-ref -q refs/remotes/local/o || git-fetch local) && + (git show-ref -q refs/remotes/local/o || git fetch local) && git branch mybase2 && git branch --track myr2 mybase && test "$(git config branch.myr2.remote)" = . && @@ -252,7 +252,7 @@ test_expect_success 'autosetuprebase remote on a tracked local branch' ' git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config branch.autosetuprebase remote && - (git show-ref -q refs/remotes/local/o || git-fetch local) && + (git show-ref -q refs/remotes/local/o || git fetch local) && git branch mybase3 && git branch --track myr3 mybase2 && test "$(git config branch.myr3.remote)" = . && @@ -264,7 +264,7 @@ test_expect_success 'autosetuprebase never on a tracked local branch' ' git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config branch.autosetuprebase never && - (git show-ref -q refs/remotes/local/o || git-fetch local) && + (git show-ref -q refs/remotes/local/o || git fetch local) && git branch mybase4 && git branch --track myr4 mybase2 && test "$(git config branch.myr4.remote)" = . && @@ -276,7 +276,7 @@ test_expect_success 'autosetuprebase local on a tracked remote branch' ' git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config branch.autosetuprebase local && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --track myr5 local/master && test "$(git config branch.myr5.remote)" = local && test "$(git config branch.myr5.merge)" = refs/heads/master && @@ -287,7 +287,7 @@ test_expect_success 'autosetuprebase never on a tracked remote branch' ' git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config branch.autosetuprebase never && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --track myr6 local/master && test "$(git config branch.myr6.remote)" = local && test "$(git config branch.myr6.merge)" = refs/heads/master && @@ -298,7 +298,7 @@ test_expect_success 'autosetuprebase remote on a tracked remote branch' ' git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config branch.autosetuprebase remote && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --track myr7 local/master && test "$(git config branch.myr7.remote)" = local && test "$(git config branch.myr7.merge)" = refs/heads/master && @@ -309,7 +309,7 @@ test_expect_success 'autosetuprebase always on a tracked remote branch' ' git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && git config branch.autosetuprebase remote && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --track myr8 local/master && test "$(git config branch.myr8.remote)" = local && test "$(git config branch.myr8.merge)" = refs/heads/master && @@ -320,7 +320,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' ' git config --unset branch.autosetuprebase && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --track myr9 local/master && test "$(git config branch.myr9.remote)" = local && test "$(git config branch.myr9.merge)" = refs/heads/master && @@ -330,7 +330,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked remote branch' ' test_expect_success 'autosetuprebase unconfigured on a tracked local branch' ' git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/o || git-fetch local) && + (git show-ref -q refs/remotes/local/o || git fetch local) && git branch mybase10 && git branch --track myr10 mybase2 && test "$(git config branch.myr10.remote)" = . && @@ -341,7 +341,7 @@ test_expect_success 'autosetuprebase unconfigured on a tracked local branch' ' test_expect_success 'autosetuprebase unconfigured on untracked local branch' ' git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --no-track myr11 mybase2 && test "z$(git config branch.myr11.remote)" = z && test "z$(git config branch.myr11.merge)" = z && @@ -351,7 +351,7 @@ test_expect_success 'autosetuprebase unconfigured on untracked local branch' ' test_expect_success 'autosetuprebase unconfigured on untracked remote branch' ' git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --no-track myr12 local/master && test "z$(git config branch.myr12.remote)" = z && test "z$(git config branch.myr12.merge)" = z && @@ -362,7 +362,7 @@ test_expect_success 'autosetuprebase never on an untracked local branch' ' git config branch.autosetuprebase never && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --no-track myr13 mybase2 && test "z$(git config branch.myr13.remote)" = z && test "z$(git config branch.myr13.merge)" = z && @@ -373,7 +373,7 @@ test_expect_success 'autosetuprebase local on an untracked local branch' ' git config branch.autosetuprebase local && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --no-track myr14 mybase2 && test "z$(git config branch.myr14.remote)" = z && test "z$(git config branch.myr14.merge)" = z && @@ -384,7 +384,7 @@ test_expect_success 'autosetuprebase remote on an untracked local branch' ' git config branch.autosetuprebase remote && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --no-track myr15 mybase2 && test "z$(git config branch.myr15.remote)" = z && test "z$(git config branch.myr15.merge)" = z && @@ -395,7 +395,7 @@ test_expect_success 'autosetuprebase always on an untracked local branch' ' git config branch.autosetuprebase always && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --no-track myr16 mybase2 && test "z$(git config branch.myr16.remote)" = z && test "z$(git config branch.myr16.merge)" = z && @@ -406,7 +406,7 @@ test_expect_success 'autosetuprebase never on an untracked remote branch' ' git config branch.autosetuprebase never && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --no-track myr17 local/master && test "z$(git config branch.myr17.remote)" = z && test "z$(git config branch.myr17.merge)" = z && @@ -417,7 +417,7 @@ test_expect_success 'autosetuprebase local on an untracked remote branch' ' git config branch.autosetuprebase local && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --no-track myr18 local/master && test "z$(git config branch.myr18.remote)" = z && test "z$(git config branch.myr18.merge)" = z && @@ -428,7 +428,7 @@ test_expect_success 'autosetuprebase remote on an untracked remote branch' ' git config branch.autosetuprebase remote && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --no-track myr19 local/master && test "z$(git config branch.myr19.remote)" = z && test "z$(git config branch.myr19.merge)" = z && @@ -439,7 +439,7 @@ test_expect_success 'autosetuprebase always on an untracked remote branch' ' git config branch.autosetuprebase always && git config remote.local.url . && git config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git show-ref -q refs/remotes/local/master || git-fetch local) && + (git show-ref -q refs/remotes/local/master || git fetch local) && git branch --no-track myr20 local/master && test "z$(git config branch.myr20.remote)" = z && test "z$(git config branch.myr20.merge)" = z && diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh index c2dec1c63..087ef7506 100755 --- a/t/t3210-pack-refs.sh +++ b/t/t3210-pack-refs.sh @@ -17,7 +17,7 @@ test_expect_success \ 'prepare a trivial repository' \ 'echo Hello > A && git update-index --add A && - git-commit -m "Initial commit." && + git commit -m "Initial commit." && HEAD=$(git rev-parse --verify HEAD)' SHA1= @@ -97,7 +97,7 @@ test_expect_success \ git branch n' test_expect_success 'pack, prune and repack' ' - git-tag foo && + git tag foo && git pack-refs --all --prune && git show-ref >all-of-them && git pack-refs && diff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh index 0574ef1f1..db46d53e8 100755 --- a/t/t3300-funny-names.sh +++ b/t/t3300-funny-names.sh @@ -21,7 +21,7 @@ cat >"$p0" <<\EOF 3. A quick brown fox jumps over the lazy cat, oops dog. EOF -cat >"$p1" "$p0" +cat 2>/dev/null >"$p1" "$p0" echo 'Foo Bar Baz' >"$p2" test -f "$p1" && cmp "$p0" "$p1" || { diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index 91bb5e1d9..b7a670ef4 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -16,15 +16,15 @@ test_expect_success \ 'prepare repository with topic branches' \ 'echo First > A && git update-index --add A && - git-commit -m "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." && + git commit -m "Add B." && git checkout -f master && echo Third >> A && git update-index A && - git-commit -m "Modify A." && + git commit -m "Modify A." && git checkout -b side my-topic-branch && echo Side >> C && git add C && diff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh index 166ddb144..aea668598 100755 --- a/t/t3401-rebase-partial.sh +++ b/t/t3401-rebase-partial.sh @@ -15,29 +15,29 @@ test_expect_success \ 'prepare repository with topic branch' \ 'echo First > A && git update-index --add A && - git-commit -m "Add A." && + git commit -m "Add A." && - git-checkout -b my-topic-branch && + git checkout -b my-topic-branch && echo Second > B && git update-index --add B && - git-commit -m "Add B." && + git commit -m "Add B." && echo AnotherSecond > C && git update-index --add C && - git-commit -m "Add C." && + git commit -m "Add C." && - git-checkout -f master && + git checkout -f master && echo Third >> A && git update-index A && - git-commit -m "Modify 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 && + git checkout -f my-topic-branch && git branch master-merge master && git branch my-topic-branch-merge my-topic-branch ' @@ -49,13 +49,13 @@ test_debug \ ' test_expect_success \ - 'rebase topic branch against new master and check git-am did not get halted' \ - 'git-rebase master && test ! -d .git/rebase-apply' + 'rebase topic branch against new master and check git am did not get halted' \ + 'git rebase master && test ! -d .git/rebase-apply' test_expect_success \ 'rebase --merge topic branch that was partially merged upstream' \ - 'git-checkout -f my-topic-branch-merge && - git-rebase --merge master-merge && + 'git checkout -f my-topic-branch-merge && + git rebase --merge master-merge && test ! -d .git/rebase-merge' test_done diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh index 0d33c71da..64446e3db 100755 --- a/t/t3403-rebase-skip.sh +++ b/t/t3403-rebase-skip.sh @@ -7,7 +7,7 @@ test_description='git rebase --merge --skip tests' . ./test-lib.sh -# we assume the default git-am -3 --skip strategy is tested independently +# we assume the default git am -3 --skip strategy is tested independently # and always works :) test_expect_success setup ' diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 5aa487ac0..e0ded197e 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -161,7 +161,7 @@ test_expect_success 'stop on conflicting pick' ' test "$(git rev-parse HEAD~3)" = "$(git rev-parse master)" && test_cmp expect .git/rebase-merge/patch && test_cmp expect2 file1 && - test "$(git-diff --name-status | + test "$(git diff --name-status | sed -n -e "/^U/s/^U[^a-z]*//p")" = file1 && test 4 = $(grep -v "^#" < .git/rebase-merge/done | wc -l) && test 0 = $(grep -c "^[^#]" < .git/rebase-merge/git-rebase-todo) diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh index 4de550a63..2999e7893 100755 --- a/t/t3407-rebase-abort.sh +++ b/t/t3407-rebase-abort.sh @@ -52,7 +52,7 @@ testrebase() { test -d "$dotest" && test_must_fail git rebase --skip && test $(git rev-parse HEAD) = $(git rev-parse master) && - git-rebase --abort && + git rebase --abort && test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) && test ! -d "$dotest" ' diff --git a/t/t3500-cherry.sh b/t/t3500-cherry.sh index 4911c4837..dadbbc2a9 100755 --- a/t/t3500-cherry.sh +++ b/t/t3500-cherry.sh @@ -17,25 +17,25 @@ 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 commit -m "Add A." && - git-checkout -b my-topic-branch && + git checkout -b my-topic-branch && echo Second > B && git update-index --add B && - git-commit -m "Add B." && + git commit -m "Add B." && sleep 2 && echo AnotherSecond > C && git update-index --add C && - git-commit -m "Add C." && + git commit -m "Add C." && - git-checkout -f master && + git checkout -f master && rm -f B C && echo Third >> A && git update-index A && - git-commit -m "Modify A." && + git commit -m "Modify A." && expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* + .*" ' diff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh new file mode 100755 index 000000000..f7b3518a3 --- /dev/null +++ b/t/t3504-cherry-pick-rerere.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +test_description='cherry-pick should rerere for conflicts' + +. ./test-lib.sh + +test_expect_success setup ' + echo foo >foo && + git add foo && test_tick && git commit -q -m 1 && + echo foo-master >foo && + git add foo && test_tick && git commit -q -m 2 && + + git checkout -b dev HEAD^ && + echo foo-dev >foo && + git add foo && test_tick && git commit -q -m 3 && + git config rerere.enabled true +' + +test_expect_success 'conflicting merge' ' + test_must_fail git merge master +' + +test_expect_success 'fixup' ' + echo foo-dev >foo && + git add foo && test_tick && git commit -q -m 4 && + git reset --hard HEAD^ + echo foo-dev >expect +' + +test_expect_success 'cherry-pick conflict' ' + test_must_fail git cherry-pick master && + test_cmp expect foo +' + +test_expect_success 'reconfigure' ' + git config rerere.enabled false + git reset --hard +' + +test_expect_success 'cherry-pick conflict without rerere' ' + test_must_fail git cherry-pick master && + test_must_fail test_cmp expect foo +' + +test_done diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index 79c06adf1..558c80edb 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -12,14 +12,14 @@ test_expect_success \ 'Initialize test directory' \ "touch -- foo bar baz 'space embedded' -q && git add -- foo bar baz 'space embedded' -q && - git-commit -m 'add normal files' && + git commit -m 'add normal files' && test_tabs=y && if touch -- 'tab embedded' 'newline embedded' then git add -- 'tab embedded' 'newline embedded' && - git-commit -m 'add files with tabs and newlines' + git commit -m 'add files with tabs and newlines' else say 'Your filesystem does not allow tabs in filenames.' test_tabs=n diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh index c851db8ca..6fb027ba5 100755 --- a/t/t3800-mktag.sh +++ b/t/t3800-mktag.sh @@ -2,7 +2,7 @@ # # -test_description='git-mktag: tag object verify test' +test_description='git mktag: tag object verify test' . ./test-lib.sh @@ -14,7 +14,7 @@ test_description='git-mktag: tag object verify test' check_verify_failure () { expect="$2" test_expect_success "$1" ' - ( test_must_fail git-mktag <tag.sig 2>message ) && + ( test_must_fail git mktag <tag.sig 2>message ) && grep "$expect" message ' } @@ -24,7 +24,7 @@ check_verify_failure () { # for the tag. echo Hello >A git update-index --add A -git-commit -m "Initial commit" +git commit -m "Initial commit" head=$(git rev-parse --verify HEAD) ############################################################ @@ -222,7 +222,7 @@ EOF test_expect_success \ 'allow empty tag email' \ - 'git-mktag <tag.sig >.git/refs/tags/mytag 2>message' + 'git mktag <tag.sig >.git/refs/tags/mytag 2>message' ############################################################ # 16. disallow spaces in tag email @@ -350,14 +350,14 @@ EOF test_expect_success \ 'create valid tag' \ - 'git-mktag <tag.sig >.git/refs/tags/mytag 2>message' + 'git mktag <tag.sig >.git/refs/tags/mytag 2>message' ############################################################ # 25. check mytag test_expect_success \ 'check mytag' \ - 'git-tag -l | grep mytag' + 'git tag -l | grep mytag' test_done diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh index 883281dbd..784c31aec 100755 --- a/t/t3900-i18n-commit.sh +++ b/t/t3900-i18n-commit.sh @@ -16,9 +16,9 @@ test_expect_success setup ' : >F && git add F && T=$(git write-tree) && - C=$(git commit-tree $T <../t3900/1-UTF-8.txt) && + C=$(git commit-tree $T <"$TEST_DIRECTORY"/t3900/1-UTF-8.txt) && git update-ref HEAD $C && - git-tag C0 + git tag C0 ' test_expect_success 'no encoding header for base case' ' @@ -30,9 +30,9 @@ for H in ISO-8859-1 EUCJP ISO-2022-JP do test_expect_success "$H setup" ' git config i18n.commitencoding $H && - git-checkout -b $H C0 && + git checkout -b $H C0 && echo $H >F && - git-commit -a -F ../t3900/$H.txt + git commit -a -F "$TEST_DIRECTORY"/t3900/$H.txt ' done @@ -57,13 +57,13 @@ test_expect_success 'config to remove customization' ' ' test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' ' - compare_with ISO-8859-1 ../t3900/1-UTF-8.txt + compare_with ISO-8859-1 "$TEST_DIRECTORY"/t3900/1-UTF-8.txt ' for H in EUCJP ISO-2022-JP do test_expect_success "$H should be shown in UTF-8 now" ' - compare_with '$H' ../t3900/2-UTF-8.txt + compare_with '$H' "$TEST_DIRECTORY"/t3900/2-UTF-8.txt ' done @@ -82,7 +82,7 @@ for H in ISO-8859-1 EUCJP ISO-2022-JP do test_expect_success "$H should be shown in itself now" ' git config i18n.commitencoding '$H' && - compare_with '$H' ../t3900/'$H'.txt + compare_with '$H' "$TEST_DIRECTORY"/t3900/'$H'.txt ' done @@ -91,13 +91,13 @@ test_expect_success 'config to tweak customization' ' ' test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' ' - compare_with ISO-8859-1 ../t3900/1-UTF-8.txt + compare_with ISO-8859-1 "$TEST_DIRECTORY"/t3900/1-UTF-8.txt ' for H in EUCJP ISO-2022-JP do test_expect_success "$H should be shown in UTF-8 now" ' - compare_with '$H' ../t3900/2-UTF-8.txt + compare_with '$H' "$TEST_DIRECTORY"/t3900/2-UTF-8.txt ' done @@ -107,7 +107,7 @@ do for H in EUCJP ISO-2022-JP do test_expect_success "$H should be shown in $J now" ' - compare_with '$H' ../t3900/'$J'.txt + compare_with '$H' "$TEST_DIRECTORY"/t3900/'$J'.txt ' done done @@ -115,7 +115,7 @@ done for H in ISO-8859-1 EUCJP ISO-2022-JP do test_expect_success "No conversion with $H" ' - compare_with "--encoding=none '$H'" ../t3900/'$H'.txt + compare_with "--encoding=none '$H'" "$TEST_DIRECTORY"/t3900/'$H'.txt ' done diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh index 235f37283..7655da3f8 100755 --- a/t/t3901-i18n-patch.sh +++ b/t/t3901-i18n-patch.sh @@ -35,7 +35,7 @@ test_expect_success setup ' # use UTF-8 in author and committer name to match the # i18n.commitencoding settings - . ../t3901-utf8.txt && + . "$TEST_DIRECTORY"/t3901-utf8.txt && test_tick && echo "$GIT_AUTHOR_NAME" >mine && @@ -57,7 +57,7 @@ test_expect_success setup ' # the second one on the side branch is ISO-8859-1 git config i18n.commitencoding ISO-8859-1 && # use author and committer name in ISO-8859-1 to match it. - . ../t3901-8859-1.txt && + . "$TEST_DIRECTORY"/t3901-8859-1.txt && test_tick && echo Yet another >theirs && git add theirs && @@ -101,9 +101,9 @@ test_expect_success 'rebase (U/U)' ' # The result will be committed by GIT_COMMITTER_NAME -- # we want UTF-8 encoded name. - . ../t3901-utf8.txt && + . "$TEST_DIRECTORY"/t3901-utf8.txt && git checkout -b test && - git-rebase master && + git rebase master && check_encoding 2 ' @@ -111,10 +111,10 @@ test_expect_success 'rebase (U/U)' ' test_expect_success 'rebase (U/L)' ' git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding ISO-8859-1 && - . ../t3901-utf8.txt && + . "$TEST_DIRECTORY"/t3901-utf8.txt && git reset --hard side && - git-rebase master && + git rebase master && check_encoding 2 ' @@ -123,10 +123,10 @@ test_expect_success 'rebase (L/L)' ' # In this test we want ISO-8859-1 encoded commits as the result git config i18n.commitencoding ISO-8859-1 && git config i18n.logoutputencoding ISO-8859-1 && - . ../t3901-8859-1.txt && + . "$TEST_DIRECTORY"/t3901-8859-1.txt && git reset --hard side && - git-rebase master && + git rebase master && check_encoding 2 8859 ' @@ -136,10 +136,10 @@ test_expect_success 'rebase (L/U)' ' # to get ISO-8859-1 results. git config i18n.commitencoding ISO-8859-1 && git config i18n.logoutputencoding UTF-8 && - . ../t3901-8859-1.txt && + . "$TEST_DIRECTORY"/t3901-8859-1.txt && git reset --hard side && - git-rebase master && + git rebase master && check_encoding 2 8859 ' @@ -149,7 +149,7 @@ test_expect_success 'cherry-pick(U/U)' ' git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding UTF-8 && - . ../t3901-utf8.txt && + . "$TEST_DIRECTORY"/t3901-utf8.txt && git reset --hard master && git cherry-pick side^ && @@ -164,7 +164,7 @@ test_expect_success 'cherry-pick(L/L)' ' git config i18n.commitencoding ISO-8859-1 && git config i18n.logoutputencoding ISO-8859-1 && - . ../t3901-8859-1.txt && + . "$TEST_DIRECTORY"/t3901-8859-1.txt && git reset --hard master && git cherry-pick side^ && @@ -179,7 +179,7 @@ test_expect_success 'cherry-pick(U/L)' ' git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding ISO-8859-1 && - . ../t3901-utf8.txt && + . "$TEST_DIRECTORY"/t3901-utf8.txt && git reset --hard master && git cherry-pick side^ && @@ -195,7 +195,7 @@ test_expect_success 'cherry-pick(L/U)' ' git config i18n.commitencoding ISO-8859-1 && git config i18n.logoutputencoding UTF-8 && - . ../t3901-8859-1.txt && + . "$TEST_DIRECTORY"/t3901-8859-1.txt && git reset --hard master && git cherry-pick side^ && @@ -208,10 +208,10 @@ test_expect_success 'cherry-pick(L/U)' ' test_expect_success 'rebase --merge (U/U)' ' git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding UTF-8 && - . ../t3901-utf8.txt && + . "$TEST_DIRECTORY"/t3901-utf8.txt && git reset --hard side && - git-rebase --merge master && + git rebase --merge master && check_encoding 2 ' @@ -219,10 +219,10 @@ test_expect_success 'rebase --merge (U/U)' ' test_expect_success 'rebase --merge (U/L)' ' git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding ISO-8859-1 && - . ../t3901-utf8.txt && + . "$TEST_DIRECTORY"/t3901-utf8.txt && git reset --hard side && - git-rebase --merge master && + git rebase --merge master && check_encoding 2 ' @@ -231,10 +231,10 @@ test_expect_success 'rebase --merge (L/L)' ' # In this test we want ISO-8859-1 encoded commits as the result git config i18n.commitencoding ISO-8859-1 && git config i18n.logoutputencoding ISO-8859-1 && - . ../t3901-8859-1.txt && + . "$TEST_DIRECTORY"/t3901-8859-1.txt && git reset --hard side && - git-rebase --merge master && + git rebase --merge master && check_encoding 2 8859 ' @@ -244,10 +244,10 @@ test_expect_success 'rebase --merge (L/U)' ' # to get ISO-8859-1 results. git config i18n.commitencoding ISO-8859-1 && git config i18n.logoutputencoding UTF-8 && - . ../t3901-8859-1.txt && + . "$TEST_DIRECTORY"/t3901-8859-1.txt && git reset --hard side && - git-rebase --merge master && + git rebase --merge master && check_encoding 2 8859 ' diff --git a/t/t3902-quoted.sh b/t/t3902-quoted.sh index fe4fb5116..586805242 100755 --- a/t/t3902-quoted.sh +++ b/t/t3902-quoted.sh @@ -7,12 +7,6 @@ test_description='quoted output' . ./test-lib.sh -P1='pathname with HT' -: >"$P1" 2>&1 && test -f "$P1" && rm -f "$P1" || { - echo >&2 'Filesystem does not support HT in names' - test_done -} - FN='濱野' GN='純' HT=' ' @@ -20,7 +14,7 @@ LF=' ' DQ='"' -echo foo > "Name and an${HT}HT" +echo foo 2>/dev/null > "Name and an${HT}HT" test -f "Name and an${HT}HT" || { # since FAT/NTFS does not allow tabs in filenames, skip this test say 'Your filesystem does not allow tabs in filenames, test skipped.' diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index 8d4804b65..7484cbede 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Johannes E Schindelin # -test_description='Test git-stash' +test_description='Test git stash' . ./test-lib.sh diff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh index c44b27aeb..6ddd46915 100755 --- a/t/t4000-diff-format.sh +++ b/t/t4000-diff-format.sh @@ -7,7 +7,7 @@ test_description='Test built-in diff output engine. ' . ./test-lib.sh -. ../diff-lib.sh +. "$TEST_DIRECTORY"/diff-lib.sh echo >path0 'Line 1 Line 2 diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh index a32692417..71bac83dd 100755 --- a/t/t4001-diff-rename.sh +++ b/t/t4001-diff-rename.sh @@ -7,7 +7,7 @@ test_description='Test rename detection in diff engine. ' . ./test-lib.sh -. ../diff-lib.sh +. "$TEST_DIRECTORY"/diff-lib.sh echo >path0 'Line 1 Line 2 diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh index a4cfde6b2..cc3681f16 100755 --- a/t/t4002-diff-basic.sh +++ b/t/t4002-diff-basic.sh @@ -7,7 +7,7 @@ test_description='Test diff raw-output. ' . ./test-lib.sh -. ../lib-read-tree-m-3way.sh +. "$TEST_DIRECTORY"/lib-read-tree-m-3way.sh cat >.test-plain-OA <<\EOF :000000 100644 0000000000000000000000000000000000000000 ccba72ad3888a3520b39efcf780b9ee64167535d A AA @@ -169,6 +169,20 @@ test_expect_success \ cmp -s .test-a .test-recursive-AB' test_expect_success \ + 'diff-tree --stdin of known trees.' \ + 'echo $tree_A $tree_B | git diff-tree --stdin > .test-a && + echo $tree_A $tree_B > .test-plain-ABx && + cat .test-plain-AB >> .test-plain-ABx && + cmp -s .test-a .test-plain-ABx' + +test_expect_success \ + 'diff-tree --stdin of known trees.' \ + 'echo $tree_A $tree_B | git diff-tree -r --stdin > .test-a && + echo $tree_A $tree_B > .test-recursive-ABx && + cat .test-recursive-AB >> .test-recursive-ABx && + cmp -s .test-a .test-recursive-ABx' + +test_expect_success \ 'diff-cache O with A in cache' \ 'git read-tree $tree_A && git diff-index --cached $tree_O >.test-a && diff --git a/t/t4003-diff-rename-1.sh b/t/t4003-diff-rename-1.sh index 8b1f87528..c6130c401 100755 --- a/t/t4003-diff-rename-1.sh +++ b/t/t4003-diff-rename-1.sh @@ -7,11 +7,11 @@ test_description='More rename detection ' . ./test-lib.sh -. ../diff-lib.sh ;# test-lib chdir's into trash +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash test_expect_success \ 'prepare reference tree' \ - 'cat ../../COPYING >COPYING && + 'cat "$TEST_DIRECTORY"/../COPYING >COPYING && echo frotz >rezrov && git update-index --add COPYING rezrov && tree=$(git write-tree) && @@ -99,7 +99,7 @@ test_expect_success \ test_expect_success \ 'prepare work tree once again' \ - 'cat ../../COPYING >COPYING && + 'cat "$TEST_DIRECTORY"/../COPYING >COPYING && git update-index --add --remove COPYING COPYING.1' # tree has COPYING and rezrov. work tree has COPYING and COPYING.1, diff --git a/t/t4004-diff-rename-symlink.sh b/t/t4004-diff-rename-symlink.sh index 3d25be7a6..b35af9b42 100755 --- a/t/t4004-diff-rename-symlink.sh +++ b/t/t4004-diff-rename-symlink.sh @@ -10,7 +10,7 @@ copy of symbolic links, but should not produce rename/copy followed by an edit for them. ' . ./test-lib.sh -. ../diff-lib.sh +. "$TEST_DIRECTORY"/diff-lib.sh test_expect_success \ 'prepare reference tree' \ diff --git a/t/t4005-diff-rename-2.sh b/t/t4005-diff-rename-2.sh index 663001731..1ba359d47 100755 --- a/t/t4005-diff-rename-2.sh +++ b/t/t4005-diff-rename-2.sh @@ -7,11 +7,11 @@ test_description='Same rename detection as t4003 but testing diff-raw. ' . ./test-lib.sh -. ../diff-lib.sh ;# test-lib chdir's into trash +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash test_expect_success \ 'prepare reference tree' \ - 'cat ../../COPYING >COPYING && + 'cat "$TEST_DIRECTORY"/../COPYING >COPYING && echo frotz >rezrov && git update-index --add COPYING rezrov && tree=$(git write-tree) && @@ -71,7 +71,7 @@ test_expect_success \ test_expect_success \ 'prepare work tree once again' \ - 'cat ../../COPYING >COPYING && + 'cat "$TEST_DIRECTORY"/../COPYING >COPYING && git update-index --add --remove COPYING COPYING.1' git diff-index -C --find-copies-harder $tree >current diff --git a/t/t4007-rename-3.sh b/t/t4007-rename-3.sh index 104a4e149..42072d724 100755 --- a/t/t4007-rename-3.sh +++ b/t/t4007-rename-3.sh @@ -7,12 +7,12 @@ test_description='Rename interaction with pathspec. ' . ./test-lib.sh -. ../diff-lib.sh ;# test-lib chdir's into trash +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash test_expect_success \ 'prepare reference tree' \ 'mkdir path0 path1 && - cp ../../COPYING path0/COPYING && + cp "$TEST_DIRECTORY"/../COPYING path0/COPYING && git update-index --add path0/COPYING && tree=$(git write-tree) && echo $tree' diff --git a/t/t4008-diff-break-rewrite.sh b/t/t4008-diff-break-rewrite.sh index 26c2e4aa6..7e343a9cd 100755 --- a/t/t4008-diff-break-rewrite.sh +++ b/t/t4008-diff-break-rewrite.sh @@ -22,12 +22,12 @@ four changes in total. Further, with -B and -M together, these should turn into two renames. ' . ./test-lib.sh -. ../diff-lib.sh ;# test-lib chdir's into trash +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash test_expect_success \ setup \ - 'cat ../../README >file0 && - cat ../../COPYING >file1 && + 'cat "$TEST_DIRECTORY"/../README >file0 && + cat "$TEST_DIRECTORY"/../COPYING >file1 && git update-index --add file0 file1 && tree=$(git write-tree) && echo "$tree"' diff --git a/t/t4009-diff-rename-4.sh b/t/t4009-diff-rename-4.sh index d2b45e7b8..de3f17478 100755 --- a/t/t4009-diff-rename-4.sh +++ b/t/t4009-diff-rename-4.sh @@ -7,11 +7,11 @@ test_description='Same rename detection as t4003 but testing diff-raw -z. ' . ./test-lib.sh -. ../diff-lib.sh ;# test-lib chdir's into trash +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash test_expect_success \ 'prepare reference tree' \ - 'cat ../../COPYING >COPYING && + 'cat "$TEST_DIRECTORY"/../COPYING >COPYING && echo frotz >rezrov && git update-index --add COPYING rezrov && tree=$(git write-tree) && @@ -78,7 +78,7 @@ test_expect_success \ test_expect_success \ 'prepare work tree once again' \ - 'cat ../../COPYING >COPYING && + 'cat "$TEST_DIRECTORY"/../COPYING >COPYING && git update-index --add --remove COPYING COPYING.1' git diff-index -z -C --find-copies-harder $tree >current diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh index ad3d9e484..9322298ec 100755 --- a/t/t4010-diff-pathspec.sh +++ b/t/t4010-diff-pathspec.sh @@ -10,7 +10,7 @@ Prepare: path1/file1 ' . ./test-lib.sh -. ../diff-lib.sh ;# test-lib chdir's into trash +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash test_expect_success \ setup \ diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh index c6d13693b..02efecae3 100755 --- a/t/t4011-diff-symlink.sh +++ b/t/t4011-diff-symlink.sh @@ -7,7 +7,7 @@ test_description='Test diff of symlinks. ' . ./test-lib.sh -. ../diff-lib.sh +. "$TEST_DIRECTORY"/diff-lib.sh cat > expected << EOF diff --git a/frotz b/frotz diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh index eced1f30f..b8ec6e90a 100755 --- a/t/t4012-diff-binary.sh +++ b/t/t4012-diff-binary.sh @@ -12,7 +12,7 @@ test_expect_success 'prepare repository' \ 'echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d && git update-index --add a b c d && echo git >a && - cat ../test4012.png >b && + cat "$TEST_DIRECTORY"/test4012.png >b && echo git >c && cat b b >d' @@ -61,7 +61,7 @@ test_expect_success 'apply detecting corrupt patch correctly' \ detected=`sed -ne "${detected}p" broken` && test "$detected" = xCIT' -test_expect_success 'initial commit' 'git-commit -a -m initial' +test_expect_success 'initial commit' 'git commit -a -m initial' # Try removal (b), modification (d), and creation (e). test_expect_success 'diff-index with --binary' \ @@ -72,7 +72,7 @@ test_expect_success 'diff-index with --binary' \ git apply --stat --summary current' test_expect_success 'apply binary patch' \ - 'git-reset --hard && + 'git reset --hard && git apply --binary --index <current && tree1=`git write-tree` && test "$tree1" = "$tree0"' diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 9337b8106..1a6b52234 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -99,7 +99,7 @@ do test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'` cnt=`expr $test_count + 1` pfx=`printf "%04d" $cnt` - expect="../t4013/diff.$test" + expect="$TEST_DIRECTORY/t4013/diff.$test" actual="$pfx-diff.$test" test_expect_success "git $cmd" ' diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 7fe853c20..9d99dc288 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -230,4 +230,29 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' ' ' +cat > expect << EOF +--- + file | 16 ++++++++++++++++ + 1 files changed, 16 insertions(+), 0 deletions(-) + +diff --git a/file b/file +index 40f36c6..2dc5c23 100644 +--- a/file ++++ b/file +@@ -13,4 +13,20 @@ C + 10 + D + E + F ++5 +EOF + +test_expect_success 'format-patch respects -U' ' + + git format-patch -U4 -2 && + sed -e "1,/^$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output && + test_cmp expect output + +' + test_done diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh index a27fccc8d..fc2307eaa 100755 --- a/t/t4015-diff-whitespace.sh +++ b/t/t4015-diff-whitespace.sh @@ -7,7 +7,7 @@ test_description='Test special whitespace in diff engine. ' . ./test-lib.sh -. ../diff-lib.sh +. "$TEST_DIRECTORY"/diff-lib.sh # Ray Lehtiniemi's example @@ -341,4 +341,31 @@ test_expect_success 'checkdiff detects trailing blank lines' ' git diff --check | grep "ends with blank" ' +test_expect_success 'checkdiff allows new blank lines' ' + git checkout x && + mv x y && + ( + echo "/* This is new */" && + echo "" && + cat y + ) >x && + git diff --check +' + +test_expect_success 'combined diff with autocrlf conversion' ' + + git reset --hard && + echo >x hello && + git commit -m "one side" x && + git checkout HEAD^ && + echo >x goodbye && + git commit -m "the other side" x && + git config core.autocrlf true && + test_must_fail git merge master && + + git diff | sed -e "1,/^@@@/d" >actual && + ! grep "^-" actual + +' + test_done diff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh index f07035ab7..55eb5f83f 100755 --- a/t/t4016-diff-quote.sh +++ b/t/t4016-diff-quote.sh @@ -13,8 +13,8 @@ P1='pathname with HT' P2='pathname with SP' P3='pathname with LF' -: >"$P1" 2>&1 && test -f "$P1" && rm -f "$P1" || { - echo >&2 'Filesystem does not support tabs in names' +: 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" || { + say 'Your filesystem does not allow tabs in filenames, test skipped.' test_done } diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh index 7eae1f450..84a1fe311 100755 --- a/t/t4019-diff-wserror.sh +++ b/t/t4019-diff-wserror.sh @@ -178,4 +178,16 @@ test_expect_success 'trailing empty lines (2)' ' ' +test_expect_success 'do not color trailing cr in context' ' + git config --unset core.whitespace + rm -f .gitattributes && + echo AAAQ | tr Q "\015" >G && + git add G && + echo BBBQ | tr Q "\015" >>G + git diff --color G | tr "\015" Q >output && + grep "BBB.*${blue_grep}Q" output && + grep "AAA.*\[mQ" output + +' + test_done diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh index 637b4e19d..dfe3fbc74 100755 --- a/t/t4020-diff-external.sh +++ b/t/t4020-diff-external.sh @@ -104,7 +104,7 @@ echo NULZbetweenZwords | perl -pe 'y/Z/\000/' > file test_expect_success 'force diff with "diff"' ' echo >.gitattributes "file diff" && git diff >actual && - test_cmp ../t4020/diff.NUL actual + test_cmp "$TEST_DIRECTORY"/t4020/diff.NUL actual ' test_done diff --git a/t/t4022-diff-rewrite.sh b/t/t4022-diff-rewrite.sh index bf996fc41..2a537a21e 100755 --- a/t/t4022-diff-rewrite.sh +++ b/t/t4022-diff-rewrite.sh @@ -6,12 +6,12 @@ test_description='rewrite diff' test_expect_success setup ' - cat ../../COPYING >test && + cat "$TEST_DIRECTORY"/../COPYING >test && git add test && tr \ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \ "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM" \ - <../../COPYING >test + <"$TEST_DIRECTORY"/../COPYING >test ' diff --git a/t/t4023-diff-rename-typechange.sh b/t/t4023-diff-rename-typechange.sh index 4dbfc6e8b..297ddb5a2 100755 --- a/t/t4023-diff-rename-typechange.sh +++ b/t/t4023-diff-rename-typechange.sh @@ -7,21 +7,21 @@ test_description='typechange rename detection' test_expect_success setup ' rm -f foo bar && - cat ../../COPYING >foo && + cat "$TEST_DIRECTORY"/../COPYING >foo && ln -s linklink bar && git add foo bar && git commit -a -m Initial && git tag one && rm -f foo bar && - cat ../../COPYING >bar && + cat "$TEST_DIRECTORY"/../COPYING >bar && ln -s linklink foo && git add foo bar && git commit -a -m Second && git tag two && rm -f foo bar && - cat ../../COPYING >foo && + cat "$TEST_DIRECTORY"/../COPYING >foo && git add foo && git commit -a -m Third && git tag three && @@ -35,15 +35,15 @@ test_expect_success setup ' # This is purely for sanity check rm -f foo bar && - cat ../../COPYING >foo && - cat ../../Makefile >bar && + cat "$TEST_DIRECTORY"/../COPYING >foo && + cat "$TEST_DIRECTORY"/../Makefile >bar && git add foo bar && git commit -a -m Fifth && git tag five && rm -f foo bar && - cat ../../Makefile >foo && - cat ../../COPYING >bar && + cat "$TEST_DIRECTORY"/../Makefile >foo && + cat "$TEST_DIRECTORY"/../COPYING >bar && git add foo bar && git commit -a -m Sixth && git tag six diff --git a/t/t4027-diff-submodule.sh b/t/t4027-diff-submodule.sh index ba6679c6e..1c2edebb0 100755 --- a/t/t4027-diff-submodule.sh +++ b/t/t4027-diff-submodule.sh @@ -3,7 +3,7 @@ test_description='difference in submodules' . ./test-lib.sh -. ../diff-lib.sh +. "$TEST_DIRECTORY"/diff-lib.sh _z40=0000000000000000000000000000000000000000 test_expect_success setup ' diff --git a/t/t4029-diff-trailing-space.sh b/t/t4029-diff-trailing-space.sh new file mode 100755 index 000000000..4ca65e033 --- /dev/null +++ b/t/t4029-diff-trailing-space.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Copyright (c) Jim Meyering +# +test_description='diff honors config option, diff.suppress-blank-empty' + +. ./test-lib.sh + +cat <<\EOF > exp || +diff --git a/f b/f +index 5f6a263..8cb8bae 100644 +--- a/f ++++ b/f +@@ -1,2 +1,2 @@ + +-x ++y +EOF +exit 1 + +test_expect_success \ + "$test_description" \ + 'printf "\nx\n" > f && + git add f && + git commit -q -m. f && + printf "\ny\n" > f && + git config --bool diff.suppress-blank-empty true && + git diff f > actual && + test_cmp exp actual && + perl -i.bak -p -e "s/^\$/ /" exp && + git config --bool diff.suppress-blank-empty false && + git diff f > actual && + test_cmp exp actual && + git config --bool --unset diff.suppress-blank-empty && + git diff f > actual && + test_cmp exp actual + ' + +test_done diff --git a/t/t4100-apply-stat.sh b/t/t4100-apply-stat.sh index e0c67740a..9b433de83 100755 --- a/t/t4100-apply-stat.sh +++ b/t/t4100-apply-stat.sh @@ -17,13 +17,13 @@ do test_expect_success "$title" ' git apply --stat --summary \ <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" >current && - test_cmp ../t4100/t-apply-$num.expect current + test_cmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current ' test_expect_success "$title with recount" ' sed -e "$UNC" <"$TEST_DIRECTORY/t4100/t-apply-$num.patch" | git apply --recount --stat --summary >current && - test_cmp ../t4100/t-apply-$num.expect current + test_cmp "$TEST_DIRECTORY"/t4100/t-apply-$num.expect current ' done <<\EOF rename diff --git a/t/t4101-apply-nonl.sh b/t/t4101-apply-nonl.sh index da8abcf36..e3443d004 100755 --- a/t/t4101-apply-nonl.sh +++ b/t/t4101-apply-nonl.sh @@ -21,9 +21,10 @@ do do test $i -eq $j && continue cat frotz.$i >frotz - test_expect_success \ - "apply diff between $i and $j" \ - "git apply <../t4101/diff.$i-$j && diff frotz.$j frotz" + test_expect_success "apply diff between $i and $j" ' + git apply <"$TEST_DIRECTORY"/t4101/diff.$i-$j && + test_cmp frotz.$j frotz + ' done done diff --git a/t/t4103-apply-binary.sh b/t/t4103-apply-binary.sh index 7da0b4bb8..ad4cc1a75 100755 --- a/t/t4103-apply-binary.sh +++ b/t/t4103-apply-binary.sh @@ -21,16 +21,16 @@ cat file1 >file2 cat file1 >file4 git update-index --add --remove file1 file2 file4 -git-commit -m 'Initial Version' 2>/dev/null +git commit -m 'Initial Version' 2>/dev/null -git-checkout -b binary +git checkout -b binary perl -pe 'y/x/\000/' <file1 >file3 cat file3 >file4 git add file2 perl -pe 'y/\000/v/' <file3 >file1 rm -f file2 git update-index --add --remove file1 file2 file3 file4 -git-commit -m 'Second Version' +git commit -m 'Second Version' git diff-tree -p master binary >B.diff git diff-tree -p -C master binary >C.diff @@ -39,47 +39,47 @@ git diff-tree -p --binary master binary >BF.diff git diff-tree -p --binary -C master binary >CF.diff test_expect_success 'stat binary diff -- should not fail.' \ - 'git-checkout master + 'git checkout master git apply --stat --summary B.diff' test_expect_success 'stat binary diff (copy) -- should not fail.' \ - 'git-checkout master + 'git checkout master git apply --stat --summary C.diff' test_expect_success 'check binary diff -- should fail.' \ - 'git-checkout master && + 'git checkout master && test_must_fail git apply --check B.diff' test_expect_success 'check binary diff (copy) -- should fail.' \ - 'git-checkout master && + 'git checkout master && test_must_fail git apply --check C.diff' test_expect_success \ 'check incomplete binary diff with replacement -- should fail.' ' - git-checkout master && + git checkout master && test_must_fail git apply --check --allow-binary-replacement B.diff ' test_expect_success \ 'check incomplete binary diff with replacement (copy) -- should fail.' ' - git-checkout master && + git checkout master && test_must_fail git apply --check --allow-binary-replacement C.diff ' test_expect_success 'check binary diff with replacement.' \ - 'git-checkout master + 'git checkout master git apply --check --allow-binary-replacement BF.diff' test_expect_success 'check binary diff with replacement (copy).' \ - 'git-checkout master + 'git checkout master git apply --check --allow-binary-replacement CF.diff' # Now we start applying them. do_reset () { rm -f file? && - git-reset --hard && - git-checkout -f master + git reset --hard && + git checkout -f master } test_expect_success 'apply binary diff -- should fail.' \ diff --git a/t/t4104-apply-boundary.sh b/t/t4104-apply-boundary.sh index e7e2913de..0e3ce3611 100755 --- a/t/t4104-apply-boundary.sh +++ b/t/t4104-apply-boundary.sh @@ -27,6 +27,15 @@ test_expect_success setup ' git diff victim >add-a-patch.with && git diff --unified=0 >add-a-patch.without && + : insert at line two + for i in b a '"$L"' y + do + echo $i + done >victim && + cat victim >insert-a-expect && + git diff victim >insert-a-patch.with && + git diff --unified=0 >insert-a-patch.without && + : modify at the head for i in a '"$L"' y do @@ -55,7 +64,7 @@ test_expect_success setup ' git diff --unified=0 >add-z-patch.without && : modify at the tail - for i in a '"$L"' y + for i in b '"$L"' z do echo $i done >victim && @@ -81,7 +90,7 @@ do with) u= ;; without) u='--unidiff-zero ' ;; esac - for kind in add-a add-z mod-a mod-z del-a del-z + for kind in add-a add-z insert-a mod-a mod-z del-a del-z do test_expect_success "apply $kind-patch $with context" ' cat original >victim && @@ -95,7 +104,7 @@ do done done -for kind in add-a add-z mod-a mod-z del-a del-z +for kind in add-a add-z insert-a mod-a mod-z del-a del-z do rm -f $kind-ng.without sed -e "s/^diff --git /diff /" \ diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh index 85f3da2b9..f83322e51 100755 --- a/t/t4124-apply-ws-rule.sh +++ b/t/t4124-apply-ws-rule.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='core.whitespace rules and git-apply' +test_description='core.whitespace rules and git apply' . ./test-lib.sh diff --git a/t/t4127-apply-same-fn.sh b/t/t4127-apply-same-fn.sh index 1f859dd90..3a8202ea9 100755 --- a/t/t4127-apply-same-fn.sh +++ b/t/t4127-apply-same-fn.sh @@ -26,7 +26,7 @@ test_expect_success 'apply same filename with independent changes' ' git diff >> patch0 && cp same_fn same_fn2 && git reset --hard && - git-apply patch0 && + git apply patch0 && diff same_fn same_fn2 ' @@ -39,7 +39,7 @@ test_expect_success 'apply same filename with overlapping changes' ' git diff >> patch0 && cp same_fn same_fn2 && git reset --hard && - git-apply patch0 && + git apply patch0 && diff same_fn same_fn2 ' diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 6e6aaf593..1be5fb3f9 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -164,7 +164,7 @@ test_expect_success 'am --keep really keeps the subject' ' git checkout HEAD^ && git am --keep patch4 && ! test -d .git/rebase-apply && - git-cat-file commit HEAD | + git cat-file commit HEAD | grep -q -F "Re: Re: Re: [PATCH 1/5 v2] third" ' diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh index 7d86cdff6..4448aba7e 100755 --- a/t/t4151-am-abort.sh +++ b/t/t4151-am-abort.sh @@ -44,14 +44,14 @@ do ' test_expect_success "am$with3 --skip continue after failed am$with3" ' - test_must_fail git-am$with3 --skip >output && + test_must_fail git am$with3 --skip >output && test "$(grep "^Applying" output)" = "Applying: 6" && test_cmp file-2-expect file-2 && test ! -f .git/rr-cache/MERGE_RR ' test_expect_success "am --abort goes back after failed am$with3" ' - git-am --abort && + git am --abort && git rev-parse HEAD >actual && git rev-parse initial >expect && test_cmp expect actual && diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 4c8af45f8..0ab925c4e 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -69,7 +69,29 @@ test_expect_success 'diff-filter=D' ' ' +test_expect_success 'setup case sensitivity tests' ' + echo case >one && + test_tick && + git commit -a -m Second +' + +test_expect_success 'log --grep' ' + echo second >expect && + git log -1 --pretty="tformat:%s" --grep=sec >actual && + test_cmp expect actual +' +test_expect_success 'log -i --grep' ' + echo Second >expect && + git log -1 --pretty="tformat:%s" -i --grep=sec >actual && + test_cmp expect actual +' + +test_expect_success 'log --grep -i' ' + echo Second >expect && + git log -1 --pretty="tformat:%s" --grep=sec -i >actual && + test_cmp expect actual +' test_done diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh index 8dfaddda9..fe1458942 100755 --- a/t/t5100-mailinfo.sh +++ b/t/t5100-mailinfo.sh @@ -8,27 +8,28 @@ test_description='git mailinfo and git mailsplit test' . ./test-lib.sh test_expect_success 'split sample box' \ - 'git mailsplit -o. ../t5100/sample.mbox >last && + 'git mailsplit -o. "$TEST_DIRECTORY"/t5100/sample.mbox >last && last=`cat last` && echo total is $last && test `cat last` = 11' for mail in `echo 00*` do - test_expect_success "mailinfo $mail" \ - "git mailinfo -u msg$mail patch$mail <$mail >info$mail && + test_expect_success "mailinfo $mail" ' + git mailinfo -u msg$mail patch$mail <$mail >info$mail && echo msg && - diff ../t5100/msg$mail msg$mail && + test_cmp "$TEST_DIRECTORY"/t5100/msg$mail msg$mail && echo patch && - diff ../t5100/patch$mail patch$mail && + test_cmp "$TEST_DIRECTORY"/t5100/patch$mail patch$mail && echo info && - diff ../t5100/info$mail info$mail" + test_cmp "$TEST_DIRECTORY"/t5100/info$mail info$mail + ' done test_expect_success 'respect NULs' ' - git mailsplit -d3 -o. ../t5100/nul-plain && - cmp ../t5100/nul-plain 001 && + git mailsplit -d3 -o. "$TEST_DIRECTORY"/t5100/nul-plain && + test_cmp "$TEST_DIRECTORY"/t5100/nul-plain 001 && (cat 001 | git mailinfo msg patch) && test 4 = $(wc -l < patch) @@ -36,10 +37,21 @@ test_expect_success 'respect NULs' ' test_expect_success 'Preserve NULs out of MIME encoded message' ' - git mailsplit -d5 -o. ../t5100/nul-b64.in && - cmp ../t5100/nul-b64.in 00001 && + git mailsplit -d5 -o. "$TEST_DIRECTORY"/t5100/nul-b64.in && + test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.in 00001 && git mailinfo msg patch <00001 && - cmp ../t5100/nul-b64.expect patch + test_cmp "$TEST_DIRECTORY"/t5100/nul-b64.expect patch + +' + +test_expect_success 'mailinfo on from header without name works' ' + + mkdir info-from && + git mailsplit -oinfo-from "$TEST_DIRECTORY"/t5100/info-from.in && + test_cmp "$TEST_DIRECTORY"/t5100/info-from.in info-from/0001 && + git mailinfo info-from/msg info-from/patch \ + <info-from/0001 >info-from/out && + test_cmp "$TEST_DIRECTORY"/t5100/info-from.expect info-from/out ' diff --git a/t/t5100/info-from.expect b/t/t5100/info-from.expect new file mode 100644 index 000000000..c31d2eb55 --- /dev/null +++ b/t/t5100/info-from.expect @@ -0,0 +1,5 @@ +Author: bare@example.com +Email: bare@example.com +Subject: testing bare address in from header +Date: Sun, 25 May 2008 00:38:18 -0700 + diff --git a/t/t5100/info-from.in b/t/t5100/info-from.in new file mode 100644 index 000000000..4f082093f --- /dev/null +++ b/t/t5100/info-from.in @@ -0,0 +1,8 @@ +From 667d8940e719cddee1cfe237cbbe215e20270b09 Mon Sep 17 00:00:00 2001 +From: bare@example.com +Date: Sun, 25 May 2008 00:38:18 -0700 +Subject: [PATCH] testing bare address in from header + +commit message +--- +patch diff --git a/t/t5100/sample.mbox b/t/t5100/sample.mbox index d7ca79b1f..4bf7947b4 100644 --- a/t/t5100/sample.mbox +++ b/t/t5100/sample.mbox @@ -500,3 +500,4 @@ index 3e5fe51..aabfe5c 100644 1.6.0.rc2 --=-=-=-- + diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 645583f9d..3a0ef8759 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-pack-object +test_description='git pack-object ' . ./test-lib.sh @@ -187,6 +187,12 @@ test_expect_success \ test-3-${packname_3}.idx' test_expect_success \ + 'verify pack -v' \ + 'git verify-pack -v test-1-${packname_1}.idx \ + test-2-${packname_2}.idx \ + test-3-${packname_3}.idx' + +test_expect_success \ 'verify-pack catches mismatched .idx and .pack files' \ 'cat test-1-${packname_1}.idx >test-3.idx && cat test-2-${packname_2}.pack >test-3.pack && @@ -236,24 +242,24 @@ test_expect_success \ test_expect_success \ 'build pack index for an existing pack' \ 'cat test-1-${packname_1}.pack >test-3.pack && - git-index-pack -o tmp.idx test-3.pack && + git index-pack -o tmp.idx test-3.pack && cmp tmp.idx test-1-${packname_1}.idx && - git-index-pack test-3.pack && + git index-pack test-3.pack && cmp test-3.idx test-1-${packname_1}.idx && cat test-2-${packname_2}.pack >test-3.pack && - git-index-pack -o tmp.idx test-2-${packname_2}.pack && + git index-pack -o tmp.idx test-2-${packname_2}.pack && cmp tmp.idx test-2-${packname_2}.idx && - git-index-pack test-3.pack && + git index-pack test-3.pack && cmp test-3.idx test-2-${packname_2}.idx && cat test-3-${packname_3}.pack >test-3.pack && - git-index-pack -o tmp.idx test-3-${packname_3}.pack && + git index-pack -o tmp.idx test-3-${packname_3}.pack && cmp tmp.idx test-3-${packname_3}.idx && - git-index-pack test-3.pack && + git index-pack test-3.pack && cmp test-3.idx test-3-${packname_3}.idx && :' @@ -266,7 +272,7 @@ test_expect_success \ test_expect_success \ 'make sure index-pack detects the SHA1 collision' \ - 'test_must_fail git-index-pack -o bad.idx test-3.pack' + 'test_must_fail git index-pack -o bad.idx test-3.pack' test_expect_success \ 'honor pack.packSizeLimit' \ diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh index 073ac0c6f..0a24e61ff 100755 --- a/t/t5301-sliding-window.sh +++ b/t/t5301-sliding-window.sh @@ -19,7 +19,7 @@ test_expect_success \ tree=`git write-tree` && commit1=`git commit-tree $tree </dev/null` && git update-ref HEAD $commit1 && - git-repack -a -d && + git repack -a -d && test "`git count-objects`" = "0 objects, 0 kilobytes" && pack1=`ls .git/objects/pack/*.pack` && test -f "$pack1"' @@ -45,7 +45,7 @@ test_expect_success \ git config core.packedGitLimit 512 && commit2=`git commit-tree $tree -p $commit1 </dev/null` && git update-ref HEAD $commit2 && - git-repack -a -d && + git repack -a -d && test "`git count-objects`" = "0 objects, 0 kilobytes" && pack2=`ls .git/objects/pack/*.pack` && test -f "$pack2" diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh index 0639772ac..6424db1f2 100755 --- a/t/t5302-pack-index.sh +++ b/t/t5302-pack-index.sh @@ -48,11 +48,11 @@ test_expect_success \ test_expect_success \ 'index-pack with index version 1' \ - 'git-index-pack --index-version=1 -o 1.idx "test-1-${pack1}.pack"' + 'git index-pack --index-version=1 -o 1.idx "test-1-${pack1}.pack"' test_expect_success \ 'index-pack with index version 2' \ - 'git-index-pack --index-version=2 -o 2.idx "test-1-${pack1}.pack"' + 'git index-pack --index-version=2 -o 2.idx "test-1-${pack1}.pack"' test_expect_success \ 'index-pack results should match pack-objects ones' \ @@ -85,7 +85,7 @@ test_expect_success \ test "$have_64bits" && test_expect_success \ 'index v2: force some 64-bit offsets with index-pack' \ - 'git-index-pack --index-version=2,0x40000 -o 3.idx "test-1-${pack1}.pack"' + 'git index-pack --index-version=2,0x40000 -o 3.idx "test-1-${pack1}.pack"' test "$have_64bits" && test_expect_success \ @@ -94,7 +94,7 @@ test_expect_success \ test_expect_success \ '[index v1] 1) stream pack to repository' \ - 'git-index-pack --index-version=1 --stdin < "test-1-${pack1}.pack" && + 'git index-pack --index-version=1 --stdin < "test-1-${pack1}.pack" && git prune-packed && git count-objects | ( read nr rest && test "$nr" -eq 1 ) && cmp "test-1-${pack1}.pack" ".git/objects/pack/pack-${pack1}.pack" && @@ -132,7 +132,7 @@ test_expect_success \ test_expect_success \ '[index v2] 1) stream pack to repository' \ 'rm -f .git/objects/pack/* && - git-index-pack --index-version=2 --stdin < "test-1-${pack1}.pack" && + git index-pack --index-version=2 --stdin < "test-1-${pack1}.pack" && git prune-packed && git count-objects | ( read nr rest && test "$nr" -eq 1 ) && cmp "test-1-${pack1}.pack" ".git/objects/pack/pack-${pack1}.pack" && @@ -165,7 +165,7 @@ test_expect_success \ test_expect_success \ '[index v2] 6) verify-pack detects CRC mismatch' \ 'rm -f .git/objects/pack/* && - git-index-pack --index-version=2 --stdin < "test-1-${pack1}.pack" && + git index-pack --index-version=2 --stdin < "test-1-${pack1}.pack" && git verify-pack ".git/objects/pack/pack-${pack1}.pack" && chmod +w ".git/objects/pack/pack-${pack1}.idx" && dd if=/dev/zero of=".git/objects/pack/pack-${pack1}.idx" conv=notrunc \ diff --git a/t/t5305-include-tag.sh b/t/t5305-include-tag.sh index fb471a08c..b061864a8 100755 --- a/t/t5305-include-tag.sh +++ b/t/t5305-include-tag.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-pack-object --include-tag' +test_description='git pack-object --include-tag' . ./test-lib.sh TRASH=`pwd` diff --git a/t/t5306-pack-nobase.sh b/t/t5306-pack-nobase.sh new file mode 100755 index 000000000..f4931c0c2 --- /dev/null +++ b/t/t5306-pack-nobase.sh @@ -0,0 +1,80 @@ +#!/bin/sh +# +# Copyright (c) 2008 Google Inc. +# + +test_description='git-pack-object with missing base + +' +. ./test-lib.sh + +# Create A-B chain +# +test_expect_success \ + 'setup base' \ + 'for a in a b c d e f g h i; do echo $a >>text; done && + echo side >side && + git update-index --add text side && + A=$(echo A | git commit-tree $(git write-tree)) && + + echo m >>text && + git update-index text && + B=$(echo B | git commit-tree $(git write-tree) -p $A) && + git update-ref HEAD $B + ' + +# Create repository with C whose parent is B. +# Repository contains C, C^{tree}, C:text, B, B^{tree}. +# Repository is missing B:text (best delta base for C:text). +# Repository is missing A (parent of B). +# Repository is missing A:side. +# +test_expect_success \ + 'setup patch_clone' \ + 'base_objects=$(pwd)/.git/objects && + (mkdir patch_clone && + cd patch_clone && + git init && + echo "$base_objects" >.git/objects/info/alternates && + echo q >>text && + git read-tree $B && + git update-index text && + git update-ref HEAD $(echo C | git commit-tree $(git write-tree) -p $B) && + rm .git/objects/info/alternates && + + git --git-dir=../.git cat-file commit $B | + git hash-object -t commit -w --stdin && + + git --git-dir=../.git cat-file tree "$B^{tree}" | + git hash-object -t tree -w --stdin + ) && + C=$(git --git-dir=patch_clone/.git rev-parse HEAD) + ' + +# Clone patch_clone indirectly by cloning base and fetching. +# +test_expect_success \ + 'indirectly clone patch_clone' \ + '(mkdir user_clone && + cd user_clone && + git init && + git pull ../.git && + test $(git rev-parse HEAD) = $B && + + git pull ../patch_clone/.git && + test $(git rev-parse HEAD) = $C + ) + ' + +# Cloning the patch_clone directly should fail. +# +test_expect_success \ + 'clone of patch_clone is incomplete' \ + '(mkdir user_direct && + cd user_direct && + git init && + test_must_fail git fetch ../patch_clone/.git + ) + ' + +test_done diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh index 68c2ae688..544771d8f 100755 --- a/t/t5400-send-pack.sh +++ b/t/t5400-send-pack.sh @@ -31,7 +31,7 @@ test_expect_success setup ' parent=$commit || return 1 done && git update-ref HEAD "$commit" && - git-clone ./. victim && + git clone ./. victim && cd victim && git log && cd .. && @@ -68,7 +68,7 @@ test_expect_success 'pack the destination repository' ' test_expect_success \ 'pushing rewound head should not barf but require --force' ' # should not fail but refuse to update. - if git-send-pack ./victim/.git/ master + if git send-pack ./victim/.git/ master then # now it should fail with Pasky patch echo >&2 Gaah, it should have failed. @@ -85,7 +85,7 @@ test_expect_success \ true fi && # this should update - git-send-pack --force ./victim/.git/ master && + git send-pack --force ./victim/.git/ master && cmp victim/.git/refs/heads/master .git/refs/heads/master ' @@ -95,7 +95,7 @@ test_expect_success \ git branch extra master && cd .. && test -f victim/.git/refs/heads/extra && - git-send-pack ./victim/.git/ :extra master && + git send-pack ./victim/.git/ :extra master && ! test -f victim/.git/refs/heads/extra ' @@ -109,27 +109,27 @@ test_expect_success \ git config receive.denyNonFastforwards true && cd .. && git update-ref refs/heads/master master^ || return 1 - git-send-pack --force ./victim/.git/ master && return 1 + git send-pack --force ./victim/.git/ master && return 1 ! test_cmp .git/refs/heads/master victim/.git/refs/heads/master ' test_expect_success \ 'pushing does not include non-head refs' ' mkdir parent && cd parent && - git-init && touch file && git-add file && git-commit -m add && + git init && touch file && git add file && git commit -m add && cd .. && - git-clone parent child && cd child && git-push --all && + git clone parent child && cd child && git push --all && cd ../parent && - git-branch -a >branches && ! grep origin/master branches + git branch -a >branches && ! grep origin/master branches ' rewound_push_setup() { rm -rf parent child && mkdir parent && cd parent && - git-init && echo one >file && git-add file && git-commit -m one && - echo two >file && git-commit -a -m two && + git init && echo one >file && git add file && git commit -m one && + echo two >file && git commit -a -m two && cd .. && - git-clone parent child && cd child && git-reset --hard HEAD^ + git clone parent child && cd child && git reset --hard HEAD^ } rewound_push_succeeded() { @@ -148,26 +148,26 @@ rewound_push_failed() { test_expect_success \ 'pushing explicit refspecs respects forcing' ' rewound_push_setup && - if git-send-pack ../parent/.git refs/heads/master:refs/heads/master + if git send-pack ../parent/.git refs/heads/master:refs/heads/master then false else true fi && rewound_push_failed && - git-send-pack ../parent/.git +refs/heads/master:refs/heads/master && + git send-pack ../parent/.git +refs/heads/master:refs/heads/master && rewound_push_succeeded ' test_expect_success \ 'pushing wildcard refspecs respects forcing' ' rewound_push_setup && - if git-send-pack ../parent/.git refs/heads/*:refs/heads/* + if git send-pack ../parent/.git refs/heads/*:refs/heads/* then false else true fi && rewound_push_failed && - git-send-pack ../parent/.git +refs/heads/*:refs/heads/* && + git send-pack ../parent/.git +refs/heads/*:refs/heads/* && rewound_push_succeeded ' diff --git a/t/t5401-update-hooks.sh b/t/t5401-update-hooks.sh index ee769d669..64f66c94f 100755 --- a/t/t5401-update-hooks.sh +++ b/t/t5401-update-hooks.sh @@ -17,7 +17,7 @@ test_expect_success setup ' commit1=$(echo modify | git commit-tree $tree1 -p $commit0) && git update-ref refs/heads/master $commit0 && git update-ref refs/heads/tofail $commit1 && - git-clone ./. victim && + git clone ./. victim && GIT_DIR=victim/.git git update-ref refs/heads/tofail $commit1 && git update-ref refs/heads/master $commit1 && git update-ref refs/heads/tofail $commit0 @@ -61,7 +61,7 @@ EOF chmod u+x victim/.git/hooks/post-update test_expect_success push ' - test_must_fail git-send-pack --force ./victim/.git \ + test_must_fail git send-pack --force ./victim/.git \ master tofail >send.out 2>send.err ' diff --git a/t/t5402-post-merge-hook.sh b/t/t5402-post-merge-hook.sh index 1394047a8..6eb2ffd6e 100755 --- a/t/t5402-post-merge-hook.sh +++ b/t/t5402-post-merge-hook.sh @@ -16,9 +16,9 @@ test_expect_success setup ' tree1=$(git write-tree) && commit1=$(echo modify | git commit-tree $tree1 -p $commit0) && git update-ref refs/heads/master $commit0 && - git-clone ./. clone1 && + git clone ./. clone1 && GIT_DIR=clone1/.git git update-index --add a && - git-clone ./. clone2 && + git clone ./. clone2 && GIT_DIR=clone2/.git git update-index --add a ' diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh index 823239a25..9b2e1a94c 100755 --- a/t/t5403-post-checkout-hook.sh +++ b/t/t5403-post-checkout-hook.sh @@ -14,8 +14,8 @@ test_expect_success setup ' tree0=$(git write-tree) && commit0=$(echo setup | git commit-tree $tree0) && git update-ref refs/heads/master $commit0 && - git-clone ./. clone1 && - git-clone ./. clone2 && + git clone ./. clone1 && + git clone ./. clone2 && GIT_DIR=clone2/.git git branch -a new2 && echo Data for commit1. >clone2/b && GIT_DIR=clone2/.git git add clone2/b && diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 362cf7e92..c450f33f3 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -58,7 +58,7 @@ pull_to_client () { cd client test_expect_success "$number pull" \ - "git-fetch-pack -k -v .. $heads" + "git fetch-pack -k -v .. $heads" case "$heads" in *A*) echo $ATIP > .git/refs/heads/A;; esac case "$heads" in *B*) echo $BTIP > .git/refs/heads/B;; esac git symbolic-ref HEAD refs/heads/`echo $heads | sed -e 's/^\(.\).*$/\1/'` @@ -129,7 +129,7 @@ pull_to_client 2nd "B" $((64*3)) pull_to_client 3rd "A" $((1*3)) # old fails -test_expect_success "clone shallow" 'git-clone --depth 2 "file://$(pwd)/." shallow' +test_expect_success "clone shallow" 'git clone --depth 2 "file://$(pwd)/." shallow' (cd shallow; git count-objects -v) > count.shallow @@ -137,7 +137,7 @@ test_expect_success "clone shallow object count" \ "test \"in-pack: 18\" = \"$(grep in-pack count.shallow)\"" count_output () { - sed -e '/^in-pack:/d' -e '/^packs:/d' -e '/: 0$/d' "$1" + sed -e '/^in-pack:/d' -e '/^packs:/d' -e '/^size-pack:/d' -e '/: 0$/d' "$1" } test_expect_success "clone shallow object count (part 2)" ' diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh index be9ee9326..c4496635d 100755 --- a/t/t5505-remote.sh +++ b/t/t5505-remote.sh @@ -109,7 +109,7 @@ test_expect_success 'remove remote' ' cat > test/expect << EOF * remote origin - URL: $(pwd)/one/.git + URL: $(pwd)/one Remote branch merged with 'git pull' while on branch master master New remote branch (next fetch will store in remotes/origin) @@ -140,7 +140,7 @@ test_expect_success 'show' ' cat > test/expect << EOF * remote origin - URL: $(pwd)/one/.git + URL: $(pwd)/one Remote branch merged with 'git pull' while on branch master master Tracked remote branches @@ -169,7 +169,7 @@ test_expect_success 'prune' ' cat > test/expect << EOF Pruning origin -URL: $(pwd)/one/.git +URL: $(pwd)/one * [would prune] origin/side2 EOF diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 13d1d826c..de26c2032 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -111,7 +111,7 @@ test_expect_success 'fetch must not resolve short tag name' ' test_expect_success 'fetch must not resolve short remote name' ' cd "$D" && - git-update-ref refs/remotes/six/HEAD HEAD + git update-ref refs/remotes/six/HEAD HEAD mkdir six && cd six && diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh index 8becbc3f3..1f4608d8b 100755 --- a/t/t5515-fetch-merge-logic.sh +++ b/t/t5515-fetch-merge-logic.sh @@ -131,9 +131,9 @@ do test=`echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g'` cnt=`expr $test_count + 1` pfx=`printf "%04d" $cnt` - expect_f="../../t5515/fetch.$test" + expect_f="$TEST_DIRECTORY/t5515/fetch.$test" actual_f="$pfx-fetch.$test" - expect_r="../../t5515/refs.$test" + expect_r="$TEST_DIRECTORY/t5515/refs.$test" actual_r="$pfx-refs.$test" test_expect_success "$cmd" ' diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh index 1a15817cd..f5102b902 100755 --- a/t/t5530-upload-pack-error.sh +++ b/t/t5530-upload-pack-error.sh @@ -34,7 +34,7 @@ test_expect_success 'upload-pack fails due to error in pack-objects' ' ! echo "0032want $(git rev-parse HEAD) 00000009done -0000" | git-upload-pack . > /dev/null 2> output.err && +0000" | git upload-pack . > /dev/null 2> output.err && grep "pack-objects died" output.err ' @@ -52,7 +52,7 @@ test_expect_success 'upload-pack fails due to error in rev-list' ' ! echo "0032want $(git rev-parse HEAD) 00000009done -0000" | git-upload-pack . > /dev/null 2> output.err && +0000" | git upload-pack . > /dev/null 2> output.err && grep "waitpid (async) failed" output.err ' diff --git a/t/t5540-http-push.sh b/t/t5540-http-push.sh index b0d242e3e..da9588645 100755 --- a/t/t5540-http-push.sh +++ b/t/t5540-http-push.sh @@ -19,7 +19,7 @@ then exit fi -. ../lib-httpd.sh +. "$TEST_DIRECTORY"/lib-httpd.sh if ! start_httpd >&3 2>&4 then diff --git a/t/t5600-clone-fail-cleanup.sh b/t/t5600-clone-fail-cleanup.sh index 3c013e2b6..ee06d2864 100755 --- a/t/t5600-clone-fail-cleanup.sh +++ b/t/t5600-clone-fail-cleanup.sh @@ -3,9 +3,9 @@ # Copyright (C) 2006 Carl D. Worth <cworth@cworth.org> # -test_description='test git-clone to cleanup after failure +test_description='test git clone to cleanup after failure -This test covers the fact that if git-clone fails, it should remove +This test covers the fact that if git clone fails, it should remove the directory it created, to avoid the user having to manually remove the directory before attempting a clone again.' @@ -13,7 +13,7 @@ remove the directory before attempting a clone again.' test_expect_success \ 'clone of non-existent source should fail' \ - 'test_must_fail git-clone foo bar' + 'test_must_fail git clone foo bar' test_expect_success \ 'failed clone should not leave a directory' \ @@ -25,15 +25,15 @@ test_create_repo foo # clone doesn't like it if there is no HEAD. Is that a bug? (cd foo && touch file && git add file && git commit -m 'add file' >/dev/null 2>&1) -# source repository given to git-clone should be relative to the +# source repository given to git clone should be relative to the # current path not to the target dir test_expect_success \ 'clone of non-existent (relative to $PWD) source should fail' \ - 'test_must_fail git-clone ../foo baz' + 'test_must_fail git clone ../foo baz' test_expect_success \ 'clone should work now that source exists' \ - 'git-clone foo bar' + 'git clone foo bar' test_expect_success \ 'successful clone must leave the directory' \ diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 59c65fef2..78a3fa639 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -107,4 +107,22 @@ test_expect_success 'clone --mirror does not repeat tags' ' ' +test_expect_success 'clone to destination with trailing /' ' + + git clone src target-1/ && + T=$( cd target-1 && git rev-parse HEAD ) && + S=$( cd src && git rev-parse HEAD ) && + test "$T" = "$S" + +' + +test_expect_success 'clone to destination with extra trailing /' ' + + git clone src target-2/// && + T=$( cd target-2 && git rev-parse HEAD ) && + S=$( cd src && git rev-parse HEAD ) && + test "$T" = "$S" + +' + test_done diff --git a/t/t5602-clone-remote-exec.sh b/t/t5602-clone-remote-exec.sh index 8367a6845..82b1d1e2b 100755 --- a/t/t5602-clone-remote-exec.sh +++ b/t/t5602-clone-remote-exec.sh @@ -11,13 +11,13 @@ test_expect_success setup ' chmod +x not_ssh ' -test_expect_success 'clone calls git-upload-pack unqualified with no -u option' ' +test_expect_success 'clone calls git upload-pack unqualified with no -u option' ' GIT_SSH=./not_ssh git clone localhost:/path/to/repo junk echo "localhost git-upload-pack '\''/path/to/repo'\''" >expected test_cmp expected not_ssh_output ' -test_expect_success 'clone calls specified git-upload-pack with -u option' ' +test_expect_success 'clone calls specified git upload-pack with -u option' ' GIT_SSH=./not_ssh git clone -u /something/bin/git-upload-pack localhost:/path/to/repo junk echo "localhost /something/bin/git-upload-pack '\''/path/to/repo'\''" >expected test_cmp expected not_ssh_output diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh index 8f5de097e..b4e8fbaa5 100755 --- a/t/t6002-rev-list-bisect.sh +++ b/t/t6002-rev-list-bisect.sh @@ -5,7 +5,7 @@ test_description='Tests git rev-list --bisect functionality' . ./test-lib.sh -. ../t6000lib.sh # t6xxx specific functions +. "$TEST_DIRECTORY"/t6000lib.sh # t6xxx specific functions # usage: test_bisection max-diff bisect-option head ^prune... # diff --git a/t/t6003-rev-list-topo-order.sh b/t/t6003-rev-list-topo-order.sh index 5daa0be8c..2c73f2da7 100755 --- a/t/t6003-rev-list-topo-order.sh +++ b/t/t6003-rev-list-topo-order.sh @@ -6,7 +6,7 @@ test_description='Tests git rev-list --topo-order functionality' . ./test-lib.sh -. ../t6000lib.sh # t6xxx specific functions +. "$TEST_DIRECTORY"/t6000lib.sh # t6xxx specific functions list_duplicates() { diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index 9176484db..86bf7e14b 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh @@ -6,8 +6,8 @@ test_description='git rev-list --pretty=format test' test_tick test_expect_success 'setup' ' -touch foo && git add foo && git-commit -m "added foo" && - echo changed >foo && git-commit -a -m "changed foo" +touch foo && git add foo && git commit -m "added foo" && + echo changed >foo && git commit -a -m "changed foo" ' # usage: test_format name format_string <expected_output @@ -110,7 +110,7 @@ include an iso8859 character: ¡bueno! EOF test_expect_success 'setup complex body' ' git config i18n.commitencoding iso8859-1 && - echo change2 >foo && git-commit -a -F commit-msg + echo change2 >foo && git commit -a -F commit-msg ' test_format complex-encoding %e <<'EOF' @@ -139,6 +139,12 @@ commit 131a310eb913d107dd3c09a65d1651175898735d commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873 EOF +test_expect_success '%ad respects --date=' ' + echo 2005-04-07 >expect.ad-short && + git log -1 --date=short --pretty=tformat:%ad >output.ad-short master && + test_cmp expect.ad-short output.ad-short +' + test_expect_success 'empty email' ' test_tick && C=$(GIT_AUTHOR_EMAIL= git commit-tree HEAD^{tree} </dev/null) && diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh index b6e57b242..04e4b7c5c 100755 --- a/t/t6010-merge-base.sh +++ b/t/t6010-merge-base.sh @@ -108,4 +108,52 @@ test_expect_success 'compute merge-base (all)' \ 'MB=$(git merge-base --all PL PR) && expr "$(git name-rev "$MB")" : "[0-9a-f]* tags/C2"' +# Another set to demonstrate base between one commit and a merge +# in the documentation. + +test_expect_success 'merge-base for octopus-step (setup)' ' + test_tick && git commit --allow-empty -m root && git tag MMR && + test_tick && git commit --allow-empty -m 1 && git tag MM1 && + test_tick && git commit --allow-empty -m o && + test_tick && git commit --allow-empty -m o && + test_tick && git commit --allow-empty -m o && + test_tick && git commit --allow-empty -m A && git tag MMA && + git checkout MM1 && + test_tick && git commit --allow-empty -m o && + test_tick && git commit --allow-empty -m o && + test_tick && git commit --allow-empty -m o && + test_tick && git commit --allow-empty -m B && git tag MMB && + git checkout MMR && + test_tick && git commit --allow-empty -m o && + test_tick && git commit --allow-empty -m o && + test_tick && git commit --allow-empty -m o && + test_tick && git commit --allow-empty -m o && + test_tick && git commit --allow-empty -m C && git tag MMC +' + +test_expect_success 'merge-base A B C' ' + MB=$(git merge-base --all MMA MMB MMC) && + MM1=$(git rev-parse --verify MM1) && + test "$MM1" = "$MB" +' + +test_expect_success 'criss-cross merge-base for octopus-step (setup)' ' + git reset --hard MMR && + test_tick && git commit --allow-empty -m 1 && git tag CC1 && + git reset --hard E && + test_tick && git commit --allow-empty -m 2 && git tag CC2 && + test_tick && git merge -s ours CC1 && + test_tick && git commit --allow-empty -m o && + test_tick && git commit --allow-empty -m B && git tag CCB && + git reset --hard CC1 && + test_tick && git merge -s ours CC2 && + test_tick && git commit --allow-empty -m A && git tag CCA +' + +test_expect_success 'merge-base B A^^ A^^2' ' + MB0=$(git merge-base --all CCB CCA^^ CCA^^2 | sort) && + MB1=$(git rev-parse CC1 CC2 | sort) && + test "$MB0" = "$MB1" +' + test_done diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh new file mode 100755 index 000000000..510bb9679 --- /dev/null +++ b/t/t6012-rev-list-simplify.sh @@ -0,0 +1,93 @@ +#!/bin/sh + +test_description='merge simplification' + +. ./test-lib.sh + +note () { + git tag "$1" +} + +_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' +_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" + +unnote () { + git name-rev --tags --stdin | sed -e "s|$_x40 (tags/\([^)]*\)) |\1 |g" +} + +test_expect_success setup ' + echo "Hi there" >file && + git add file && + test_tick && git commit -m "Initial file" && + note A && + + git branch other-branch && + + echo "Hello" >file && + git add file && + test_tick && git commit -m "Modified file" && + note B && + + git checkout other-branch && + + echo "Hello" >file && + git add file && + test_tick && git commit -m "Modified the file identically" && + note C && + + echo "This is a stupid example" >another-file && + git add another-file && + test_tick && git commit -m "Add another file" && + note D && + + test_tick && git merge -m "merge" master && + note E && + + echo "Yet another" >elif && + git add elif && + test_tick && git commit -m "Irrelevant change" && + note F && + + git checkout master && + echo "Yet another" >elif && + git add elif && + test_tick && git commit -m "Another irrelevant change" && + note G && + + test_tick && git merge -m "merge" other-branch && + note H && + + echo "Final change" >file && + test_tick && git commit -a -m "Final change" && + note I +' + +FMT='tformat:%P %H | %s' + +check_result () { + for c in $1 + do + echo "$c" + done >expect && + shift && + param="$*" && + test_expect_success "log $param" ' + git log --pretty="$FMT" --parents $param | + unnote >actual && + sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual && + test_cmp expect check || { + cat actual + false + } + ' +} + +check_result 'I H G F E D C B A' --full-history +check_result 'I H E C B A' --full-history -- file +check_result 'I H E C B A' --full-history --topo-order -- file +check_result 'I H E C B A' --full-history --date-order -- file +check_result 'I E C B A' --simplify-merges -- file +check_result 'I B A' -- file +check_result 'I B A' --topo-order -- file + +test_done diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh index f674c48ca..42620e073 100755 --- a/t/t6023-merge-file.sh +++ b/t/t6023-merge-file.sh @@ -136,7 +136,7 @@ test_expect_success "expected conflict markers" "test_cmp expect out" test_expect_success 'binary files cannot be merged' ' test_must_fail git merge-file -p \ - orig.txt ../test4012.png new1.txt 2> merge.err && + orig.txt "$TEST_DIRECTORY"/test4012.png new1.txt 2> merge.err && grep "Cannot merge binary files" merge.err ' diff --git a/t/t6025-merge-symlinks.sh b/t/t6025-merge-symlinks.sh index fc58456a1..53892a555 100755 --- a/t/t6025-merge-symlinks.sh +++ b/t/t6025-merge-symlinks.sh @@ -5,7 +5,7 @@ test_description='merging symlinks on filesystem w/o symlink support. -This tests that git-merge-recursive writes merge results as plain files +This tests that git merge-recursive writes merge results as plain files if core.symlinks is false.' . ./test-lib.sh @@ -15,25 +15,25 @@ test_expect_success \ git config core.symlinks false && > file && git add file && -git-commit -m initial && +git commit -m initial && git branch b-symlink && git branch b-file && -l=$(echo -n file | git-hash-object -t blob -w --stdin) && +l=$(echo -n file | git hash-object -t blob -w --stdin) && echo "120000 $l symlink" | git update-index --index-info && -git-commit -m master && -git-checkout b-symlink && -l=$(echo -n file-different | git-hash-object -t blob -w --stdin) && +git commit -m master && +git checkout b-symlink && +l=$(echo -n file-different | git hash-object -t blob -w --stdin) && echo "120000 $l symlink" | git update-index --index-info && -git-commit -m b-symlink && -git-checkout b-file && +git commit -m b-symlink && +git checkout b-file && echo plain-file > symlink && git add symlink && -git-commit -m b-file' +git commit -m b-file' test_expect_success \ 'merge master into b-symlink, which has a different symbolic link' ' -git-checkout b-symlink && -test_must_fail git-merge master' +git checkout b-symlink && +test_must_fail git merge master' test_expect_success \ 'the merge result must be a file' ' @@ -41,8 +41,8 @@ test -f symlink' test_expect_success \ 'merge master into b-file, which has a file instead of a symbolic link' ' -git-reset --hard && git-checkout b-file && -test_must_fail git-merge master' +git reset --hard && git checkout b-file && +test_must_fail git merge master' test_expect_success \ 'the merge result must be a file' ' @@ -50,9 +50,9 @@ test -f symlink' test_expect_success \ 'merge b-file, which has a file instead of a symbolic link, into master' ' -git-reset --hard && -git-checkout master && -test_must_fail git-merge b-file' +git reset --hard && +git checkout master && +test_must_fail git merge b-file' test_expect_success \ 'the merge result must be a file' ' diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh index 56fc34176..4b423e937 100755 --- a/t/t6026-merge-attr.sh +++ b/t/t6026-merge-attr.sh @@ -106,9 +106,9 @@ test_expect_success 'custom merge backend' ' cmp binary union && sed -e 1,3d text >check-1 && - o=$(git-unpack-file master^:text) && - a=$(git-unpack-file side^:text) && - b=$(git-unpack-file master:text) && + o=$(git unpack-file master^:text) && + a=$(git unpack-file side^:text) && + b=$(git unpack-file master:text) && sh -c "./custom-merge $o $a $b 0" && sed -e 1,3d $a >check-2 && cmp check-1 check-2 && @@ -133,9 +133,9 @@ test_expect_success 'custom merge backend' ' cmp binary union && sed -e 1,3d text >check-1 && - o=$(git-unpack-file master^:text) && - a=$(git-unpack-file anchor:text) && - b=$(git-unpack-file master:text) && + o=$(git unpack-file master^:text) && + a=$(git unpack-file anchor:text) && + b=$(git unpack-file master:text) && sh -c "./custom-merge $o $a $b 0" && sed -e 1,3d $a >check-2 && cmp check-1 check-2 && diff --git a/t/t6027-merge-binary.sh b/t/t6027-merge-binary.sh index 92ca1f0f8..b519626ca 100755 --- a/t/t6027-merge-binary.sh +++ b/t/t6027-merge-binary.sh @@ -6,7 +6,7 @@ test_description='ask merge-recursive to merge binary files' test_expect_success setup ' - cat ../test4012.png >m && + cat "$TEST_DIRECTORY"/test4012.png >m && git add m && git ls-files -s | sed -e "s/ 0 / 1 /" >E1 && test_tick && diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 244fda62a..36c9a6965 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -2,7 +2,7 @@ # # Copyright (c) 2007 Christian Couder # -test_description='Tests git-bisect functionality' +test_description='Tests git bisect functionality' exec </dev/null @@ -23,7 +23,7 @@ add_line_into_file() fi test_tick - git-commit --quiet -m "$MSG" $_file + git commit --quiet -m "$MSG" $_file } HASH1= diff --git a/t/t6101-rev-parse-parents.sh b/t/t6101-rev-parse-parents.sh index 919552a2f..f105fab98 100755 --- a/t/t6101-rev-parse-parents.sh +++ b/t/t6101-rev-parse-parents.sh @@ -6,7 +6,7 @@ test_description='Test git rev-parse with different parent options' . ./test-lib.sh -. ../t6000lib.sh # t6xxx specific functions +. "$TEST_DIRECTORY"/t6000lib.sh # t6xxx specific functions date >path0 git update-index --add path0 diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index 2fb672c3b..16cc63581 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -31,57 +31,57 @@ check_describe () { test_expect_success setup ' test_tick && - echo one >file && git add file && git-commit -m initial && + echo one >file && git add file && git commit -m initial && one=$(git rev-parse HEAD) && test_tick && - echo two >file && git add file && git-commit -m second && + echo two >file && git add file && git commit -m second && two=$(git rev-parse HEAD) && test_tick && - echo three >file && git add file && git-commit -m third && + echo three >file && git add file && git commit -m third && test_tick && - echo A >file && git add file && git-commit -m A && + echo A >file && git add file && git commit -m A && test_tick && - git-tag -a -m A A && + git tag -a -m A A && test_tick && - echo c >file && git add file && git-commit -m c && + echo c >file && git add file && git commit -m c && test_tick && - git-tag c && + git tag c && git reset --hard $two && test_tick && - echo B >side && git add side && git-commit -m B && + echo B >side && git add side && git commit -m B && test_tick && - git-tag -a -m B B && + git tag -a -m B B && test_tick && - git-merge -m Merged c && + git merge -m Merged c && merged=$(git rev-parse HEAD) && git reset --hard $two && test_tick && - echo D >another && git add another && git-commit -m D && + echo D >another && git add another && git commit -m D && test_tick && - git-tag -a -m D D && + git tag -a -m D D && test_tick && echo DD >another && git commit -a -m another && test_tick && - git-tag e && + git tag e && test_tick && echo DDD >another && git commit -a -m "yet another" && test_tick && - git-merge -m Merged $merged && + git merge -m Merged $merged && test_tick && echo X >file && echo X >side && git add file side && - git-commit -m x + git commit -m x ' diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh index bc7434941..8f5a06f7d 100755 --- a/t/t6200-fmt-merge-msg.sh +++ b/t/t6200-fmt-merge-msg.sh @@ -83,13 +83,13 @@ test_expect_success 'merge-msg test #1' ' ' cat >expected <<EOF -Merge branch 'left' of ../$test +Merge branch 'left' of $TEST_DIRECTORY/$test EOF test_expect_success 'merge-msg test #2' ' git checkout master && - git fetch ../"$test" left && + git fetch "$TEST_DIRECTORY/$test" left && git fmt-merge-msg <.git/FETCH_HEAD >actual && test_cmp expected actual diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index a3c8941c7..26995b3cd 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -97,27 +97,27 @@ test_atom tag contents 'Tagging at 1151939927 ' test_expect_success 'Check invalid atoms names are errors' ' - test_must_fail git-for-each-ref --format="%(INVALID)" refs/heads + test_must_fail git for-each-ref --format="%(INVALID)" refs/heads ' test_expect_success 'Check format specifiers are ignored in naming date atoms' ' - git-for-each-ref --format="%(authordate)" refs/heads && - git-for-each-ref --format="%(authordate:default) %(authordate)" refs/heads && - git-for-each-ref --format="%(authordate) %(authordate:default)" refs/heads && - git-for-each-ref --format="%(authordate:default) %(authordate:default)" refs/heads + git for-each-ref --format="%(authordate)" refs/heads && + git for-each-ref --format="%(authordate:default) %(authordate)" refs/heads && + git for-each-ref --format="%(authordate) %(authordate:default)" refs/heads && + git for-each-ref --format="%(authordate:default) %(authordate:default)" refs/heads ' test_expect_success 'Check valid format specifiers for date fields' ' - git-for-each-ref --format="%(authordate:default)" refs/heads && - git-for-each-ref --format="%(authordate:relative)" refs/heads && - git-for-each-ref --format="%(authordate:short)" refs/heads && - git-for-each-ref --format="%(authordate:local)" refs/heads && - git-for-each-ref --format="%(authordate:iso8601)" refs/heads && - git-for-each-ref --format="%(authordate:rfc2822)" refs/heads + git for-each-ref --format="%(authordate:default)" refs/heads && + git for-each-ref --format="%(authordate:relative)" refs/heads && + git for-each-ref --format="%(authordate:short)" refs/heads && + git for-each-ref --format="%(authordate:local)" refs/heads && + git for-each-ref --format="%(authordate:iso8601)" refs/heads && + git for-each-ref --format="%(authordate:rfc2822)" refs/heads ' test_expect_success 'Check invalid format specifiers are errors' ' - test_must_fail git-for-each-ref --format="%(authordate:INVALID)" refs/heads + test_must_fail git for-each-ref --format="%(authordate:INVALID)" refs/heads ' cat >expected <<\EOF @@ -207,7 +207,7 @@ refs/tags/testtag EOF test_expect_success 'Verify ascending sort' ' - git-for-each-ref --format="%(refname)" --sort=refname >actual && + git for-each-ref --format="%(refname)" --sort=refname >actual && test_cmp expected actual ' @@ -218,7 +218,7 @@ refs/heads/master EOF test_expect_success 'Verify descending sort' ' - git-for-each-ref --format="%(refname)" --sort=-refname >actual && + git for-each-ref --format="%(refname)" --sort=-refname >actual && test_cmp expected actual ' @@ -262,4 +262,14 @@ for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do " done +test_expect_success 'an unusual tag with an incomplete line' ' + + git tag -m "bogo" bogo && + bogo=$(git cat-file tag bogo) && + bogo=$(printf "%s" "$bogo" | git mktag) && + git tag -f bogo "$bogo" && + git for-each-ref --format "%(body)" refs/tags/bogo + +' + test_done diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh index 910a28c7e..575ef5beb 100755 --- a/t/t7001-mv.sh +++ b/t/t7001-mv.sh @@ -6,9 +6,9 @@ test_description='git mv in subdirs' test_expect_success \ 'prepare reference tree' \ 'mkdir path0 path1 && - cp ../../COPYING path0/COPYING && + cp "$TEST_DIRECTORY"/../COPYING path0/COPYING && git add path0/COPYING && - git-commit -m add -a' + git commit -m add -a' test_expect_success \ 'moving the file out of subdirectory' \ @@ -17,7 +17,7 @@ test_expect_success \ # in path0 currently test_expect_success \ 'commiting the change' \ - 'cd .. && git-commit -m move-out -a' + 'cd .. && git commit -m move-out -a' test_expect_success \ 'checking the commit' \ @@ -31,7 +31,7 @@ test_expect_success \ # in path0 currently test_expect_success \ 'commiting the change' \ - 'cd .. && git-commit -m move-in -a' + 'cd .. && git commit -m move-in -a' test_expect_success \ 'checking the commit' \ @@ -40,9 +40,9 @@ test_expect_success \ test_expect_success \ 'adding another file' \ - 'cp ../../README path0/README && + 'cp "$TEST_DIRECTORY"/../README path0/README && git add path0/README && - git-commit -m add2 -a' + git commit -m add2 -a' test_expect_success \ 'moving whole subdirectory' \ @@ -50,7 +50,7 @@ test_expect_success \ test_expect_success \ 'commiting the change' \ - 'git-commit -m dir-move -a' + 'git commit -m dir-move -a' test_expect_success \ 'checking the commit' \ @@ -69,7 +69,7 @@ test_expect_success \ test_expect_success \ 'commiting the change' \ - 'git-commit -m dir-move -a' + 'git commit -m dir-move -a' test_expect_success \ 'checking the commit' \ diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index c8b4f65f3..5e359cb56 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -22,6 +22,7 @@ test_expect_success setup ' mkdir t && echo test >t/t && git add file x y z t/t && + test_tick && git commit -m initial ' @@ -113,4 +114,54 @@ do done +test_expect_success 'log grep setup' ' + echo a >>file && + test_tick && + GIT_AUTHOR_NAME="With * Asterisk" \ + GIT_AUTHOR_EMAIL="xyzzy@frotz.com" \ + git commit -a -m "second" && + + echo a >>file && + test_tick && + git commit -a -m "third" + +' + +test_expect_success 'log grep (1)' ' + git log --author=author --pretty=tformat:%s >actual && + ( echo third ; echo initial ) >expect && + test_cmp expect actual +' + +test_expect_success 'log grep (2)' ' + git log --author=" * " -F --pretty=tformat:%s >actual && + ( echo second ) >expect && + test_cmp expect actual +' + +test_expect_success 'log grep (3)' ' + git log --author="^A U" --pretty=tformat:%s >actual && + ( echo third ; echo initial ) >expect && + test_cmp expect actual +' + +test_expect_success 'log grep (4)' ' + git log --author="frotz\.com>$" --pretty=tformat:%s >actual && + ( echo second ) >expect && + test_cmp expect actual +' + +test_expect_success 'log grep (5)' ' + git log --author=Thor -F --grep=Thu --pretty=tformat:%s >actual && + ( echo third ; echo initial ) >expect && + test_cmp expect actual +' + +test_expect_success 'log grep (6)' ' + git log --author=-0700 --pretty=tformat:%s >actual && + >expect && + test_cmp expect actual + +' + test_done diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index a0ab096c8..b0a9d7d53 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-filter-branch' +test_description='git filter-branch' . ./test-lib.sh make_commit () { @@ -32,14 +32,14 @@ test_expect_success 'setup' ' H=$(git rev-parse H) test_expect_success 'rewrite identically' ' - git-filter-branch branch + git filter-branch branch ' test_expect_success 'result is really identical' ' test $H = $(git rev-parse HEAD) ' test_expect_success 'rewrite bare repository identically' ' - (git config core.bare true && cd .git && git-filter-branch branch) + (git config core.bare true && cd .git && git filter-branch branch) ' git config core.bare false test_expect_success 'result is really identical' ' @@ -47,7 +47,7 @@ test_expect_success 'result is really identical' ' ' test_expect_success 'rewrite, renaming a specific file' ' - git-filter-branch -f --tree-filter "mv d doh || :" HEAD + git filter-branch -f --tree-filter "mv d doh || :" HEAD ' test_expect_success 'test that the file was renamed' ' @@ -58,7 +58,7 @@ test_expect_success 'test that the file was renamed' ' ' test_expect_success 'rewrite, renaming a specific directory' ' - git-filter-branch -f --tree-filter "mv dir diroh || :" HEAD + git filter-branch -f --tree-filter "mv dir diroh || :" HEAD ' test_expect_success 'test that the directory was renamed' ' @@ -73,7 +73,7 @@ test_expect_success 'test that the directory was renamed' ' git tag oldD HEAD~4 test_expect_success 'rewrite one branch, keeping a side branch' ' git branch modD oldD && - git-filter-branch -f --tree-filter "mv b boh || :" D..modD + git filter-branch -f --tree-filter "mv b boh || :" D..modD ' test_expect_success 'common ancestor is still common (unchanged)' ' @@ -96,13 +96,17 @@ test_expect_success 'filter subdirectory only' ' test_tick && git commit -m "again not subdir" && git branch sub && - git-filter-branch -f --subdirectory-filter subdir refs/heads/sub + git branch sub-earlier HEAD~2 && + git filter-branch -f --subdirectory-filter subdir \ + refs/heads/sub refs/heads/sub-earlier ' test_expect_success 'subdirectory filter result looks okay' ' test 2 = $(git rev-list sub | wc -l) && git show sub:new && - test_must_fail git show sub:subdir + test_must_fail git show sub:subdir && + git show sub-earlier:new && + test_must_fail git show sub-earlier:subdir ' test_expect_success 'more setup' ' @@ -120,7 +124,7 @@ test_expect_success 'more setup' ' test_expect_success 'use index-filter to move into a subdirectory' ' git branch directorymoved && - git-filter-branch -f --index-filter \ + git filter-branch -f --index-filter \ "git ls-files -s | sed \"s-\\t-&newsubdir/-\" | GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \ git update-index --index-info && @@ -129,7 +133,7 @@ test_expect_success 'use index-filter to move into a subdirectory' ' test_expect_success 'stops when msg filter fails' ' old=$(git rev-parse HEAD) && - test_must_fail git-filter-branch -f --msg-filter false HEAD && + test_must_fail git filter-branch -f --msg-filter false HEAD && test $old = $(git rev-parse HEAD) && rm -rf .git-rewrite ' @@ -140,7 +144,7 @@ test_expect_success 'author information is preserved' ' test_tick && GIT_AUTHOR_NAME="B V Uips" git commit -m bvuips && git branch preserved-author && - git-filter-branch -f --msg-filter "cat; \ + git filter-branch -f --msg-filter "cat; \ test \$GIT_COMMIT != $(git rev-parse master) || \ echo Hallo" \ preserved-author && @@ -152,7 +156,7 @@ test_expect_success "remove a certain author's commits" ' test_tick && git commit -m i i && git branch removed-author && - git-filter-branch -f --commit-filter "\ + git filter-branch -f --commit-filter "\ if [ \"\$GIT_AUTHOR_NAME\" = \"B V Uips\" ];\ then\ skip_commit \"\$@\"; @@ -250,4 +254,12 @@ test_expect_success 'Tag name filtering strips gpg signature' ' test_cmp expect actual ' +test_expect_success 'Tag name filtering allows slashes in tag names' ' + git tag -m tag-with-slash X/1 && + git cat-file tag X/1 | sed -e s,X/1,X/2, > expect && + git filter-branch -f --tag-name-filter "echo X/2" && + git cat-file tag X/2 > actual && + test_cmp expect actual +' + test_done diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 8d44c2ed1..f0edbf1a7 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Carlos Rica # -test_description='git-tag +test_description='git tag Tests for operations with tags.' @@ -22,25 +22,25 @@ test_expect_success 'listing all tags in an empty tree should succeed' ' ' test_expect_success 'listing all tags in an empty tree should output nothing' ' - test `git-tag -l | wc -l` -eq 0 && - test `git-tag | wc -l` -eq 0 + test `git tag -l | wc -l` -eq 0 && + test `git tag | wc -l` -eq 0 ' test_expect_success 'looking for a tag in an empty tree should fail' \ '! (tag_exists mytag)' test_expect_success 'creating a tag in an empty tree should fail' ' - test_must_fail git-tag mynotag && + test_must_fail git tag mynotag && ! tag_exists mynotag ' test_expect_success 'creating a tag for HEAD in an empty tree should fail' ' - test_must_fail git-tag mytaghead HEAD && + test_must_fail git tag mytaghead HEAD && ! tag_exists mytaghead ' test_expect_success 'creating a tag for an unknown revision should fail' ' - test_must_fail git-tag mytagnorev aaaaaaaaaaa && + test_must_fail git tag mytagnorev aaaaaaaaaaa && ! tag_exists mytagnorev ' @@ -54,32 +54,32 @@ test_expect_success 'creating a tag using default HEAD should succeed' ' ' test_expect_success 'listing all tags if one exists should succeed' ' - git-tag -l && - git-tag + git tag -l && + git tag ' test_expect_success 'listing all tags if one exists should output that tag' ' - test `git-tag -l` = mytag && - test `git-tag` = mytag + test `git tag -l` = mytag && + test `git tag` = mytag ' # pattern matching: test_expect_success 'listing a tag using a matching pattern should succeed' \ - 'git-tag -l mytag' + 'git tag -l mytag' test_expect_success \ 'listing a tag using a matching pattern should output that tag' \ - 'test `git-tag -l mytag` = mytag' + 'test `git tag -l mytag` = mytag' # todo: git tag -l now returns always zero, when fixed, change this test test_expect_success \ 'listing tags using a non-matching pattern should suceed' \ - 'git-tag -l xxx' + 'git tag -l xxx' test_expect_success \ 'listing tags using a non-matching pattern should output nothing' \ - 'test `git-tag -l xxx | wc -l` -eq 0' + 'test `git tag -l xxx | wc -l` -eq 0' # special cases for creating tags: @@ -89,13 +89,13 @@ test_expect_success \ test_expect_success \ 'trying to create a tag with a non-valid name should fail' ' - test `git-tag -l | wc -l` -eq 1 && + test `git tag -l | wc -l` -eq 1 && test_must_fail git tag "" && test_must_fail git tag .othertag && test_must_fail git tag "other tag" && test_must_fail git tag "othertag^" && test_must_fail git tag "other~tag" && - test `git-tag -l | wc -l` -eq 1 + test `git tag -l | wc -l` -eq 1 ' test_expect_success 'creating a tag using HEAD directly should succeed' ' @@ -107,7 +107,7 @@ test_expect_success 'creating a tag using HEAD directly should succeed' ' test_expect_success 'trying to delete an unknown tag should fail' ' ! tag_exists unknown-tag && - test_must_fail git-tag -d unknown-tag + test_must_fail git tag -d unknown-tag ' cat >expect <<EOF @@ -117,7 +117,7 @@ EOF test_expect_success \ 'trying to delete tags without params should succeed and do nothing' ' git tag -l > actual && test_cmp expect actual && - git-tag -d && + git tag -d && git tag -l > actual && test_cmp expect actual ' @@ -125,7 +125,7 @@ test_expect_success \ 'deleting two existing tags in one command should succeed' ' tag_exists mytag && tag_exists myhead && - git-tag -d mytag myhead && + git tag -d mytag myhead && ! tag_exists mytag && ! tag_exists myhead ' @@ -133,7 +133,7 @@ test_expect_success \ test_expect_success \ 'creating a tag with the name of another deleted one should succeed' ' ! tag_exists mytag && - git-tag mytag && + git tag mytag && tag_exists mytag ' @@ -141,13 +141,13 @@ test_expect_success \ 'trying to delete two tags, existing and not, should fail in the 2nd' ' tag_exists mytag && ! tag_exists myhead && - test_must_fail git-tag -d mytag anothertag && + test_must_fail git tag -d mytag anothertag && ! tag_exists mytag && ! tag_exists myhead ' test_expect_success 'trying to delete an already deleted tag should fail' \ - 'test_must_fail git-tag -d mytag' + 'test_must_fail git tag -d mytag' # listing various tags with pattern matching: @@ -185,7 +185,7 @@ cba EOF test_expect_success \ 'listing tags with substring as pattern must print those matching' ' - git-tag -l "*a*" > actual && + git tag -l "*a*" > actual && test_cmp expect actual ' @@ -195,7 +195,7 @@ v1.0.1 EOF test_expect_success \ 'listing tags with a suffix as pattern must print those matching' ' - git-tag -l "*.1" > actual && + git tag -l "*.1" > actual && test_cmp expect actual ' @@ -205,7 +205,7 @@ t211 EOF test_expect_success \ 'listing tags with a prefix as pattern must print those matching' ' - git-tag -l "t21*" > actual && + git tag -l "t21*" > actual && test_cmp expect actual ' @@ -214,7 +214,7 @@ a1 EOF test_expect_success \ 'listing tags using a name as pattern must print that one matching' ' - git-tag -l a1 > actual && + git tag -l a1 > actual && test_cmp expect actual ' @@ -223,7 +223,7 @@ v1.0 EOF test_expect_success \ 'listing tags using a name as pattern must print that one matching' ' - git-tag -l v1.0 > actual && + git tag -l v1.0 > actual && test_cmp expect actual ' @@ -233,14 +233,14 @@ v1.1.3 EOF test_expect_success \ 'listing tags with ? in the pattern should print those matching' ' - git-tag -l "v1.?.?" > actual && + git tag -l "v1.?.?" > actual && test_cmp expect actual ' >expect test_expect_success \ 'listing tags using v.* should print nothing because none have v.' ' - git-tag -l "v.*" > actual && + git tag -l "v.*" > actual && test_cmp expect actual ' @@ -252,7 +252,7 @@ v1.1.3 EOF test_expect_success \ 'listing tags using v* should print only those having v' ' - git-tag -l "v*" > actual && + git tag -l "v*" > actual && test_cmp expect actual ' @@ -260,21 +260,21 @@ test_expect_success \ test_expect_success \ 'a non-annotated tag created without parameters should point to HEAD' ' - git-tag non-annotated-tag && + git tag non-annotated-tag && test $(git cat-file -t non-annotated-tag) = commit && test $(git rev-parse non-annotated-tag) = $(git rev-parse HEAD) ' test_expect_success 'trying to verify an unknown tag should fail' \ - 'test_must_fail git-tag -v unknown-tag' + 'test_must_fail git tag -v unknown-tag' test_expect_success \ 'trying to verify a non-annotated and non-signed tag should fail' \ - 'test_must_fail git-tag -v non-annotated-tag' + 'test_must_fail git tag -v non-annotated-tag' test_expect_success \ 'trying to verify many non-annotated or unknown tags, should fail' \ - 'test_must_fail git-tag -v unknown-tag1 non-annotated-tag unknown-tag2' + 'test_must_fail git tag -v unknown-tag1 non-annotated-tag unknown-tag2' # creating annotated tags: @@ -300,7 +300,7 @@ get_tag_header annotated-tag $commit commit $time >expect echo "A message" >>expect test_expect_success \ 'creating an annotated tag with -m message should succeed' ' - git-tag -m "A message" annotated-tag && + git tag -m "A message" annotated-tag && get_tag_msg annotated-tag >actual && test_cmp expect actual ' @@ -313,7 +313,7 @@ get_tag_header file-annotated-tag $commit commit $time >expect cat msgfile >>expect test_expect_success \ 'creating an annotated tag with -F messagefile should succeed' ' - git-tag -F msgfile file-annotated-tag && + git tag -F msgfile file-annotated-tag && get_tag_msg file-annotated-tag >actual && test_cmp expect actual ' @@ -325,7 +325,7 @@ EOF get_tag_header stdin-annotated-tag $commit commit $time >expect cat inputmsg >>expect test_expect_success 'creating an annotated tag with -F - should succeed' ' - git-tag -F - stdin-annotated-tag <inputmsg && + git tag -F - stdin-annotated-tag <inputmsg && get_tag_msg stdin-annotated-tag >actual && test_cmp expect actual ' @@ -334,7 +334,7 @@ test_expect_success \ 'trying to create a tag with a non-existing -F file should fail' ' ! test -f nonexistingfile && ! tag_exists notag && - test_must_fail git-tag -F nonexistingfile notag && + test_must_fail git tag -F nonexistingfile notag && ! tag_exists notag ' @@ -343,11 +343,11 @@ test_expect_success \ echo "message file 1" >msgfile1 && echo "message file 2" >msgfile2 && ! tag_exists msgtag && - test_must_fail git-tag -m "message 1" -F msgfile1 msgtag && + test_must_fail git tag -m "message 1" -F msgfile1 msgtag && ! tag_exists msgtag && - test_must_fail git-tag -F msgfile1 -m "message 1" msgtag && + test_must_fail git tag -F msgfile1 -m "message 1" msgtag && ! tag_exists msgtag && - test_must_fail git-tag -m "message 1" -F msgfile1 \ + test_must_fail git tag -m "message 1" -F msgfile1 \ -m "message 2" msgtag && ! tag_exists msgtag ' @@ -357,7 +357,7 @@ test_expect_success \ get_tag_header empty-annotated-tag $commit commit $time >expect test_expect_success \ 'creating a tag with an empty -m message should succeed' ' - git-tag -m "" empty-annotated-tag && + git tag -m "" empty-annotated-tag && get_tag_msg empty-annotated-tag >actual && test_cmp expect actual ' @@ -366,7 +366,7 @@ test_expect_success \ get_tag_header emptyfile-annotated-tag $commit commit $time >expect test_expect_success \ 'creating a tag with an empty -F messagefile should succeed' ' - git-tag -F emptyfile emptyfile-annotated-tag && + git tag -F emptyfile emptyfile-annotated-tag && get_tag_msg emptyfile-annotated-tag >actual && test_cmp expect actual ' @@ -387,7 +387,7 @@ Trailing blank lines EOF test_expect_success \ 'extra blanks in the message for an annotated tag should be removed' ' - git-tag -F blanksfile blanks-annotated-tag && + git tag -F blanksfile blanks-annotated-tag && get_tag_msg blanks-annotated-tag >actual && test_cmp expect actual ' @@ -395,7 +395,7 @@ test_expect_success \ get_tag_header blank-annotated-tag $commit commit $time >expect test_expect_success \ 'creating a tag with blank -m message with spaces should succeed' ' - git-tag -m " " blank-annotated-tag && + git tag -m " " blank-annotated-tag && get_tag_msg blank-annotated-tag >actual && test_cmp expect actual ' @@ -406,7 +406,7 @@ echo ' ' >>blankfile get_tag_header blankfile-annotated-tag $commit commit $time >expect test_expect_success \ 'creating a tag with blank -F messagefile with spaces should succeed' ' - git-tag -F blankfile blankfile-annotated-tag && + git tag -F blankfile blankfile-annotated-tag && get_tag_msg blankfile-annotated-tag >actual && test_cmp expect actual ' @@ -415,7 +415,7 @@ printf ' ' >blanknonlfile get_tag_header blanknonlfile-annotated-tag $commit commit $time >expect test_expect_success \ 'creating a tag with -F file of spaces and no newline should succeed' ' - git-tag -F blanknonlfile blanknonlfile-annotated-tag && + git tag -F blanknonlfile blanknonlfile-annotated-tag && get_tag_msg blanknonlfile-annotated-tag >actual && test_cmp expect actual ' @@ -450,7 +450,7 @@ Last line. EOF test_expect_success \ 'creating a tag using a -F messagefile with #comments should succeed' ' - git-tag -F commentsfile comments-annotated-tag && + git tag -F commentsfile comments-annotated-tag && get_tag_msg comments-annotated-tag >actual && test_cmp expect actual ' @@ -458,7 +458,7 @@ test_expect_success \ get_tag_header comment-annotated-tag $commit commit $time >expect test_expect_success \ 'creating a tag with a #comment in the -m message should succeed' ' - git-tag -m "#comment" comment-annotated-tag && + git tag -m "#comment" comment-annotated-tag && get_tag_msg comment-annotated-tag >actual && test_cmp expect actual ' @@ -469,7 +469,7 @@ echo '####' >>commentfile get_tag_header commentfile-annotated-tag $commit commit $time >expect test_expect_success \ 'creating a tag with #comments in the -F messagefile should succeed' ' - git-tag -F commentfile commentfile-annotated-tag && + git tag -F commentfile commentfile-annotated-tag && get_tag_msg commentfile-annotated-tag >actual && test_cmp expect actual ' @@ -478,7 +478,7 @@ printf '#comment' >commentnonlfile get_tag_header commentnonlfile-annotated-tag $commit commit $time >expect test_expect_success \ 'creating a tag with a file of #comment and no newline should succeed' ' - git-tag -F commentnonlfile commentnonlfile-annotated-tag && + git tag -F commentnonlfile commentnonlfile-annotated-tag && get_tag_msg commentnonlfile-annotated-tag >actual && test_cmp expect actual ' @@ -487,51 +487,51 @@ test_expect_success \ test_expect_success \ 'listing the one-line message of a non-signed tag should succeed' ' - git-tag -m "A msg" tag-one-line && + git tag -m "A msg" tag-one-line && echo "tag-one-line" >expect && - git-tag -l | grep "^tag-one-line" >actual && + git tag -l | grep "^tag-one-line" >actual && test_cmp expect actual && - git-tag -n0 -l | grep "^tag-one-line" >actual && + git tag -n0 -l | grep "^tag-one-line" >actual && test_cmp expect actual && - git-tag -n0 -l tag-one-line >actual && + git tag -n0 -l tag-one-line >actual && test_cmp expect actual && echo "tag-one-line A msg" >expect && - git-tag -n1 -l | grep "^tag-one-line" >actual && + git tag -n1 -l | grep "^tag-one-line" >actual && test_cmp expect actual && - git-tag -n -l | grep "^tag-one-line" >actual && + git tag -n -l | grep "^tag-one-line" >actual && test_cmp expect actual && - git-tag -n1 -l tag-one-line >actual && + git tag -n1 -l tag-one-line >actual && test_cmp expect actual && - git-tag -n2 -l tag-one-line >actual && + git tag -n2 -l tag-one-line >actual && test_cmp expect actual && - git-tag -n999 -l tag-one-line >actual && + git tag -n999 -l tag-one-line >actual && test_cmp expect actual ' test_expect_success \ 'listing the zero-lines message of a non-signed tag should succeed' ' - git-tag -m "" tag-zero-lines && + git tag -m "" tag-zero-lines && echo "tag-zero-lines" >expect && - git-tag -l | grep "^tag-zero-lines" >actual && + git tag -l | grep "^tag-zero-lines" >actual && test_cmp expect actual && - git-tag -n0 -l | grep "^tag-zero-lines" >actual && + git tag -n0 -l | grep "^tag-zero-lines" >actual && test_cmp expect actual && - git-tag -n0 -l tag-zero-lines >actual && + git tag -n0 -l tag-zero-lines >actual && test_cmp expect actual && echo "tag-zero-lines " >expect && - git-tag -n1 -l | grep "^tag-zero-lines" >actual && + git tag -n1 -l | grep "^tag-zero-lines" >actual && test_cmp expect actual && - git-tag -n -l | grep "^tag-zero-lines" >actual && + git tag -n -l | grep "^tag-zero-lines" >actual && test_cmp expect actual && - git-tag -n1 -l tag-zero-lines >actual && + git tag -n1 -l tag-zero-lines >actual && test_cmp expect actual && - git-tag -n2 -l tag-zero-lines >actual && + git tag -n2 -l tag-zero-lines >actual && test_cmp expect actual && - git-tag -n999 -l tag-zero-lines >actual && + git tag -n999 -l tag-zero-lines >actual && test_cmp expect actual ' @@ -540,42 +540,42 @@ echo 'tag line two' >>annotagmsg echo 'tag line three' >>annotagmsg test_expect_success \ 'listing many message lines of a non-signed tag should succeed' ' - git-tag -F annotagmsg tag-lines && + git tag -F annotagmsg tag-lines && echo "tag-lines" >expect && - git-tag -l | grep "^tag-lines" >actual && + git tag -l | grep "^tag-lines" >actual && test_cmp expect actual && - git-tag -n0 -l | grep "^tag-lines" >actual && + git tag -n0 -l | grep "^tag-lines" >actual && test_cmp expect actual && - git-tag -n0 -l tag-lines >actual && + git tag -n0 -l tag-lines >actual && test_cmp expect actual && echo "tag-lines tag line one" >expect && - git-tag -n1 -l | grep "^tag-lines" >actual && + git tag -n1 -l | grep "^tag-lines" >actual && test_cmp expect actual && - git-tag -n -l | grep "^tag-lines" >actual && + git tag -n -l | grep "^tag-lines" >actual && test_cmp expect actual && - git-tag -n1 -l tag-lines >actual && + git tag -n1 -l tag-lines >actual && test_cmp expect actual && echo " tag line two" >>expect && - git-tag -n2 -l | grep "^ *tag.line" >actual && + git tag -n2 -l | grep "^ *tag.line" >actual && test_cmp expect actual && - git-tag -n2 -l tag-lines >actual && + git tag -n2 -l tag-lines >actual && test_cmp expect actual && echo " tag line three" >>expect && - git-tag -n3 -l | grep "^ *tag.line" >actual && + git tag -n3 -l | grep "^ *tag.line" >actual && test_cmp expect actual && - git-tag -n3 -l tag-lines >actual && + git tag -n3 -l tag-lines >actual && test_cmp expect actual && - git-tag -n4 -l | grep "^ *tag.line" >actual && + git tag -n4 -l | grep "^ *tag.line" >actual && test_cmp expect actual && - git-tag -n4 -l tag-lines >actual && + git tag -n4 -l tag-lines >actual && test_cmp expect actual && - git-tag -n99 -l | grep "^ *tag.line" >actual && + git tag -n99 -l | grep "^ *tag.line" >actual && test_cmp expect actual && - git-tag -n99 -l tag-lines >actual && + git tag -n99 -l tag-lines >actual && test_cmp expect actual ' @@ -592,19 +592,19 @@ fi test_expect_success \ 'trying to verify an annotated non-signed tag should fail' ' tag_exists annotated-tag && - test_must_fail git-tag -v annotated-tag + test_must_fail git tag -v annotated-tag ' test_expect_success \ 'trying to verify a file-annotated non-signed tag should fail' ' tag_exists file-annotated-tag && - test_must_fail git-tag -v file-annotated-tag + test_must_fail git tag -v file-annotated-tag ' test_expect_success \ 'trying to verify two annotated non-signed tags should fail' ' tag_exists annotated-tag file-annotated-tag && - test_must_fail git-tag -v annotated-tag file-annotated-tag + test_must_fail git tag -v annotated-tag file-annotated-tag ' # creating and verifying signed tags: @@ -625,7 +625,7 @@ esac # Name and email: C O Mitter <committer@example.com> # No password given, to enable non-interactive operation. -cp -R ../t7004 ./gpghome +cp -R "$TEST_DIRECTORY"/t7004 ./gpghome chmod 0700 gpghome GNUPGHOME="$(pwd)/gpghome" export GNUPGHOME @@ -634,7 +634,7 @@ get_tag_header signed-tag $commit commit $time >expect echo 'A signed tag message' >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success 'creating a signed tag with -m message should succeed' ' - git-tag -s -m "A signed tag message" signed-tag && + git tag -s -m "A signed tag message" signed-tag && get_tag_msg signed-tag >actual && test_cmp expect actual ' @@ -675,7 +675,7 @@ get_tag_header implied-sign $commit commit $time >expect ./fakeeditor >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success '-u implies signed tag' ' - GIT_EDITOR=./fakeeditor git-tag -u CDDE430D implied-sign && + GIT_EDITOR=./fakeeditor git tag -u CDDE430D implied-sign && get_tag_msg implied-sign >actual && test_cmp expect actual ' @@ -689,7 +689,7 @@ cat sigmsgfile >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag with -F messagefile should succeed' ' - git-tag -s -F sigmsgfile file-signed-tag && + git tag -s -F sigmsgfile file-signed-tag && get_tag_msg file-signed-tag >actual && test_cmp expect actual ' @@ -702,7 +702,7 @@ get_tag_header stdin-signed-tag $commit commit $time >expect cat siginputmsg >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success 'creating a signed tag with -F - should succeed' ' - git-tag -s -F - stdin-signed-tag <siginputmsg && + git tag -s -F - stdin-signed-tag <siginputmsg && get_tag_msg stdin-signed-tag >actual && test_cmp expect actual ' @@ -711,7 +711,7 @@ get_tag_header implied-annotate $commit commit $time >expect ./fakeeditor >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success '-s implies annotated tag' ' - GIT_EDITOR=./fakeeditor git-tag -s implied-annotate && + GIT_EDITOR=./fakeeditor git tag -s implied-annotate && get_tag_msg implied-annotate >actual && test_cmp expect actual ' @@ -720,23 +720,23 @@ test_expect_success \ 'trying to create a signed tag with non-existing -F file should fail' ' ! test -f nonexistingfile && ! tag_exists nosigtag && - test_must_fail git-tag -s -F nonexistingfile nosigtag && + test_must_fail git tag -s -F nonexistingfile nosigtag && ! tag_exists nosigtag ' test_expect_success 'verifying a signed tag should succeed' \ - 'git-tag -v signed-tag' + 'git tag -v signed-tag' test_expect_success 'verifying two signed tags in one command should succeed' \ - 'git-tag -v signed-tag file-signed-tag' + 'git tag -v signed-tag file-signed-tag' test_expect_success \ 'verifying many signed and non-signed tags should fail' ' - test_must_fail git-tag -v signed-tag annotated-tag && - test_must_fail git-tag -v file-annotated-tag file-signed-tag && - test_must_fail git-tag -v annotated-tag \ + test_must_fail git tag -v signed-tag annotated-tag && + test_must_fail git tag -v file-annotated-tag file-signed-tag && + test_must_fail git tag -v annotated-tag \ file-signed-tag file-annotated-tag && - test_must_fail git-tag -v signed-tag annotated-tag file-signed-tag + test_must_fail git tag -v signed-tag annotated-tag file-signed-tag ' test_expect_success 'verifying a forged tag should fail' ' @@ -744,7 +744,7 @@ test_expect_success 'verifying a forged tag should fail' ' sed -e "s/signed-tag/forged-tag/" | git mktag) && git tag forged-tag $forged && - test_must_fail git-tag -v forged-tag + test_must_fail git tag -v forged-tag ' # blank and empty messages for signed tags: @@ -753,10 +753,10 @@ get_tag_header empty-signed-tag $commit commit $time >expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag with an empty -m message should succeed' ' - git-tag -s -m "" empty-signed-tag && + git tag -s -m "" empty-signed-tag && get_tag_msg empty-signed-tag >actual && test_cmp expect actual && - git-tag -v empty-signed-tag + git tag -v empty-signed-tag ' >sigemptyfile @@ -764,10 +764,10 @@ get_tag_header emptyfile-signed-tag $commit commit $time >expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag with an empty -F messagefile should succeed' ' - git-tag -s -F sigemptyfile emptyfile-signed-tag && + git tag -s -F sigemptyfile emptyfile-signed-tag && get_tag_msg emptyfile-signed-tag >actual && test_cmp expect actual && - git-tag -v emptyfile-signed-tag + git tag -v emptyfile-signed-tag ' printf '\n\n \n\t\nLeading blank lines\n' > sigblanksfile @@ -787,20 +787,20 @@ EOF echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'extra blanks in the message for a signed tag should be removed' ' - git-tag -s -F sigblanksfile blanks-signed-tag && + git tag -s -F sigblanksfile blanks-signed-tag && get_tag_msg blanks-signed-tag >actual && test_cmp expect actual && - git-tag -v blanks-signed-tag + git tag -v blanks-signed-tag ' get_tag_header blank-signed-tag $commit commit $time >expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag with a blank -m message should succeed' ' - git-tag -s -m " " blank-signed-tag && + git tag -s -m " " blank-signed-tag && get_tag_msg blank-signed-tag >actual && test_cmp expect actual && - git-tag -v blank-signed-tag + git tag -v blank-signed-tag ' echo ' ' >sigblankfile @@ -810,10 +810,10 @@ get_tag_header blankfile-signed-tag $commit commit $time >expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag with blank -F file with spaces should succeed' ' - git-tag -s -F sigblankfile blankfile-signed-tag && + git tag -s -F sigblankfile blankfile-signed-tag && get_tag_msg blankfile-signed-tag >actual && test_cmp expect actual && - git-tag -v blankfile-signed-tag + git tag -v blankfile-signed-tag ' printf ' ' >sigblanknonlfile @@ -821,10 +821,10 @@ get_tag_header blanknonlfile-signed-tag $commit commit $time >expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag with spaces and no newline should succeed' ' - git-tag -s -F sigblanknonlfile blanknonlfile-signed-tag && + git tag -s -F sigblanknonlfile blanknonlfile-signed-tag && get_tag_msg blanknonlfile-signed-tag >actual && test_cmp expect actual && - git-tag -v signed-tag + git tag -v signed-tag ' # messages with commented lines for signed tags: @@ -858,20 +858,20 @@ EOF echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag with a -F file with #comments should succeed' ' - git-tag -s -F sigcommentsfile comments-signed-tag && + git tag -s -F sigcommentsfile comments-signed-tag && get_tag_msg comments-signed-tag >actual && test_cmp expect actual && - git-tag -v comments-signed-tag + git tag -v comments-signed-tag ' get_tag_header comment-signed-tag $commit commit $time >expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag with #commented -m message should succeed' ' - git-tag -s -m "#comment" comment-signed-tag && + git tag -s -m "#comment" comment-signed-tag && get_tag_msg comment-signed-tag >actual && test_cmp expect actual && - git-tag -v comment-signed-tag + git tag -v comment-signed-tag ' echo '#comment' >sigcommentfile @@ -881,10 +881,10 @@ get_tag_header commentfile-signed-tag $commit commit $time >expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag with #commented -F messagefile should succeed' ' - git-tag -s -F sigcommentfile commentfile-signed-tag && + git tag -s -F sigcommentfile commentfile-signed-tag && get_tag_msg commentfile-signed-tag >actual && test_cmp expect actual && - git-tag -v commentfile-signed-tag + git tag -v commentfile-signed-tag ' printf '#comment' >sigcommentnonlfile @@ -892,61 +892,61 @@ get_tag_header commentnonlfile-signed-tag $commit commit $time >expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag with a #comment and no newline should succeed' ' - git-tag -s -F sigcommentnonlfile commentnonlfile-signed-tag && + git tag -s -F sigcommentnonlfile commentnonlfile-signed-tag && get_tag_msg commentnonlfile-signed-tag >actual && test_cmp expect actual && - git-tag -v commentnonlfile-signed-tag + git tag -v commentnonlfile-signed-tag ' # listing messages for signed tags: test_expect_success \ 'listing the one-line message of a signed tag should succeed' ' - git-tag -s -m "A message line signed" stag-one-line && + git tag -s -m "A message line signed" stag-one-line && echo "stag-one-line" >expect && - git-tag -l | grep "^stag-one-line" >actual && + git tag -l | grep "^stag-one-line" >actual && test_cmp expect actual && - git-tag -n0 -l | grep "^stag-one-line" >actual && + git tag -n0 -l | grep "^stag-one-line" >actual && test_cmp expect actual && - git-tag -n0 -l stag-one-line >actual && + git tag -n0 -l stag-one-line >actual && test_cmp expect actual && echo "stag-one-line A message line signed" >expect && - git-tag -n1 -l | grep "^stag-one-line" >actual && + git tag -n1 -l | grep "^stag-one-line" >actual && test_cmp expect actual && - git-tag -n -l | grep "^stag-one-line" >actual && + git tag -n -l | grep "^stag-one-line" >actual && test_cmp expect actual && - git-tag -n1 -l stag-one-line >actual && + git tag -n1 -l stag-one-line >actual && test_cmp expect actual && - git-tag -n2 -l stag-one-line >actual && + git tag -n2 -l stag-one-line >actual && test_cmp expect actual && - git-tag -n999 -l stag-one-line >actual && + git tag -n999 -l stag-one-line >actual && test_cmp expect actual ' test_expect_success \ 'listing the zero-lines message of a signed tag should succeed' ' - git-tag -s -m "" stag-zero-lines && + git tag -s -m "" stag-zero-lines && echo "stag-zero-lines" >expect && - git-tag -l | grep "^stag-zero-lines" >actual && + git tag -l | grep "^stag-zero-lines" >actual && test_cmp expect actual && - git-tag -n0 -l | grep "^stag-zero-lines" >actual && + git tag -n0 -l | grep "^stag-zero-lines" >actual && test_cmp expect actual && - git-tag -n0 -l stag-zero-lines >actual && + git tag -n0 -l stag-zero-lines >actual && test_cmp expect actual && echo "stag-zero-lines " >expect && - git-tag -n1 -l | grep "^stag-zero-lines" >actual && + git tag -n1 -l | grep "^stag-zero-lines" >actual && test_cmp expect actual && - git-tag -n -l | grep "^stag-zero-lines" >actual && + git tag -n -l | grep "^stag-zero-lines" >actual && test_cmp expect actual && - git-tag -n1 -l stag-zero-lines >actual && + git tag -n1 -l stag-zero-lines >actual && test_cmp expect actual && - git-tag -n2 -l stag-zero-lines >actual && + git tag -n2 -l stag-zero-lines >actual && test_cmp expect actual && - git-tag -n999 -l stag-zero-lines >actual && + git tag -n999 -l stag-zero-lines >actual && test_cmp expect actual ' @@ -955,42 +955,42 @@ echo 'stag line two' >>sigtagmsg echo 'stag line three' >>sigtagmsg test_expect_success \ 'listing many message lines of a signed tag should succeed' ' - git-tag -s -F sigtagmsg stag-lines && + git tag -s -F sigtagmsg stag-lines && echo "stag-lines" >expect && - git-tag -l | grep "^stag-lines" >actual && + git tag -l | grep "^stag-lines" >actual && test_cmp expect actual && - git-tag -n0 -l | grep "^stag-lines" >actual && + git tag -n0 -l | grep "^stag-lines" >actual && test_cmp expect actual && - git-tag -n0 -l stag-lines >actual && + git tag -n0 -l stag-lines >actual && test_cmp expect actual && echo "stag-lines stag line one" >expect && - git-tag -n1 -l | grep "^stag-lines" >actual && + git tag -n1 -l | grep "^stag-lines" >actual && test_cmp expect actual && - git-tag -n -l | grep "^stag-lines" >actual && + git tag -n -l | grep "^stag-lines" >actual && test_cmp expect actual && - git-tag -n1 -l stag-lines >actual && + git tag -n1 -l stag-lines >actual && test_cmp expect actual && echo " stag line two" >>expect && - git-tag -n2 -l | grep "^ *stag.line" >actual && + git tag -n2 -l | grep "^ *stag.line" >actual && test_cmp expect actual && - git-tag -n2 -l stag-lines >actual && + git tag -n2 -l stag-lines >actual && test_cmp expect actual && echo " stag line three" >>expect && - git-tag -n3 -l | grep "^ *stag.line" >actual && + git tag -n3 -l | grep "^ *stag.line" >actual && test_cmp expect actual && - git-tag -n3 -l stag-lines >actual && + git tag -n3 -l stag-lines >actual && test_cmp expect actual && - git-tag -n4 -l | grep "^ *stag.line" >actual && + git tag -n4 -l | grep "^ *stag.line" >actual && test_cmp expect actual && - git-tag -n4 -l stag-lines >actual && + git tag -n4 -l stag-lines >actual && test_cmp expect actual && - git-tag -n99 -l | grep "^ *stag.line" >actual && + git tag -n99 -l | grep "^ *stag.line" >actual && test_cmp expect actual && - git-tag -n99 -l stag-lines >actual && + git tag -n99 -l stag-lines >actual && test_cmp expect actual ' @@ -1005,7 +1005,7 @@ echo "A message for a tree" >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag pointing to a tree should succeed' ' - git-tag -s -m "A message for a tree" tree-signed-tag HEAD^{tree} && + git tag -s -m "A message for a tree" tree-signed-tag HEAD^{tree} && get_tag_msg tree-signed-tag >actual && test_cmp expect actual ' @@ -1015,7 +1015,7 @@ echo "A message for a blob" >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag pointing to a blob should succeed' ' - git-tag -s -m "A message for a blob" blob-signed-tag HEAD:foo && + git tag -s -m "A message for a blob" blob-signed-tag HEAD:foo && get_tag_msg blob-signed-tag >actual && test_cmp expect actual ' @@ -1025,7 +1025,7 @@ echo "A message for another tag" >>expect echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success \ 'creating a signed tag pointing to another tag should succeed' ' - git-tag -s -m "A message for another tag" tag-signed-tag signed-tag && + git tag -s -m "A message for another tag" tag-signed-tag signed-tag && get_tag_msg tag-signed-tag >actual && test_cmp expect actual ' @@ -1033,7 +1033,7 @@ test_expect_success \ # try to sign with bad user.signingkey git config user.signingkey BobTheMouse test_expect_success \ - 'git-tag -s fails if gpg is misconfigured' \ + 'git tag -s fails if gpg is misconfigured' \ 'test_must_fail git tag -s -m tail tag-gpg-failure' git config --unset user.signingkey @@ -1042,10 +1042,10 @@ git config --unset user.signingkey rm -rf gpghome test_expect_success \ 'verify signed tag fails when public key is not present' \ - 'test_must_fail git-tag -v signed-tag' + 'test_must_fail git tag -v signed-tag' test_expect_success \ - 'git-tag -a fails if tag annotation is empty' ' + 'git tag -a fails if tag annotation is empty' ' ! (GIT_EDITOR=cat git tag -a initial-comment) ' diff --git a/t/t7101-reset.sh b/t/t7101-reset.sh index 0d9874bfd..96e163f08 100755 --- a/t/t7101-reset.sh +++ b/t/t7101-reset.sh @@ -3,33 +3,33 @@ # Copyright (c) 2006 Shawn Pearce # -test_description='git-reset should cull empty subdirs' +test_description='git reset should cull empty subdirs' . ./test-lib.sh test_expect_success \ 'creating initial files' \ 'mkdir path0 && - cp ../../COPYING path0/COPYING && + cp "$TEST_DIRECTORY"/../COPYING path0/COPYING && git add path0/COPYING && - git-commit -m add -a' + git commit -m add -a' test_expect_success \ 'creating second files' \ 'mkdir path1 && mkdir path1/path2 && - cp ../../COPYING path1/path2/COPYING && - cp ../../COPYING path1/COPYING && - cp ../../COPYING COPYING && - cp ../../COPYING path0/COPYING-TOO && + cp "$TEST_DIRECTORY"/../COPYING path1/path2/COPYING && + cp "$TEST_DIRECTORY"/../COPYING path1/COPYING && + cp "$TEST_DIRECTORY"/../COPYING COPYING && + cp "$TEST_DIRECTORY"/../COPYING path0/COPYING-TOO && git add path1/path2/COPYING && git add path1/COPYING && git add COPYING && git add path0/COPYING-TOO && - git-commit -m change -a' + git commit -m change -a' test_expect_success \ 'resetting tree HEAD^' \ - 'git-reset --hard HEAD^' + 'git reset --hard HEAD^' test_expect_success \ 'checking initial files exist after rewind' \ diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 29f5678b4..e637c7d4d 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -3,9 +3,9 @@ # Copyright (c) 2007 Carlos Rica # -test_description='git-reset +test_description='git reset -Documented tests for git-reset' +Documented tests for git reset' . ./test-lib.sh diff --git a/t/t7103-reset-bare.sh b/t/t7103-reset-bare.sh index cdecebe45..42bf518c6 100755 --- a/t/t7103-reset-bare.sh +++ b/t/t7103-reset-bare.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-reset in a bare repository' +test_description='git reset in a bare repository' . ./test-lib.sh test_expect_success 'setup non-bare' ' diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 9ad5d635a..25181388f 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Junio C Hamano # -test_description='git-checkout tests. +test_description='git checkout tests. Creates master, forks renamer and side branches from it. Test switching across them. @@ -337,4 +337,58 @@ test_expect_success \ test refs/heads/delete-me = "$(git symbolic-ref HEAD)" && test_must_fail git checkout --track -b track' +test_expect_success \ + 'checkout with --track fakes a sensible -b <name>' ' + git update-ref refs/remotes/origin/koala/bear renamer && + git update-ref refs/new/koala/bear renamer && + + git checkout --track origin/koala/bear && + test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" && + test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" && + + git checkout master && git branch -D koala/bear && + + git checkout --track refs/remotes/origin/koala/bear && + test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" && + test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" && + + git checkout master && git branch -D koala/bear && + + git checkout --track remotes/origin/koala/bear && + test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" && + test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" && + + git checkout master && git branch -D koala/bear && + + git checkout --track refs/new/koala/bear && + test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" && + test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" +' + +test_expect_success \ + 'checkout with --track, but without -b, fails with too short tracked name' ' + test_must_fail git checkout --track renamer' + +test_expect_success 'checkout an unmerged path should fail' ' + rm -f .git/index && + O=$(echo original | git hash-object -w --stdin) && + A=$(echo ourside | git hash-object -w --stdin) && + B=$(echo theirside | git hash-object -w --stdin) && + ( + echo "100644 $A 0 fild" && + echo "100644 $O 1 file" && + echo "100644 $A 2 file" && + echo "100644 $B 3 file" && + echo "100644 $A 0 filf" + ) | git update-index --index-info && + echo "none of the above" >sample && + cat sample >fild && + cat sample >file && + cat sample >filf && + test_must_fail git checkout fild file filf && + test_cmp sample fild && + test_cmp sample filf && + test_cmp sample file +' + test_done diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index 2b51c0d7d..1636fac2a 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Michael Spang # -test_description='git-clean basic tests' +test_description='git clean basic tests' . ./test-lib.sh @@ -16,17 +16,17 @@ test_expect_success 'setup' ' echo build >.gitignore && echo \*.o >>.gitignore && git add . && - git-commit -m setup && + git commit -m setup && touch src/part2.c README && git add . ' -test_expect_success 'git-clean' ' +test_expect_success 'git clean' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && - git-clean && + git clean && test -f Makefile && test -f README && test -f src/part1.c && @@ -39,11 +39,11 @@ test_expect_success 'git-clean' ' ' -test_expect_success 'git-clean src/' ' +test_expect_success 'git clean src/' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && - git-clean src/ && + git clean src/ && test -f Makefile && test -f README && test -f src/part1.c && @@ -56,11 +56,11 @@ test_expect_success 'git-clean src/' ' ' -test_expect_success 'git-clean src/ src/' ' +test_expect_success 'git clean src/ src/' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && - git-clean src/ src/ && + git clean src/ src/ && test -f Makefile && test -f README && test -f src/part1.c && @@ -73,11 +73,11 @@ test_expect_success 'git-clean src/ src/' ' ' -test_expect_success 'git-clean with prefix' ' +test_expect_success 'git clean with prefix' ' mkdir -p build docs src/test && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so src/test/1.c && - (cd src/ && git-clean) && + (cd src/ && git clean) && test -f Makefile && test -f README && test -f src/part1.c && @@ -91,7 +91,7 @@ test_expect_success 'git-clean with prefix' ' ' -test_expect_success 'git-clean with relative prefix' ' +test_expect_success 'git clean with relative prefix' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && @@ -106,7 +106,7 @@ test_expect_success 'git-clean with relative prefix' ' } ' -test_expect_success 'git-clean with absolute path' ' +test_expect_success 'git clean with absolute path' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && @@ -121,7 +121,7 @@ test_expect_success 'git-clean with absolute path' ' } ' -test_expect_success 'git-clean with out of work tree relative path' ' +test_expect_success 'git clean with out of work tree relative path' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && @@ -131,7 +131,7 @@ test_expect_success 'git-clean with out of work tree relative path' ' ) ' -test_expect_success 'git-clean with out of work tree absolute path' ' +test_expect_success 'git clean with out of work tree absolute path' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && @@ -142,11 +142,11 @@ test_expect_success 'git-clean with out of work tree absolute path' ' ) ' -test_expect_success 'git-clean -d with prefix and path' ' +test_expect_success 'git clean -d with prefix and path' ' mkdir -p build docs src/feature && touch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so && - (cd src/ && git-clean -d feature/) && + (cd src/ && git clean -d feature/) && test -f Makefile && test -f README && test -f src/part1.c && @@ -160,12 +160,12 @@ test_expect_success 'git-clean -d with prefix and path' ' ' -test_expect_success 'git-clean symbolic link' ' +test_expect_success 'git clean symbolic link' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && ln -s docs/manual.txt src/part4.c - git-clean && + git clean && test -f Makefile && test -f README && test -f src/part1.c && @@ -179,10 +179,10 @@ test_expect_success 'git-clean symbolic link' ' ' -test_expect_success 'git-clean with wildcard' ' +test_expect_success 'git clean with wildcard' ' touch a.clean b.clean other.c && - git-clean "*.clean" && + git clean "*.clean" && test -f Makefile && test -f README && test -f src/part1.c && @@ -193,11 +193,11 @@ test_expect_success 'git-clean with wildcard' ' ' -test_expect_success 'git-clean -n' ' +test_expect_success 'git clean -n' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && - git-clean -n && + git clean -n && test -f Makefile && test -f README && test -f src/part1.c && @@ -210,11 +210,11 @@ test_expect_success 'git-clean -n' ' ' -test_expect_success 'git-clean -d' ' +test_expect_success 'git clean -d' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && - git-clean -d && + git clean -d && test -f Makefile && test -f README && test -f src/part1.c && @@ -227,11 +227,11 @@ test_expect_success 'git-clean -d' ' ' -test_expect_success 'git-clean -d src/ examples/' ' +test_expect_success 'git clean -d src/ examples/' ' mkdir -p build docs examples && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c && - git-clean -d src/ examples/ && + git clean -d src/ examples/ && test -f Makefile && test -f README && test -f src/part1.c && @@ -245,11 +245,11 @@ test_expect_success 'git-clean -d src/ examples/' ' ' -test_expect_success 'git-clean -x' ' +test_expect_success 'git clean -x' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && - git-clean -x && + git clean -x && test -f Makefile && test -f README && test -f src/part1.c && @@ -262,11 +262,11 @@ test_expect_success 'git-clean -x' ' ' -test_expect_success 'git-clean -d -x' ' +test_expect_success 'git clean -d -x' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && - git-clean -d -x && + git clean -d -x && test -f Makefile && test -f README && test -f src/part1.c && @@ -279,11 +279,11 @@ test_expect_success 'git-clean -d -x' ' ' -test_expect_success 'git-clean -X' ' +test_expect_success 'git clean -X' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && - git-clean -X && + git clean -X && test -f Makefile && test -f README && test -f src/part1.c && @@ -296,11 +296,11 @@ test_expect_success 'git-clean -X' ' ' -test_expect_success 'git-clean -d -X' ' +test_expect_success 'git clean -d -X' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && - git-clean -d -X && + git clean -d -X && test -f Makefile && test -f README && test -f src/part1.c && @@ -331,7 +331,7 @@ test_expect_success 'clean.requireForce and -n' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && - git-clean -n && + git clean -n && test -f Makefile && test -f README && test -f src/part1.c && @@ -346,7 +346,7 @@ test_expect_success 'clean.requireForce and -n' ' test_expect_success 'clean.requireForce and -f' ' - git-clean -f && + git clean -f && test -f README && test -f src/part1.c && test -f src/part2.c && diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index cbc0c34ce..be73f7b60 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -6,7 +6,7 @@ test_description='Basic porcelain support for submodules This test tries to verify basic sanity of the init, update and status -subcommands of git-submodule. +subcommands of git submodule. ' . ./test-lib.sh @@ -22,16 +22,16 @@ subcommands of git-submodule. # test_expect_success 'Prepare submodule testing' ' : > t && - git-add t && - git-commit -m "initial commit" && + git add t && + git commit -m "initial commit" && git branch initial HEAD && mkdir init && cd init && git init && echo a >a && git add a && - git-commit -m "submodule commit 1" && - git-tag -a -m "rev-1" rev-1 && + git commit -m "submodule commit 1" && + git tag -a -m "rev-1" rev-1 && rev1=$(git rev-parse HEAD) && if test -z "$rev1" then @@ -42,13 +42,13 @@ test_expect_success 'Prepare submodule testing' ' echo a >a && echo z >z && git add a init z && - git-commit -m "super commit 1" && + git commit -m "super commit 1" && mv init .subrepo && GIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git ' test_expect_success 'status should fail for unmapped paths' ' - if git-submodule status + if git submodule status then echo "[OOPS] submodule status succeeded" false @@ -60,16 +60,16 @@ test_expect_success 'status should fail for unmapped paths' ' ' test_expect_success 'status should only print one line' ' - lines=$(git-submodule status | wc -l) && + lines=$(git submodule status | wc -l) && test $lines = 1 ' test_expect_success 'status should initially be "missing"' ' - git-submodule status | grep "^-$rev1" + git submodule status | grep "^-$rev1" ' test_expect_success 'init should register submodule url in .git/config' ' - git-submodule init && + git submodule init && url=$(git config submodule.example.url) && if test "$url" != "git://example.com/init.git" then @@ -84,7 +84,7 @@ test_expect_success 'init should register submodule url in .git/config' ' test_expect_success 'update should fail when path is used by a file' ' echo "hello" >init && - if git-submodule update + if git submodule update then echo "[OOPS] update should have failed" false @@ -100,7 +100,7 @@ test_expect_success 'update should fail when path is used by a file' ' test_expect_success 'update should fail when path is used by a nonempty directory' ' mkdir init && echo "hello" >init/a && - if git-submodule update + if git submodule update then echo "[OOPS] update should have failed" false @@ -116,7 +116,7 @@ test_expect_success 'update should fail when path is used by a nonempty director test_expect_success 'update should work when path is an empty dir' ' rm -rf init && mkdir init && - git-submodule update && + git submodule update && head=$(cd init && git rev-parse HEAD) && if test -z "$head" then @@ -130,14 +130,14 @@ test_expect_success 'update should work when path is an empty dir' ' ' test_expect_success 'status should be "up-to-date" after update' ' - git-submodule status | grep "^ $rev1" + git submodule status | grep "^ $rev1" ' test_expect_success 'status should be "modified" after submodule commit' ' cd init && echo b >b && git add b && - git-commit -m "submodule commit 2" && + git commit -m "submodule commit 2" && rev2=$(git rev-parse HEAD) && cd .. && if test -z "$rev2" @@ -145,19 +145,19 @@ test_expect_success 'status should be "modified" after submodule commit' ' echo "[OOPS] submodule git rev-parse returned nothing" false fi && - git-submodule status | grep "^+$rev2" + git submodule status | grep "^+$rev2" ' test_expect_success 'the --cached sha1 should be rev1' ' - git-submodule --cached status | grep "^+$rev1" + git submodule --cached status | grep "^+$rev1" ' test_expect_success 'git diff should report the SHA1 of the new submodule commit' ' - git-diff | grep "^+Subproject commit $rev2" + git diff | grep "^+Subproject commit $rev2" ' test_expect_success 'update should checkout rev1' ' - git-submodule update init && + git submodule update init && head=$(cd init && git rev-parse HEAD) && if test -z "$head" then @@ -171,12 +171,12 @@ test_expect_success 'update should checkout rev1' ' ' test_expect_success 'status should be "up-to-date" after update' ' - git-submodule status | grep "^ $rev1" + git submodule status | grep "^ $rev1" ' test_expect_success 'checkout superproject with subproject already present' ' - git-checkout initial && - git-checkout master + git checkout initial && + git checkout master ' test_expect_success 'apply submodule diff' ' @@ -188,8 +188,8 @@ test_expect_success 'apply submodule diff' ' git commit -m "change subproject" ) && git update-index --add init && - git-commit -m "change init" && - git-format-patch -1 --stdout >P.diff && + git commit -m "change init" && + git format-patch -1 --stdout >P.diff && git checkout second && git apply --index P.diff && D=$(git diff --cached master) && diff --git a/t/t7401-submodule-summary.sh b/t/t7401-submodule-summary.sh index bf12dbdee..61498293b 100755 --- a/t/t7401-submodule-summary.sh +++ b/t/t7401-submodule-summary.sh @@ -5,7 +5,7 @@ test_description='Summary support for submodules -This test tries to verify the sanity of summary subcommand of git-submodule. +This test tries to verify the sanity of summary subcommand of git submodule. ' . ./test-lib.sh diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh index 809bdba63..6e18a9631 100755 --- a/t/t7500-commit.sh +++ b/t/t7500-commit.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Steven Grimm # -test_description='git-commit +test_description='git commit Tests for selected commit options.' @@ -46,15 +46,24 @@ test_expect_success 'unedited template with comments should not commit' ' ' test_expect_success 'a Signed-off-by line by itself should not commit' ' - ! GIT_EDITOR=../t7500/add-signed-off git commit --template "$TEMPLATE" + ( + test_set_editor "$TEST_DIRECTORY"/t7500/add-signed-off && + test_must_fail git commit --template "$TEMPLATE" + ) ' test_expect_success 'adding comments to a template should not commit' ' - ! GIT_EDITOR=../t7500/add-comments git commit --template "$TEMPLATE" + ( + test_set_editor "$TEST_DIRECTORY"/t7500/add-comments && + test_must_fail git commit --template "$TEMPLATE" + ) ' test_expect_success 'adding real content to a template should commit' ' - GIT_EDITOR=../t7500/add-content git commit --template "$TEMPLATE" && + ( + test_set_editor "$TEST_DIRECTORY"/t7500/add-content && + git commit --template "$TEMPLATE" + ) && commit_msg_is "template linecommit message" ' @@ -62,7 +71,10 @@ test_expect_success '-t option should be short for --template' ' echo "short template" > "$TEMPLATE" && echo "new content" >> foo && git add foo && - GIT_EDITOR=../t7500/add-content git commit -t "$TEMPLATE" && + ( + test_set_editor "$TEST_DIRECTORY"/t7500/add-content && + git commit -t "$TEMPLATE" + ) && commit_msg_is "short templatecommit message" ' @@ -71,7 +83,10 @@ test_expect_success 'config-specified template should commit' ' git config commit.template "$TEMPLATE" && echo "more content" >> foo && git add foo && - GIT_EDITOR=../t7500/add-content git commit && + ( + test_set_editor "$TEST_DIRECTORY"/t7500/add-content && + git commit + ) && git config --unset commit.template && commit_msg_is "new templatecommit message" ' @@ -79,7 +94,7 @@ test_expect_success 'config-specified template should commit' ' test_expect_success 'explicit commit message should override template' ' echo "still more content" >> foo && git add foo && - GIT_EDITOR=../t7500/add-content git commit --template "$TEMPLATE" \ + GIT_EDITOR="$TEST_DIRECTORY"/t7500/add-content git commit --template "$TEMPLATE" \ -m "command line msg" && commit_msg_is "command line msg" ' @@ -88,8 +103,10 @@ test_expect_success 'commit message from file should override template' ' echo "content galore" >> foo && git add foo && echo "standard input msg" | - GIT_EDITOR=../t7500/add-content git commit \ - --template "$TEMPLATE" --file - && + ( + test_set_editor "$TEST_DIRECTORY"/t7500/add-content && + git commit --template "$TEMPLATE" --file - + ) && commit_msg_is "standard input msg" ' @@ -132,10 +149,12 @@ EOF test_expect_success '--signoff' ' echo "yet another content *narf*" >> foo && - echo "zort" | - GIT_EDITOR=../t7500/add-content git commit -s -F - foo && + echo "zort" | ( + test_set_editor "$TEST_DIRECTORY"/t7500/add-content && + git commit -s -F - foo + ) && git cat-file commit HEAD | sed "1,/^$/d" > output && - diff expect output + test_cmp expect output ' test_expect_success 'commit message from file (1)' ' diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index 0edd9ddf7..469bff887 100755 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -6,7 +6,7 @@ # FIXME: Test the various index usages, -i and -o, test reflog, # signoff -test_description='git-commit' +test_description='git commit' . ./test-lib.sh test_tick @@ -14,52 +14,52 @@ test_tick test_expect_success \ "initial status" \ "echo 'bongo bongo' >file && - git-add file && \ - git-status | grep 'Initial commit'" + git add file && \ + git status | grep 'Initial commit'" test_expect_success \ "fail initial amend" \ - "test_must_fail git-commit --amend" + "test_must_fail git commit --amend" test_expect_success \ "initial commit" \ - "git-commit -m initial" + "git commit -m initial" test_expect_success \ "invalid options 1" \ - "test_must_fail git-commit -m foo -m bar -F file" + "test_must_fail git commit -m foo -m bar -F file" test_expect_success \ "invalid options 2" \ - "test_must_fail git-commit -C HEAD -m illegal" + "test_must_fail git commit -C HEAD -m illegal" test_expect_success \ "using paths with -a" \ "echo King of the bongo >file && - test_must_fail git-commit -m foo -a file" + test_must_fail git commit -m foo -a file" test_expect_success \ "using paths with --interactive" \ "echo bong-o-bong >file && - ! (echo 7 | git-commit -m foo --interactive file)" + ! (echo 7 | git commit -m foo --interactive file)" test_expect_success \ "using invalid commit with -C" \ - "test_must_fail git-commit -C bogus" + "test_must_fail git commit -C bogus" test_expect_success \ "testing nothing to commit" \ - "test_must_fail git-commit -m initial" + "test_must_fail git commit -m initial" test_expect_success \ "next commit" \ "echo 'bongo bongo bongo' >file \ - git-commit -m next -a" + git commit -m next -a" test_expect_success \ "commit message from non-existing file" \ "echo 'more bongo: bongo bongo bongo bongo' >file && \ - test_must_fail git-commit -F gah -a" + test_must_fail git commit -F gah -a" # Empty except stray tabs and spaces on a few lines. sed -e 's/@$//' >msg <<EOF @@ -70,12 +70,12 @@ Signed-off-by: hula EOF test_expect_success \ "empty commit message" \ - "test_must_fail git-commit -F msg -a" + "test_must_fail git commit -F msg -a" test_expect_success \ "commit message from file" \ "echo 'this is the commit message, coming from a file' >msg && \ - git-commit -F msg -a" + git commit -F msg -a" cat >editor <<\EOF #!/bin/sh @@ -86,16 +86,16 @@ chmod 755 editor test_expect_success \ "amend commit" \ - "VISUAL=./editor git-commit --amend" + "VISUAL=./editor git commit --amend" test_expect_success \ "passing -m and -F" \ "echo 'enough with the bongos' >file && \ - test_must_fail git-commit -F msg -m amending ." + test_must_fail git commit -F msg -m amending ." test_expect_success \ "using message from other commit" \ - "git-commit -C HEAD^ ." + "git commit -C HEAD^ ." cat >editor <<\EOF #!/bin/sh @@ -107,25 +107,25 @@ chmod 755 editor test_expect_success \ "editing message from other commit" \ "echo 'hula hula' >file && \ - VISUAL=./editor git-commit -c HEAD^ -a" + VISUAL=./editor git commit -c HEAD^ -a" test_expect_success \ "message from stdin" \ "echo 'silly new contents' >file && \ - echo commit message from stdin | git-commit -F - -a" + echo commit message from stdin | git commit -F - -a" test_expect_success \ "overriding author from command line" \ "echo 'gak' >file && \ - git-commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a" + git commit -m 'author' --author 'Rubber Duck <rduck@convoy.org>' -a" test_expect_success \ "interactive add" \ - "echo 7 | git-commit --interactive | grep 'What now'" + "echo 7 | git commit --interactive | grep 'What now'" test_expect_success \ "showing committed revisions" \ - "git-rev-list HEAD >current" + "git rev-list HEAD >current" # We could just check the head sha1, but checking each commit makes it # easier to isolate bugs. @@ -140,7 +140,7 @@ d381ac431806e53f3dd7ac2f1ae0534f36d738b9 EOF test_expect_success \ - 'validate git-rev-list output.' \ + 'validate git rev-list output.' \ 'diff current expected' test_expect_success 'partial commit that involves removal (1)' ' diff --git a/t/t7502-status.sh b/t/t7502-status.sh index 38a48b57c..c8e4c2e7b 100755 --- a/t/t7502-status.sh +++ b/t/t7502-status.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Johannes E. Schindelin # -test_description='git-status' +test_description='git status' . ./test-lib.sh diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh index cd6c7c834..ff189624d 100755 --- a/t/t7505-prepare-commit-msg-hook.sh +++ b/t/t7505-prepare-commit-msg-hook.sh @@ -32,7 +32,7 @@ echo "#!$SHELL_PATH" > "$HOOK" cat >> "$HOOK" <<'EOF' if test "$2" = commit; then - source=$(git-rev-parse "$3") + source=$(git rev-parse "$3") else source=${2-default} fi diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh index a75130cdb..d9a08aac5 100755 --- a/t/t7506-status-submodule.sh +++ b/t/t7506-status-submodule.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-status for submodule' +test_description='git status for submodule' . ./test-lib.sh diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index 5eeb6c2b2..9516f541e 100755 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Lars Hjemli # -test_description='git-merge +test_description='git merge Testing basic merge operations/option parsing.' @@ -230,6 +230,10 @@ test_expect_success 'test option parsing' ' test_must_fail git merge ' +test_expect_success 'reject non-strategy with a git-merge-foo name' ' + test_must_fail git merge -s index c1 +' + test_expect_success 'merge c0 with c1' ' git reset --hard c0 && git merge c1 && @@ -488,4 +492,23 @@ test_expect_success 'merge c1 with c1 and c2' ' test_debug 'gitk --all' +test_expect_success 'merge fast-forward in a dirty tree' ' + git reset --hard c0 && + mv file file1 && + cat file1 >file && + rm -f file1 && + git merge c2 +' + +test_debug 'gitk --all' + +test_expect_success 'in-index merge' ' + git reset --hard c0 && + git merge --no-ff -s resolve c1 > out && + grep "Wonderful." out && + verify_parents $c0 $c1 +' + +test_debug 'gitk --all' + test_done diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh index 55aa6b5f2..7ba94ea99 100755 --- a/t/t7601-merge-pull-config.sh +++ b/t/t7601-merge-pull-config.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-merge +test_description='git merge Testing pull.* configuration parsing.' diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh index fcb828574..01e5415e9 100755 --- a/t/t7602-merge-octopus-many.sh +++ b/t/t7602-merge-octopus-many.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-merge +test_description='git merge Testing octopus merge with more than 25 refs.' diff --git a/t/t7603-merge-reduce-heads.sh b/t/t7603-merge-reduce-heads.sh index 17b19dc11..b47b7b975 100755 --- a/t/t7603-merge-reduce-heads.sh +++ b/t/t7603-merge-reduce-heads.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-merge +test_description='git merge Testing octopus merge when reducing parents to independent branches.' diff --git a/t/t7604-merge-custom-message.sh b/t/t7604-merge-custom-message.sh index 6081677d2..de977c5e2 100755 --- a/t/t7604-merge-custom-message.sh +++ b/t/t7604-merge-custom-message.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-merge +test_description='git merge Testing merge when using a custom message for the merge commit.' diff --git a/t/t7605-merge-resolve.sh b/t/t7605-merge-resolve.sh index ee21a107f..0cb9d11f2 100755 --- a/t/t7605-merge-resolve.sh +++ b/t/t7605-merge-resolve.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-merge +test_description='git merge Testing the resolve strategy.' @@ -36,7 +36,9 @@ test_expect_success 'merge c1 to c2' ' git diff --exit-code && test -f c0.c && test -f c1.c && - test -f c2.c + test -f c2.c && + test 3 = $(git ls-tree -r HEAD | wc -l) && + test 3 = $(git ls-files | wc -l) ' test_expect_success 'merge c2 to c3 (fails)' ' diff --git a/t/t7606-merge-custom.sh b/t/t7606-merge-custom.sh new file mode 100755 index 000000000..de9b6ed5b --- /dev/null +++ b/t/t7606-merge-custom.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +test_description='git-merge + +Testing a custom strategy.' + +. ./test-lib.sh + +cat >git-merge-theirs <<EOF +#!$SHELL_PATH +eval git read-tree --reset -u \\\$\$# +EOF +chmod +x git-merge-theirs +PATH=.:$PATH +export PATH + +test_expect_success 'setup' ' + echo c0 >c0.c && + git add c0.c && + git commit -m c0 && + git tag c0 && + echo c1 >c1.c && + git add c1.c && + git commit -m c1 && + git tag c1 && + git reset --hard c0 && + echo c1c1 >c1.c && + echo c2 >c2.c && + git add c1.c c2.c && + git commit -m c2 && + git tag c2 +' + +test_expect_success 'merge c2 with a custom strategy' ' + git reset --hard c1 && + git merge -s theirs c2 && + test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" && + test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" && + test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" && + test "$(git rev-parse c2^{tree})" = "$(git rev-parse HEAD^{tree})" && + git diff --exit-code && + git diff --exit-code c2 HEAD && + git diff --exit-code c2 && + test -f c0.c && + grep c1c1 c1.c && + test -f c2.c +' + +test_done diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh index 9285071c4..09fa5f115 100755 --- a/t/t7610-mergetool.sh +++ b/t/t7610-mergetool.sh @@ -3,7 +3,7 @@ # Copyright (c) 2008 Charles Bailey # -test_description='git-mergetool +test_description='git mergetool Testing basic merge tool invocation' diff --git a/t/t7701-repack-unpack-unreachable.sh b/t/t7701-repack-unpack-unreachable.sh index 31c340fd3..531dac060 100755 --- a/t/t7701-repack-unpack-unreachable.sh +++ b/t/t7701-repack-unpack-unreachable.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-repack works correctly' +test_description='git repack works correctly' . ./test-lib.sh diff --git a/t/t8001-annotate.sh b/t/t8001-annotate.sh index eabec2e06..45cb60ea4 100755 --- a/t/t8001-annotate.sh +++ b/t/t8001-annotate.sh @@ -4,7 +4,7 @@ test_description='git annotate' . ./test-lib.sh PROG='git annotate' -. ../annotate-tests.sh +. "$TEST_DIRECTORY"/annotate-tests.sh test_expect_success \ 'Annotating an old revision works' \ diff --git a/t/t8002-blame.sh b/t/t8002-blame.sh index 92ece30fa..597cf0486 100755 --- a/t/t8002-blame.sh +++ b/t/t8002-blame.sh @@ -4,6 +4,6 @@ test_description='git blame' . ./test-lib.sh PROG='git blame -c' -. ../annotate-tests.sh +. "$TEST_DIRECTORY"/annotate-tests.sh test_done diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 1c857cf4a..d098a01ba 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-send-email' +test_description='git send-email' . ./test-lib.sh PROG='git send-email' diff --git a/t/t9110-git-svn-use-svm-props.sh b/t/t9110-git-svn-use-svm-props.sh index 04d2a65c0..83bd1cf17 100755 --- a/t/t9110-git-svn-use-svm-props.sh +++ b/t/t9110-git-svn-use-svm-props.sh @@ -8,7 +8,7 @@ test_description='git-svn useSvmProps test' . ./lib-git-svn.sh test_expect_success 'load svm repo' ' - svnadmin load -q "$rawsvnrepo" < ../t9110/svm.dump && + svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9110/svm.dump && git-svn init --minimize-url -R arr -i bar "$svnrepo"/mirror/arr && git-svn init --minimize-url -R argh -i dir "$svnrepo"/mirror/argh && git-svn init --minimize-url -R argh -i e \ diff --git a/t/t9111-git-svn-use-svnsync-props.sh b/t/t9111-git-svn-use-svnsync-props.sh index a8d74dcd3..c5dfd61e4 100755 --- a/t/t9111-git-svn-use-svnsync-props.sh +++ b/t/t9111-git-svn-use-svnsync-props.sh @@ -8,7 +8,7 @@ test_description='git-svn useSvnsyncProps test' . ./lib-git-svn.sh test_expect_success 'load svnsync repo' ' - svnadmin load -q "$rawsvnrepo" < ../t9111/svnsync.dump && + svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9111/svnsync.dump && git-svn init --minimize-url -R arr -i bar "$svnrepo"/bar && git-svn init --minimize-url -R argh -i dir "$svnrepo"/dir && git-svn init --minimize-url -R argh -i e "$svnrepo"/dir/a/b/c/d/e && diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh index f0fbd3aff..b0ba1f020 100755 --- a/t/t9115-git-svn-dcommit-funky-renames.sh +++ b/t/t9115-git-svn-dcommit-funky-renames.sh @@ -8,7 +8,7 @@ test_description='git-svn dcommit can commit renames of files with ugly names' . ./lib-git-svn.sh test_expect_success 'load repository with strange names' ' - svnadmin load -q "$rawsvnrepo" < ../t9115/funky-names.dump && + svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9115/funky-names.dump && start_httpd gtk+ ' diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh index 5fd36a148..3e484594a 100755 --- a/t/t9119-git-svn-info.sh +++ b/t/t9119-git-svn-info.sh @@ -6,12 +6,10 @@ test_description='git-svn info' . ./lib-git-svn.sh -set -e - # Tested with: svn, version 1.4.4 (r25188) -v=`svn --version | sed -n -e 's/^svn, version \(1\.4\.[0-9]\).*$/\1/p'` +v=`svn --version | sed -n -e 's/^svn, version \(1\.[0-9]*\.[0-9]*\).*$/\1/p'` case $v in -1.4.*) +1.[45].*) ;; *) say "skipping svn-info test (SVN version: $v not supported)" @@ -36,6 +34,8 @@ ptouch() { ' "`svn info $2 | grep '^Text Last Updated:'`" "$1" } +quoted_svnrepo="$(echo $svnrepo | sed 's/ /%20/')" + test_expect_success 'setup repository and import' ' mkdir info && cd info && @@ -47,67 +47,79 @@ test_expect_success 'setup repository and import' ' ln -s directory symlink-directory && svn import -m "initial" . "$svnrepo" && cd .. && + svn co "$svnrepo" svnwc && + cd svnwc && + echo foo > foo && + svn add foo && + svn commit -m "change outside directory" && + svn update && + cd .. && mkdir gitwc && cd gitwc && git-svn init "$svnrepo" && git-svn fetch && cd .. && - svn co "$svnrepo" svnwc && - ptouch svnwc/file gitwc/file && - ptouch svnwc/directory gitwc/directory && - ptouch svnwc/symlink-file gitwc/symlink-file && - ptouch svnwc/symlink-directory gitwc/symlink-directory + ptouch gitwc/file svnwc/file && + ptouch gitwc/directory svnwc/directory && + ptouch gitwc/symlink-file svnwc/symlink-file && + ptouch gitwc/symlink-directory svnwc/symlink-directory ' test_expect_success 'info' " (cd svnwc; svn info) > expected.info && (cd gitwc; git-svn info) > actual.info && - git-diff expected.info actual.info + test_cmp expected.info actual.info " test_expect_success 'info --url' ' - test "$(cd gitwc; git-svn info --url)" = "$svnrepo" + test "$(cd gitwc; git-svn info --url)" = "$quoted_svnrepo" ' test_expect_success 'info .' " (cd svnwc; svn info .) > expected.info-dot && (cd gitwc; git-svn info .) > actual.info-dot && - git-diff expected.info-dot actual.info-dot + test_cmp expected.info-dot actual.info-dot " test_expect_success 'info --url .' ' - test "$(cd gitwc; git-svn info --url .)" = "$svnrepo" + test "$(cd gitwc; git-svn info --url .)" = "$quoted_svnrepo" ' test_expect_success 'info file' " (cd svnwc; svn info file) > expected.info-file && (cd gitwc; git-svn info file) > actual.info-file && - git-diff expected.info-file actual.info-file + test_cmp expected.info-file actual.info-file " test_expect_success 'info --url file' ' - test "$(cd gitwc; git-svn info --url file)" = "$svnrepo/file" + test "$(cd gitwc; git-svn info --url file)" = "$quoted_svnrepo/file" ' test_expect_success 'info directory' " (cd svnwc; svn info directory) > expected.info-directory && (cd gitwc; git-svn info directory) > actual.info-directory && - git-diff expected.info-directory actual.info-directory + test_cmp expected.info-directory actual.info-directory + " + +test_expect_success 'info inside directory' " + (cd svnwc/directory; svn info) > expected.info-inside-directory && + (cd gitwc/directory; git-svn info) > actual.info-inside-directory && + test_cmp expected.info-inside-directory actual.info-inside-directory " test_expect_success 'info --url directory' ' - test "$(cd gitwc; git-svn info --url directory)" = "$svnrepo/directory" + test "$(cd gitwc; git-svn info --url directory)" = "$quoted_svnrepo/directory" ' test_expect_success 'info symlink-file' " (cd svnwc; svn info symlink-file) > expected.info-symlink-file && (cd gitwc; git-svn info symlink-file) > actual.info-symlink-file && - git-diff expected.info-symlink-file actual.info-symlink-file + test_cmp expected.info-symlink-file actual.info-symlink-file " test_expect_success 'info --url symlink-file' ' test "$(cd gitwc; git-svn info --url symlink-file)" \ - = "$svnrepo/symlink-file" + = "$quoted_svnrepo/symlink-file" ' test_expect_success 'info symlink-directory' " @@ -115,12 +127,12 @@ test_expect_success 'info symlink-directory' " > expected.info-symlink-directory && (cd gitwc; git-svn info symlink-directory) \ > actual.info-symlink-directory && - git-diff expected.info-symlink-directory actual.info-symlink-directory + test_cmp expected.info-symlink-directory actual.info-symlink-directory " test_expect_success 'info --url symlink-directory' ' test "$(cd gitwc; git-svn info --url symlink-directory)" \ - = "$svnrepo/symlink-directory" + = "$quoted_svnrepo/symlink-directory" ' test_expect_success 'info added-file' " @@ -135,12 +147,12 @@ test_expect_success 'info added-file' " cd .. && (cd svnwc; svn info added-file) > expected.info-added-file && (cd gitwc; git-svn info added-file) > actual.info-added-file && - git-diff expected.info-added-file actual.info-added-file + test_cmp expected.info-added-file actual.info-added-file " test_expect_success 'info --url added-file' ' test "$(cd gitwc; git-svn info --url added-file)" \ - = "$svnrepo/added-file" + = "$quoted_svnrepo/added-file" ' test_expect_success 'info added-directory' " @@ -157,12 +169,12 @@ test_expect_success 'info added-directory' " > expected.info-added-directory && (cd gitwc; git-svn info added-directory) \ > actual.info-added-directory && - git-diff expected.info-added-directory actual.info-added-directory + test_cmp expected.info-added-directory actual.info-added-directory " test_expect_success 'info --url added-directory' ' test "$(cd gitwc; git-svn info --url added-directory)" \ - = "$svnrepo/added-directory" + = "$quoted_svnrepo/added-directory" ' test_expect_success 'info added-symlink-file' " @@ -179,13 +191,13 @@ test_expect_success 'info added-symlink-file' " > expected.info-added-symlink-file && (cd gitwc; git-svn info added-symlink-file) \ > actual.info-added-symlink-file && - git-diff expected.info-added-symlink-file \ + test_cmp expected.info-added-symlink-file \ actual.info-added-symlink-file " test_expect_success 'info --url added-symlink-file' ' test "$(cd gitwc; git-svn info --url added-symlink-file)" \ - = "$svnrepo/added-symlink-file" + = "$quoted_svnrepo/added-symlink-file" ' test_expect_success 'info added-symlink-directory' " @@ -202,13 +214,13 @@ test_expect_success 'info added-symlink-directory' " > expected.info-added-symlink-directory && (cd gitwc; git-svn info added-symlink-directory) \ > actual.info-added-symlink-directory && - git-diff expected.info-added-symlink-directory \ + test_cmp expected.info-added-symlink-directory \ actual.info-added-symlink-directory " test_expect_success 'info --url added-symlink-directory' ' test "$(cd gitwc; git-svn info --url added-symlink-directory)" \ - = "$svnrepo/added-symlink-directory" + = "$quoted_svnrepo/added-symlink-directory" ' # The next few tests replace the "Text Last Updated" value with a @@ -229,12 +241,12 @@ test_expect_success 'info deleted-file' " (cd gitwc; git-svn info file) | sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ > actual.info-deleted-file && - git-diff expected.info-deleted-file actual.info-deleted-file + test_cmp expected.info-deleted-file actual.info-deleted-file " test_expect_success 'info --url file (deleted)' ' test "$(cd gitwc; git-svn info --url file)" \ - = "$svnrepo/file" + = "$quoted_svnrepo/file" ' test_expect_success 'info deleted-directory' " @@ -250,12 +262,12 @@ test_expect_success 'info deleted-directory' " (cd gitwc; git-svn info directory) | sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ > actual.info-deleted-directory && - git-diff expected.info-deleted-directory actual.info-deleted-directory + test_cmp expected.info-deleted-directory actual.info-deleted-directory " test_expect_success 'info --url directory (deleted)' ' test "$(cd gitwc; git-svn info --url directory)" \ - = "$svnrepo/directory" + = "$quoted_svnrepo/directory" ' test_expect_success 'info deleted-symlink-file' " @@ -271,13 +283,13 @@ test_expect_success 'info deleted-symlink-file' " (cd gitwc; git-svn info symlink-file) | sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ > actual.info-deleted-symlink-file && - git-diff expected.info-deleted-symlink-file \ + test_cmp expected.info-deleted-symlink-file \ actual.info-deleted-symlink-file " test_expect_success 'info --url symlink-file (deleted)' ' test "$(cd gitwc; git-svn info --url symlink-file)" \ - = "$svnrepo/symlink-file" + = "$quoted_svnrepo/symlink-file" ' test_expect_success 'info deleted-symlink-directory' " @@ -293,13 +305,13 @@ test_expect_success 'info deleted-symlink-directory' " (cd gitwc; git-svn info symlink-directory) | sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ > actual.info-deleted-symlink-directory && - git-diff expected.info-deleted-symlink-directory \ + test_cmp expected.info-deleted-symlink-directory \ actual.info-deleted-symlink-directory " test_expect_success 'info --url symlink-directory (deleted)' ' test "$(cd gitwc; git-svn info --url symlink-directory)" \ - = "$svnrepo/symlink-directory" + = "$quoted_svnrepo/symlink-directory" ' # NOTE: git does not have the concept of replaced objects, @@ -307,82 +319,59 @@ test_expect_success 'info --url symlink-directory (deleted)' ' test_expect_success 'info unknown-file' " echo two > gitwc/unknown-file && - cp gitwc/unknown-file svnwc/unknown-file && - ptouch gitwc/unknown-file svnwc/unknown-file && - (cd svnwc; svn info unknown-file) 2> expected.info-unknown-file && - (cd gitwc; git-svn info unknown-file) 2> actual.info-unknown-file && - git-diff expected.info-unknown-file actual.info-unknown-file + (cd gitwc; test_must_fail git-svn info unknown-file) \ + 2> actual.info-unknown-file && + grep unknown-file actual.info-unknown-file " test_expect_success 'info --url unknown-file' ' - test -z "$(cd gitwc; git-svn info --url unknown-file \ - 2> ../actual.info--url-unknown-file)" && - git-diff expected.info-unknown-file actual.info--url-unknown-file + echo two > gitwc/unknown-file && + (cd gitwc; test_must_fail git-svn info --url unknown-file) \ + 2> actual.info-url-unknown-file && + grep unknown-file actual.info-url-unknown-file ' test_expect_success 'info unknown-directory' " mkdir gitwc/unknown-directory svnwc/unknown-directory && - ptouch gitwc/unknown-directory svnwc/unknown-directory && - touch gitwc/unknown-directory/.placeholder && - (cd svnwc; svn info unknown-directory) \ - 2> expected.info-unknown-directory && - (cd gitwc; git-svn info unknown-directory) \ - 2> actual.info-unknown-directory && - git-diff expected.info-unknown-directory actual.info-unknown-directory + (cd gitwc; test_must_fail git-svn info unknown-directory) \ + 2> actual.info-unknown-directory && + grep unknown-directory actual.info-unknown-directory " test_expect_success 'info --url unknown-directory' ' - test -z "$(cd gitwc; git-svn info --url unknown-directory \ - 2> ../actual.info--url-unknown-directory)" && - git-diff expected.info-unknown-directory \ - actual.info--url-unknown-directory + (cd gitwc; test_must_fail git-svn info --url unknown-directory) \ + 2> actual.info-url-unknown-directory && + grep unknown-directory actual.info-url-unknown-directory ' test_expect_success 'info unknown-symlink-file' " cd gitwc && ln -s unknown-file unknown-symlink-file && cd .. && - cd svnwc && - ln -s unknown-file unknown-symlink-file && - cd .. && - ptouch gitwc/unknown-symlink-file svnwc/unknown-symlink-file && - (cd svnwc; svn info unknown-symlink-file) \ - 2> expected.info-unknown-symlink-file && - (cd gitwc; git-svn info unknown-symlink-file) \ - 2> actual.info-unknown-symlink-file && - git-diff expected.info-unknown-symlink-file \ - actual.info-unknown-symlink-file + (cd gitwc; test_must_fail git-svn info unknown-symlink-file) \ + 2> actual.info-unknown-symlink-file && + grep unknown-symlink-file actual.info-unknown-symlink-file " test_expect_success 'info --url unknown-symlink-file' ' - test -z "$(cd gitwc; git-svn info --url unknown-symlink-file \ - 2> ../actual.info--url-unknown-symlink-file)" && - git-diff expected.info-unknown-symlink-file \ - actual.info--url-unknown-symlink-file + (cd gitwc; test_must_fail git-svn info --url unknown-symlink-file) \ + 2> actual.info-url-unknown-symlink-file && + grep unknown-symlink-file actual.info-url-unknown-symlink-file ' test_expect_success 'info unknown-symlink-directory' " cd gitwc && ln -s unknown-directory unknown-symlink-directory && cd .. && - cd svnwc && - ln -s unknown-directory unknown-symlink-directory && - cd .. && - ptouch gitwc/unknown-symlink-directory \ - svnwc/unknown-symlink-directory && - (cd svnwc; svn info unknown-symlink-directory) \ - 2> expected.info-unknown-symlink-directory && - (cd gitwc; git-svn info unknown-symlink-directory) \ - 2> actual.info-unknown-symlink-directory && - git-diff expected.info-unknown-symlink-directory \ - actual.info-unknown-symlink-directory + (cd gitwc; test_must_fail git-svn info unknown-symlink-directory) \ + 2> actual.info-unknown-symlink-directory && + grep unknown-symlink-directory actual.info-unknown-symlink-directory " test_expect_success 'info --url unknown-symlink-directory' ' - test -z "$(cd gitwc; git-svn info --url unknown-symlink-directory \ - 2> ../actual.info--url-unknown-symlink-directory)" && - git-diff expected.info-unknown-symlink-directory \ - actual.info--url-unknown-symlink-directory + (cd gitwc; test_must_fail git-svn info --url unknown-symlink-directory) \ + 2> actual.info-url-unknown-symlink-directory && + grep unknown-symlink-directory actual.info-url-unknown-symlink-directory ' test_done diff --git a/t/t9121-git-svn-fetch-renamed-dir.sh b/t/t9121-git-svn-fetch-renamed-dir.sh index 99230b081..92e69a2a7 100755 --- a/t/t9121-git-svn-fetch-renamed-dir.sh +++ b/t/t9121-git-svn-fetch-renamed-dir.sh @@ -8,7 +8,7 @@ test_description='git-svn can fetch renamed directories' . ./lib-git-svn.sh test_expect_success 'load repository with renamed directory' ' - svnadmin load -q "$rawsvnrepo" < ../t9121/renamed-dir.dump + svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9121/renamed-dir.dump ' test_expect_success 'init and fetch repository' ' diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh index 8223c5909..31193a382 100755 --- a/t/t9124-git-svn-dcommit-auto-props.sh +++ b/t/t9124-git-svn-dcommit-auto-props.sh @@ -29,13 +29,11 @@ test_expect_success 'initialize git-svn' ' ' test_expect_success 'enable auto-props config' ' - cd "$gittestrepo" && mkdir user && generate_auto_props yes >user/config ' test_expect_success 'add files matching auto-props' ' - cd "$gittestrepo" && echo "#!$SHELL_PATH" >exec1.sh && chmod +x exec1.sh && echo "hello" >hello.txt && @@ -46,12 +44,10 @@ test_expect_success 'add files matching auto-props' ' ' test_expect_success 'disable auto-props config' ' - cd "$gittestrepo" && generate_auto_props no >user/config ' test_expect_success 'add files matching disabled auto-props' ' - cd "$gittestrepo" && echo "#$SHELL_PATH" >exec2.sh && chmod +x exec2.sh && echo "world" >world.txt && @@ -62,6 +58,7 @@ test_expect_success 'add files matching disabled auto-props' ' ' test_expect_success 'check resulting svn repository' ' +( mkdir work && cd work && svn co "$svnrepo" && @@ -81,6 +78,24 @@ test_expect_success 'check resulting svn repository' ' test "x$(svn propget svn:mime-type world.txt)" = "x" && test "x$(svn propget svn:eol-style world.txt)" = "x" && test "x$(svn propget svn:mime-type zot)" = "x" +) +' + +test_expect_success 'check renamed file' ' + test -d user && + generate_auto_props yes > user/config && + git mv foo foo.sh && + git commit -m "foo => foo.sh" && + git svn dcommit --config-dir=user && + ( + cd work/svnrepo && + svn up && + test ! -e foo && + test -e foo.sh && + test "x$(svn propget svn:mime-type foo.sh)" = \ + "xapplication/x-shellscript" && + test "x$(svn propget svn:eol-style foo.sh)" = "xLF" + ) ' test_done diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh index 3e32e84e6..988c3ac75 100755 --- a/t/t9200-git-cvsexportcommit.sh +++ b/t/t9200-git-cvsexportcommit.sh @@ -45,8 +45,8 @@ test_expect_success \ 'mkdir A B C D E F && echo hello1 >A/newfile1.txt && echo hello2 >B/newfile2.txt && - cp ../test9200a.png C/newfile3.png && - cp ../test9200a.png D/newfile4.png && + cp "$TEST_DIRECTORY"/test9200a.png C/newfile3.png && + cp "$TEST_DIRECTORY"/test9200a.png D/newfile4.png && git add A/newfile1.txt && git add B/newfile2.txt && git add C/newfile3.png && @@ -71,8 +71,8 @@ test_expect_success \ rm -f B/newfile2.txt && rm -f C/newfile3.png && echo Hello5 >E/newfile5.txt && - cp ../test9200b.png D/newfile4.png && - cp ../test9200a.png F/newfile6.png && + cp "$TEST_DIRECTORY"/test9200b.png D/newfile4.png && + cp "$TEST_DIRECTORY"/test9200a.png F/newfile6.png && git add E/newfile5.txt && git add F/newfile6.png && git commit -a -m "Test: Remove, add and update" && @@ -160,7 +160,7 @@ test_expect_success \ 'mkdir "G g" && echo ok then >"G g/with spaces.txt" && git add "G g/with spaces.txt" && \ - cp ../test9200a.png "G g/with spaces.png" && \ + cp "$TEST_DIRECTORY"/test9200a.png "G g/with spaces.png" && \ git add "G g/with spaces.png" && git commit -a -m "With spaces" && id=$(git rev-list --max-count=1 HEAD) && @@ -172,7 +172,7 @@ test_expect_success \ test_expect_success \ 'Update file with spaces in file name' \ 'echo Ok then >>"G g/with spaces.txt" && - cat ../test9200a.png >>"G g/with spaces.png" && \ + cat "$TEST_DIRECTORY"/test9200a.png >>"G g/with spaces.png" && \ git add "G g/with spaces.png" && git commit -a -m "Update with spaces" && id=$(git rev-list --max-count=1 HEAD) && @@ -197,7 +197,7 @@ test_expect_success \ 'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö && echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt && git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt && - cp ../test9200a.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png && + cp "$TEST_DIRECTORY"/test9200a.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png && git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png && git commit -a -m "Går det så går det" && \ id=$(git rev-list --max-count=1 HEAD) && diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index c6bc0a607..bd5d5af66 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -5,7 +5,7 @@ test_description='test git-fast-import utility' . ./test-lib.sh -. ../diff-lib.sh ;# test-lib chdir's into trash +. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash file2_data='file2 second line of EOF' diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh index c19b4a2ba..3cb9f8070 100755 --- a/t/t9301-fast-export.sh +++ b/t/t9301-fast-export.sh @@ -67,7 +67,7 @@ test_expect_success 'iso-8859-1' ' git config i18n.commitencoding ISO-8859-1 && # use author and committer name in ISO-8859-1 to match it. - . ../t3901-8859-1.txt && + . "$TEST_DIRECTORY"/t3901-8859-1.txt && test_tick && echo rosten >file && git commit -s -m den file && diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index 4b91f8d4c..c1850d292 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -488,4 +488,17 @@ test_expect_success 'cvs co -c (shows module database)' ' ! grep -v "^master[ ]\+master$" < out ' +#------------ +# CVS ANNOTATE +#------------ + +cd "$WORKDIR" +test_expect_success 'cvs annotate' ' + cd cvswork && + GIT_CONFIG="$git_config" cvs annotate merge >../out && + sed -e "s/ .*//" ../out >../actual && + for i in 3 1 1 1 1 1 1 1 2 4; do echo 1.$i; done >../expect && + test_cmp ../expect ../actual +' + test_done diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index ae7082be1..46ba19be7 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -25,9 +25,9 @@ our \$site_name = "[localhost]"; our \$site_header = ""; our \$site_footer = ""; our \$home_text = "indextext.html"; -our @stylesheets = ("file:///$safe_pwd/../../gitweb/gitweb.css"); -our \$logo = "file:///$safe_pwd/../../gitweb/git-logo.png"; -our \$favicon = "file:///$safe_pwd/../../gitweb/git-favicon.png"; +our @stylesheets = ("file:///$TEST_DIRECTORY/../gitweb/gitweb.css"); +our \$logo = "file:///$TEST_DIRECTORY/../gitweb/git-logo.png"; +our \$favicon = "file:///$TEST_DIRECTORY/../gitweb/git-favicon.png"; our \$projects_list = ""; our \$export_ok = ""; our \$strict_export = ""; @@ -54,7 +54,7 @@ gitweb_run () { # written to web server logs, so we are not interested in that: # we are interested only in properly formatted errors/warnings rm -f gitweb.log && - perl -- "$(pwd)/../../gitweb/gitweb.perl" \ + perl -- "$TEST_DIRECTORY/../gitweb/gitweb.perl" \ >/dev/null 2>gitweb.log && if grep -q -s "^[[]" gitweb.log >/dev/null; then false; else true; fi @@ -525,20 +525,20 @@ test_debug 'cat gitweb.log' test_expect_success \ 'encode(commit): utf8' \ - '. ../t3901-utf8.txt && + '. "$TEST_DIRECTORY"/t3901-utf8.txt && echo "UTF-8" >> file && git add file && - git commit -F ../t3900/1-UTF-8.txt && + git commit -F "$TEST_DIRECTORY"/t3900/1-UTF-8.txt && gitweb_run "p=.git;a=commit"' test_debug 'cat gitweb.log' test_expect_success \ 'encode(commit): iso-8859-1' \ - '. ../t3901-8859-1.txt && + '. "$TEST_DIRECTORY"/t3901-8859-1.txt && echo "ISO-8859-1" >> file && git add file && git config i18n.commitencoding ISO-8859-1 && - git commit -F ../t3900/ISO-8859-1.txt && + git commit -F "$TEST_DIRECTORY"/t3900/ISO-8859-1.txt && git config --unset i18n.commitencoding && gitweb_run "p=.git;a=commit"' test_debug 'cat gitweb.log' diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh index 9706ee577..0f04ba094 100755 --- a/t/t9700-perl-git.sh +++ b/t/t9700-perl-git.sh @@ -39,6 +39,6 @@ test_expect_success \ test_external_without_stderr \ 'Perl API' \ - perl ../t9700/test.pl + perl "$TEST_DIRECTORY"/t9700/test.pl test_done diff --git a/t/t9700/test.pl b/t/t9700/test.pl index 4d2312548..851cea4a4 100755 --- a/t/t9700/test.pl +++ b/t/t9700/test.pl @@ -14,10 +14,7 @@ use File::Temp; BEGIN { use_ok('Git') } # set up -our $repo_dir = "trash directory"; our $abs_repo_dir = Cwd->cwd; -die "this must be run by calling the t/t97* shell script(s)\n" - if basename(Cwd->cwd) ne $repo_dir; ok(our $r = Git->repository(Directory => "."), "open repository"); # config diff --git a/t/test-lib.sh b/t/test-lib.sh index 11c027571..e2b106cb6 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -406,7 +406,7 @@ test_create_repo () { error "bug in the test script: not 1 parameter to test-create-repo" owd=`pwd` repo="$1" - mkdir "$repo" + mkdir -p "$repo" cd "$repo" || error "Cannot setup test environment" "$GIT_EXEC_PATH/git" init "--template=$GIT_EXEC_PATH/templates/blt/" >&3 2>&4 || error "cannot run git init -- have you built things yet?" @@ -449,6 +449,11 @@ test_done () { # we will leave things as they are. say_color pass "passed all $msg" + + test -d "$remove_trash" && + cd "$(dirname "$remove_trash")" && + rm -rf "$(basename "$remove_trash")" + exit 0 ;; *) @@ -485,7 +490,8 @@ fi . ../GIT-BUILD-OPTIONS # Test repository -test="trash directory" +test="trash directory.$(basename "$0" .sh)" +test ! -z "$debug" || remove_trash="$TEST_DIRECTORY/$test" rm -fr "$test" || { trap - exit echo >&5 "FATAL: Cannot prepare test area" |