diff options
Diffstat (limited to 't')
169 files changed, 2493 insertions, 1080 deletions
diff --git a/t/.gitignore b/t/.gitignore index b27e280083..7dcbb232cd 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 0d65cedaa6..ed49c20b16 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-git-svn.sh b/t/lib-git-svn.sh index a841df2a9e..67c431d4eb 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -1,8 +1,11 @@ . ./test-lib.sh +remotes_git_svn=remotes/git""-svn +git_svn_id=git""-svn-id + if test -n "$NO_SVN_TESTS" then - test_expect_success 'skipping git-svn tests, NO_SVN_TESTS defined' : + test_expect_success 'skipping git svn tests, NO_SVN_TESTS defined' : test_done exit fi @@ -14,7 +17,7 @@ SVN_TREE=$GIT_SVN_DIR/svn-tree svn >/dev/null 2>&1 if test $? -ne 1 then - test_expect_success 'skipping git-svn tests, svn not found' : + test_expect_success 'skipping git svn tests, svn not found' : test_done exit fi @@ -88,7 +91,7 @@ start_httpd () { mkdir "$GIT_DIR"/logs cat > "$GIT_DIR/httpd.conf" <<EOF -ServerName "git-svn test" +ServerName "git svn test" ServerRoot "$GIT_DIR" DocumentRoot "$GIT_DIR" PidFile "$GIT_DIR/httpd.pid" @@ -135,3 +138,20 @@ close $wr or die $!; close $rd or die $!; EOF } + +require_svnserve () { + if test -z "$SVNSERVE_PORT" + then + say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)' + test_done + exit + fi +} + +start_svnserve () { + svnserve --listen-port $SVNSERVE_PORT \ + --root "$rawsvnrepo" \ + --listen-once \ + --listen-host 127.0.0.1 & +} + diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh index dc473dfb53..6ac312b905 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 7d1ce2d056..f1e1d48869 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/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh new file mode 100644 index 0000000000..e5330395fc --- /dev/null +++ b/t/t0024-crlf-archive.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +test_description='respect crlf in git archive' + +. ./test-lib.sh +UNZIP=${UNZIP:-unzip} + +test_expect_success setup ' + + git config core.autocrlf true + + printf "CRLF line ending\r\nAnd another\r\n" > sample && + git add sample && + + test_tick && + git commit -m Initial + +' + +test_expect_success 'tar archive' ' + + git archive --format=tar HEAD | + ( mkdir untarred && cd untarred && "$TAR" -xf - ) + + test_cmp sample untarred/sample + +' + +"$UNZIP" -v >/dev/null 2>&1 +if [ $? -eq 127 ]; then + echo "Skipping ZIP test, because unzip was not found" + test_done + exit +fi + +test_expect_success 'zip archive' ' + + git archive --format=zip HEAD >test.zip && + + ( mkdir unzipped && cd unzipped && unzip ../test.zip ) && + + test_cmp sample unzipped/sample + +' + +test_done diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh index b177174ef5..7edf49db3c 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 0000000000..b29c37a5a4 --- /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 807fb83af8..22ba7a5442 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/t1007-hash-object.sh b/t/t1007-hash-object.sh index 1ec0535138..fd98e445bf 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 09a8199335..67e637b781 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/t1300-repo-config.sh b/t/t1300-repo-config.sh index 64567fb94d..11b82f43dd 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -741,4 +741,14 @@ test_expect_success 'symlinked configuration' ' ' +test_expect_success 'check split_cmdline return' " + git config alias.split-cmdline-fix 'echo \"' && + test_must_fail git split-cmdline-fix && + echo foo > foo && + git add foo && + git commit -m 'initial commit' && + git config branch.master.mergeoptions 'echo \"' && + test_must_fail git merge master + " + test_done diff --git a/t/t1303-wacky-config.sh b/t/t1303-wacky-config.sh index f98f4c5179..1983076c75 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 b31e4b1ac6..04c2b164bc 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 2ee88d8a06..c039ee3fd8 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 95244c9bcf..cc65394947 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 a84c5a6af9..ed12c4d782 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 88f268b9d7..b7131d8c08 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 59b560bfdf..648184fd98 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 19d0894d26..f195aefe3a 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 f57a6e077c..cd9231cf61 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 1caeacafa7..8666946b02 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 af8c4121ab..f4066cbc09 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 f2880152b0..0de613dc53 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) @@ -285,7 +285,7 @@ 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) @@ -317,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' ' @@ -339,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) @@ -373,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) @@ -407,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) @@ -441,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) @@ -535,4 +535,15 @@ test_expect_success 'reset and bind merge' ' ' +test_expect_success 'merge removes empty directories' ' + + git reset --hard master && + git checkout -b rm && + git rm d/e && + git commit -mremoved-d/e && + git checkout master && + git merge -s recursive rm && + test_must_fail test -d d +' + test_done diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 7a83fbfe4f..2147eacc50 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 c2dec1c632..087ef75061 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/t3400-rebase.sh b/t/t3400-rebase.sh index 91bb5e1d9e..b7a670ef40 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 166ddb1447..aea6685984 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 0d33c71daa..64446e3db3 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 5aa487ac02..e0ded197ec 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 4de550a632..2999e78937 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 4911c48378..dadbbc2a9f 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 0000000000..f7b3518a32 --- /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 79c06adf1f..558c80edbf 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 c851db8ca9..6fb027ba57 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 883281dbd6..784c31aec9 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 235f372832..7655da3f8d 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/t3903-stash.sh b/t/t3903-stash.sh index 8d4804b658..7484cbede6 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 c44b27aeb2..6ddd46915d 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 a32692417d..71bac83dd5 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 a4cfde6b29..cc3681f161 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 8b1f875286..c6130c4019 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 3d25be7a67..b35af9b42d 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 6630017312..1ba359d478 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 104a4e1492..42072d724e 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 26c2e4aa65..7e343a9cd1 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 d2b45e7b8f..de3f17478e 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 ad3d9e4845..9322298ecc 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 c6d13693ba..02efecae3a 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 eced1f30fb..b8ec6e90af 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 9337b81064..1a6b52234d 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 7fe853c20d..9d99dc2887 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 b1cbd36d17..fc2307eaa3 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 diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh index 833d6cbcfc..18bcd9713d 100755 --- a/t/t4018-diff-funcname.sh +++ b/t/t4018-diff-funcname.sh @@ -57,4 +57,10 @@ test_expect_success 'last regexp must not be negated' ' test_must_fail git diff --no-index Beer.java Beer-correct.java ' +test_expect_success 'alternation in pattern' ' + git config diff.java.funcname "^[ ]*\\(\\(public\\|static\\).*\\)$" + git diff --no-index Beer.java Beer-correct.java | + grep "^@@.*@@ public static void main(" +' + test_done diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh index 7eae1f4500..84a1fe3115 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 637b4e19d5..dfe3fbc74b 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 bf996fc414..2a537a21e8 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 4dbfc6e8b7..297ddb5a25 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 ba6679c6e4..1c2edebb09 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 0000000000..4ca65e0332 --- /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 e0c67740a5..9b433de836 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 da8abcf364..e3443d004d 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 7da0b4bb8b..ad4cc1a757 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 e7e2913de7..0e3ce3611d 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 85f3da2b98..f83322e513 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 1f859dd908..3a8202ea93 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 6e6aaf5936..1be5fb3f9d 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 7d86cdff64..4448aba7e0 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/t5100-mailinfo.sh b/t/t5100-mailinfo.sh index 198e3503d5..fe14589427 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,10 @@ 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 ' diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 645583f9d7..b335c6b42d 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,8 @@ 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 2>msg && + grep "SHA1 COLLISION FOUND" msg' test_expect_success \ 'honor pack.packSizeLimit' \ diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh index 073ac0c6f9..0a24e61ff9 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 0639772ac4..6424db1f28 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 fb471a08c6..b061864a87 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 0000000000..f4931c0c2a --- /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 68c2ae688c..544771d8fa 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 ee769d6695..64f66c94f3 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 1394047a8d..6eb2ffd6ec 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 823239a251..9b2e1a94c5 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 362cf7e928..c450f33f33 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 be9ee9326f..c4496635df 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 13d1d826c2..9aae4965da 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 && @@ -303,4 +303,24 @@ test_expect_success 'pushing nonexistent branch by mistake should not segv' ' ' +test_expect_success 'auto tag following fetches minimum' ' + + cd "$D" && + git clone .git follow && + git checkout HEAD^0 && + ( + for i in 1 2 3 4 5 6 7 + do + echo $i >>file && + git commit -m $i -a && + git tag -a -m $i excess-$i || exit 1 + done + ) && + git checkout master && + ( + cd follow && + git fetch + ) +' + test_done diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh index 8becbc3f38..1f4608d8ba 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 1a15817cd5..f5102b902a 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 b0d242e3ed..da9588645c 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 3c013e2b6a..ee06d28649 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 59c65fef28..78a3fa639c 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 8367a6845f..82b1d1e2b3 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 8f5de097ec..b4e8fbaa5e 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 5daa0be8cc..2c73f2da7b 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 485ad4d44a..86bf7e14ba 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' diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh index b6e57b2426..04e4b7c5c2 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 0000000000..510bb9679f --- /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/t6013-rev-list-reverse-parents.sh b/t/t6013-rev-list-reverse-parents.sh new file mode 100755 index 0000000000..59fc2f06e0 --- /dev/null +++ b/t/t6013-rev-list-reverse-parents.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +test_description='--reverse combines with --parents' + +. ./test-lib.sh + + +commit () { + test_tick && + echo $1 > foo && + git add foo && + git commit -m "$1" +} + +test_expect_success 'set up --reverse example' ' + commit one && + git tag root && + commit two && + git checkout -b side HEAD^ && + commit three && + git checkout master && + git merge -s ours side && + commit five + ' + +test_expect_success '--reverse --parents --full-history combines correctly' ' + git rev-list --parents --full-history master -- foo | + perl -e "print reverse <>" > expected && + git rev-list --reverse --parents --full-history master -- foo \ + > actual && + test_cmp actual expected + ' + +test_expect_success '--boundary does too' ' + git rev-list --boundary --parents --full-history master ^root -- foo | + perl -e "print reverse <>" > expected && + git rev-list --boundary --reverse --parents --full-history \ + master ^root -- foo > actual && + test_cmp actual expected + ' + +test_done diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh index b76bca8880..f8942bc890 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 ' @@ -150,8 +150,8 @@ test_expect_success 'MERGE_ZEALOUS simplifies non-conflicts' ' ' -sed -e 's/deerit./&\n\n\n\n/' -e "s/locavit,/locavit;/" < new6.txt > new8.txt -sed -e 's/deerit./&\n\n\n\n/' -e "s/locavit,/locavit --/" < new7.txt > new9.txt +sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit;/"< new6.txt | tr '%' '\012' > new8.txt +sed -e 's/deerit./&%%%%/' -e "s/locavit,/locavit --/" < new7.txt | tr '%' '\012' > new9.txt test_expect_success 'ZEALOUS_ALNUM' ' diff --git a/t/t6025-merge-symlinks.sh b/t/t6025-merge-symlinks.sh index fc58456a11..53892a555c 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 56fc341768..1ba0a25223 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,13 +133,35 @@ 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 && rm -f $o $a $b ' +test_expect_success 'up-to-date merge without common ancestor' ' + test_create_repo repo1 && + test_create_repo repo2 && + test_tick && + ( + cd repo1 && + >a && + git add a && + git commit -m initial + ) && + test_tick && + ( + cd repo2 && + git commit --allow-empty -m initial + ) && + test_tick && + ( + cd repo1 && + git pull ../repo2 master + ) +' + test_done diff --git a/t/t6027-merge-binary.sh b/t/t6027-merge-binary.sh index 92ca1f0f8c..b519626ca0 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 244fda62a5..85fa39cf0b 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= @@ -350,6 +350,120 @@ test_expect_success 'bisect does not create a "bisect" branch' ' git branch -D bisect ' +# This creates a "side" branch to test "siblings" cases. +# +# H1-H2-H3-H4-H5-H6-H7 <--other +# \ +# S5-S6-S7 <--side +# +test_expect_success 'side branch creation' ' + git bisect reset && + git checkout -b side $HASH4 && + add_line_into_file "5(side): first line on a side branch" hello2 && + SIDE_HASH5=$(git rev-parse --verify HEAD) && + add_line_into_file "6(side): second line on a side branch" hello2 && + SIDE_HASH6=$(git rev-parse --verify HEAD) && + add_line_into_file "7(side): third line on a side branch" hello2 && + SIDE_HASH7=$(git rev-parse --verify HEAD) +' + +test_expect_success 'good merge base when good and bad are siblings' ' + git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt && + grep "merge base must be tested" my_bisect_log.txt && + grep $HASH4 my_bisect_log.txt && + git bisect good > my_bisect_log.txt && + test_must_fail grep "merge base must be tested" my_bisect_log.txt && + grep $HASH6 my_bisect_log.txt && + git bisect reset +' +test_expect_success 'skipped merge base when good and bad are siblings' ' + git bisect start "$SIDE_HASH7" "$HASH7" > my_bisect_log.txt && + grep "merge base must be tested" my_bisect_log.txt && + grep $HASH4 my_bisect_log.txt && + git bisect skip > my_bisect_log.txt 2>&1 && + grep "Warning" my_bisect_log.txt && + grep $SIDE_HASH6 my_bisect_log.txt && + git bisect reset +' + +test_expect_success 'bad merge base when good and bad are siblings' ' + git bisect start "$HASH7" HEAD > my_bisect_log.txt && + grep "merge base must be tested" my_bisect_log.txt && + grep $HASH4 my_bisect_log.txt && + test_must_fail git bisect bad > my_bisect_log.txt 2>&1 && + grep "merge base $HASH4 is bad" my_bisect_log.txt && + grep "fixed between $HASH4 and \[$SIDE_HASH7\]" my_bisect_log.txt && + git bisect reset +' + +# This creates a few more commits (A and B) to test "siblings" cases +# when a good and a bad rev have many merge bases. +# +# We should have the following: +# +# H1-H2-H3-H4-H5-H6-H7 +# \ \ \ +# S5-A \ +# \ \ +# S6-S7----B +# +# And there A and B have 2 merge bases (S5 and H5) that should be +# reported by "git merge-base --all A B". +# +test_expect_success 'many merge bases creation' ' + git checkout "$SIDE_HASH5" && + git merge -m "merge HASH5 and SIDE_HASH5" "$HASH5" && + A_HASH=$(git rev-parse --verify HEAD) && + git checkout side && + git merge -m "merge HASH7 and SIDE_HASH7" "$HASH7" && + B_HASH=$(git rev-parse --verify HEAD) && + git merge-base --all "$A_HASH" "$B_HASH" > merge_bases.txt && + test $(wc -l < merge_bases.txt) = "2" && + grep "$HASH5" merge_bases.txt && + grep "$SIDE_HASH5" merge_bases.txt +' + +test_expect_success 'good merge bases when good and bad are siblings' ' + git bisect start "$B_HASH" "$A_HASH" > my_bisect_log.txt && + grep "merge base must be tested" my_bisect_log.txt && + git bisect good > my_bisect_log2.txt && + grep "merge base must be tested" my_bisect_log2.txt && + { + { + grep "$SIDE_HASH5" my_bisect_log.txt && + grep "$HASH5" my_bisect_log2.txt + } || { + grep "$SIDE_HASH5" my_bisect_log2.txt && + grep "$HASH5" my_bisect_log.txt + } + } && + git bisect reset +' + +check_trace() { + grep "$1" "$GIT_TRACE" | grep "\^$2" | grep "$3" >/dev/null +} + +test_expect_success 'optimized merge base checks' ' + GIT_TRACE="$(pwd)/trace.log" && + export GIT_TRACE && + git bisect start "$HASH7" "$SIDE_HASH7" > my_bisect_log.txt && + grep "merge base must be tested" my_bisect_log.txt && + grep "$HASH4" my_bisect_log.txt && + check_trace "rev-list" "$HASH7" "$SIDE_HASH7" && + git bisect good > my_bisect_log2.txt && + test -f ".git/BISECT_ANCESTORS_OK" && + test "$HASH6" = $(git rev-parse --verify HEAD) && + : > "$GIT_TRACE" && + git bisect bad > my_bisect_log3.txt && + test_must_fail check_trace "rev-list" "$HASH6" "$SIDE_HASH7" && + git bisect good "$A_HASH" > my_bisect_log4.txt && + grep "merge base must be tested" my_bisect_log4.txt && + test_must_fail test -f ".git/BISECT_ANCESTORS_OK" && + check_trace "rev-list" "$HASH6" "$A_HASH" && + unset GIT_TRACE +' + # # test_done diff --git a/t/t6101-rev-parse-parents.sh b/t/t6101-rev-parse-parents.sh index 919552a2fc..f105fab98e 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 2fb672c3b4..16cc635813 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 bc74349416..8f5a06f7dd 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 8ced59321e..8bfae44a83 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,6 +262,50 @@ for i in "--perl --shell" "-s --python" "--python --tcl" "--tcl --perl"; do " done +cat >expected <<\EOF +master +testtag +EOF + +test_expect_success 'Check short refname format' ' + (git for-each-ref --format="%(refname:short)" refs/heads && + git for-each-ref --format="%(refname:short)" refs/tags) >actual && + test_cmp expected actual +' + +test_expect_success 'Check for invalid refname format' ' + test_must_fail git for-each-ref --format="%(refname:INVALID)" +' + +cat >expected <<\EOF +heads/master +master +EOF + +test_expect_success 'Check ambiguous head and tag refs' ' + git checkout -b newtag && + echo "Using $datestamp" > one && + git add one && + git commit -m "Branch" && + setdate_and_increment && + git tag -m "Tagging at $datestamp" master && + git for-each-ref --format "%(refname:short)" refs/heads/master refs/tags/master >actual && + test_cmp expected actual +' + +cat >expected <<\EOF +heads/ambiguous +ambiguous +EOF + +test_expect_success 'Check ambiguous head and tag refs II' ' + git checkout master && + git tag ambiguous testtag^0 && + git branch ambiguous testtag^0 && + git for-each-ref --format "%(refname:short)" refs/heads/ambiguous refs/tags/ambiguous >actual && + test_cmp expected actual +' + test_expect_success 'an unusual tag with an incomplete line' ' git tag -m "bogo" bogo && diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh index 910a28c7e2..575ef5beb2 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 c8b4f65f38..5e359cb561 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 a0ab096c8f..b0a9d7d536 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 8d44c2ed1f..f0edbf1a76 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 0d9874bfd7..96e163f084 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 29f5678b4c..e637c7d4db 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 cdecebe456..42bf518c68 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 ac49311cf2..82769b89fc 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,6 +337,38 @@ 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' + setup_conflicting_index () { rm -f .git/index && O=$(echo original | git hash-object -w --stdin) && @@ -478,4 +510,14 @@ test_expect_success 'checkout --conflict=diff3' ' test_cmp merged file ' +test_expect_success 'failing checkout -b should not break working tree' ' + git reset --hard master && + git symbolic-ref HEAD refs/heads/master && + test_must_fail git checkout -b renamer side^ && + test $(git symbolic-ref HEAD) = refs/heads/master && + git diff --exit-code && + git diff --cached --exit-code + +' + test_done diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index 2b51c0d7d8..1636fac2a4 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 cbc0c34ce2..be73f7b60a 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 bf12dbdeef..61498293b9 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 809bdba630..6e18a96319 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 0edd9ddf73..63bfc6d8b3 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,8 +140,8 @@ d381ac431806e53f3dd7ac2f1ae0534f36d738b9 EOF test_expect_success \ - 'validate git-rev-list output.' \ - 'diff current expected' + 'validate git rev-list output.' \ + 'test_cmp expected current' test_expect_success 'partial commit that involves removal (1)' ' @@ -151,7 +151,7 @@ test_expect_success 'partial commit that involves removal (1)' ' git commit -m "Partial: add elif" elif && git diff-tree --name-status HEAD^ HEAD >current && echo "A elif" >expected && - diff expected current + test_cmp expected current ' @@ -160,7 +160,7 @@ test_expect_success 'partial commit that involves removal (2)' ' git commit -m "Partial: remove file" file && git diff-tree --name-status HEAD^ HEAD >current && echo "D file" >expected && - diff expected current + test_cmp expected current ' @@ -171,7 +171,7 @@ test_expect_success 'partial commit that involves removal (3)' ' git commit -m "Partial: modify elif" elif && git diff-tree --name-status HEAD^ HEAD >current && echo "M elif" >expected && - diff expected current + test_cmp expected current ' @@ -187,7 +187,7 @@ test_expect_success 'amend commit to fix author' ' expected && git commit --amend --author="$author" && git cat-file -p HEAD > current && - diff expected current + test_cmp expected current ' @@ -256,7 +256,7 @@ test_expect_success 'amend commit to fix author' ' expected && git commit --amend --author="$author" && git cat-file -p HEAD > current && - diff expected current + test_cmp expected current ' diff --git a/t/t7502-status.sh b/t/t7502-status.sh index 38a48b57c7..1905fb34cd 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 @@ -46,6 +46,7 @@ cat > expect << \EOF # # Changed but not updated: # (use "git add <file>..." to update what will be committed) +# (use "git checkout -- <file>..." to discard changes in working directory) # # modified: dir1/modified # @@ -76,6 +77,7 @@ cat >expect <<EOF # # Changed but not updated: # (use "git add <file>..." to update what will be committed) +# (use "git checkout -- <file>..." to discard changes in working directory) # # modified: dir1/modified # @@ -104,6 +106,7 @@ cat >expect <<EOF # # Changed but not updated: # (use "git add <file>..." to update what will be committed) +# (use "git checkout -- <file>..." to discard changes in working directory) # # modified: dir1/modified # @@ -138,6 +141,7 @@ cat >expect <<EOF # # Changed but not updated: # (use "git add <file>..." to update what will be committed) +# (use "git checkout -- <file>..." to discard changes in working directory) # # modified: dir1/modified # @@ -174,6 +178,7 @@ cat > expect << \EOF # # Changed but not updated: # (use "git add <file>..." to update what will be committed) +# (use "git checkout -- <file>..." to discard changes in working directory) # # modified: modified # @@ -204,6 +209,7 @@ cat > expect << \EOF # # Changed but not updated: # (use "git add <file>..." to update what will be committed) +# (use "git checkout -- <file>..." to discard changes in working directory) # # modified: dir1/modified # @@ -267,6 +273,7 @@ cat >expect <<EOF # # Changed but not updated: # (use "git add <file>..." to update what will be committed) +# (use "git checkout -- <file>..." to discard changes in working directory) # # modified: dir1/modified # @@ -297,6 +304,7 @@ cat >expect <<EOF # # Changed but not updated: # (use "git add <file>..." to update what will be committed) +# (use "git checkout -- <file>..." to discard changes in working directory) # # modified: dir1/modified # @@ -326,6 +334,7 @@ cat >expect <<EOF # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) +# (use "git checkout -- <file>..." to discard changes in working directory) # # modified: dir1/modified # @@ -357,6 +366,7 @@ cat >expect <<EOF # # Changed but not updated: # (use "git add <file>..." to update what will be committed) +# (use "git checkout -- <file>..." to discard changes in working directory) # # modified: dir1/modified # diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh index cd6c7c8342..ff189624d4 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 a75130cdbb..d9a08aac56 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 dbc90bc416..9516f541e9 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 && diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh index 55aa6b5f27..7ba94ea99b 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 fcb8285746..01e5415e94 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 17b19dc11f..7e17eb490d 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.' @@ -60,4 +60,57 @@ test_expect_success 'merge c1 with c2, c3, c4, c5' ' test -f c5.c ' +test_expect_success 'setup' ' + for i in A B C D E + do + echo $i > $i.c && + git add $i.c && + git commit -m $i && + git tag $i + done && + git reset --hard A && + for i in F G H I + do + echo $i > $i.c && + git add $i.c && + git commit -m $i && + git tag $i + done +' + +test_expect_success 'merge E and I' ' + git reset --hard A && + git merge E I +' + +test_expect_success 'verify merge result' ' + test $(git rev-parse HEAD^1) = $(git rev-parse E) && + test $(git rev-parse HEAD^2) = $(git rev-parse I) +' + +test_expect_success 'add conflicts' ' + git reset --hard E && + echo foo > file.c && + git add file.c && + git commit -m E2 && + git tag E2 && + git reset --hard I && + echo bar >file.c && + git add file.c && + git commit -m I2 && + git tag I2 +' + +test_expect_success 'merge E2 and I2, causing a conflict and resolve it' ' + git reset --hard A && + test_must_fail git merge E2 I2 && + echo baz > file.c && + git add file.c && + git commit -m "resolve conflict" +' + +test_expect_success 'verify merge result' ' + test $(git rev-parse HEAD^1) = $(git rev-parse E2) && + test $(git rev-parse HEAD^2) = $(git rev-parse I2) +' test_done diff --git a/t/t7604-merge-custom-message.sh b/t/t7604-merge-custom-message.sh index 6081677d23..de977c5e2f 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 f1f86ddb23..0cb9d11f21 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.' diff --git a/t/t7606-merge-custom.sh b/t/t7606-merge-custom.sh new file mode 100755 index 0000000000..52a451dd57 --- /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 9285071c47..09fa5f115c 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 31c340fd38..531dac060a 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 eabec2e06e..45cb60ea4b 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 92ece30fa9..597cf0486f 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 1c857cf4ab..d098a01ba3 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/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh index 843a5013b9..9b238c329b 100755 --- a/t/t9100-git-svn-basic.sh +++ b/t/t9100-git-svn-basic.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Eric Wong # -test_description='git-svn basic tests' +test_description='git svn basic tests' GIT_SVN_LC_ALL=${LC_ALL:-$LANG} case "$GIT_SVN_LC_ALL" in @@ -17,10 +17,10 @@ esac . ./lib-git-svn.sh -say 'define NO_SVN_TESTS to skip git-svn tests' +say 'define NO_SVN_TESTS to skip git svn tests' test_expect_success \ - 'initialize git-svn' ' + 'initialize git svn' ' mkdir import && cd import && echo foo > foo && @@ -31,26 +31,26 @@ test_expect_success \ echo "zzz" > bar/zzz && echo "#!/bin/sh" > exec.sh && chmod +x exec.sh && - svn import -m "import for git-svn" . "$svnrepo" >/dev/null && + svn import -m "import for git svn" . "$svnrepo" >/dev/null && cd .. && rm -rf import && - git-svn init "$svnrepo"' + git svn init "$svnrepo"' test_expect_success \ 'import an SVN revision into git' \ - 'git-svn fetch' + 'git svn fetch' test_expect_success "checkout from svn" 'svn co "$svnrepo" "$SVN_TREE"' name='try a deep --rmdir with a commit' test_expect_success "$name" ' - git checkout -f -b mybranch remotes/git-svn && + git checkout -f -b mybranch ${remotes_git_svn} && mv dir/a/b/c/d/e/file dir/file && cp dir/file file && git update-index --add --remove dir/a/b/c/d/e/file dir/file file && git commit -m "$name" && - git-svn set-tree --find-copies-harder --rmdir \ - remotes/git-svn..mybranch && + git svn set-tree --find-copies-harder --rmdir \ + ${remotes_git_svn}..mybranch && svn up "$SVN_TREE" && test -d "$SVN_TREE"/dir && test ! -d "$SVN_TREE"/dir/a' @@ -63,61 +63,61 @@ test_expect_success "$name" " git update-index --remove dir/file && git update-index --add dir/file/file && git commit -m '$name' && - test_must_fail git-svn set-tree --find-copies-harder --rmdir \ - remotes/git-svn..mybranch" || true + test_must_fail git svn set-tree --find-copies-harder --rmdir \ + ${remotes_git_svn}..mybranch" || true name='detect node change from directory to file #1' test_expect_success "$name" ' rm -rf dir "$GIT_DIR"/index && - git checkout -f -b mybranch2 remotes/git-svn && + git checkout -f -b mybranch2 ${remotes_git_svn} && mv bar/zzz zzz && rm -rf bar && mv zzz bar && git update-index --remove -- bar/zzz && git update-index --add -- bar && git commit -m "$name" && - test_must_fail git-svn set-tree --find-copies-harder --rmdir \ - remotes/git-svn..mybranch2' || true + test_must_fail git svn set-tree --find-copies-harder --rmdir \ + ${remotes_git_svn}..mybranch2' || true name='detect node change from file to directory #2' test_expect_success "$name" ' rm -f "$GIT_DIR"/index && - git checkout -f -b mybranch3 remotes/git-svn && + git checkout -f -b mybranch3 ${remotes_git_svn} && rm bar/zzz && git update-index --remove bar/zzz && mkdir bar/zzz && echo yyy > bar/zzz/yyy && git update-index --add bar/zzz/yyy && git commit -m "$name" && - test_must_fail git-svn set-tree --find-copies-harder --rmdir \ - remotes/git-svn..mybranch3' || true + test_must_fail git svn set-tree --find-copies-harder --rmdir \ + ${remotes_git_svn}..mybranch3' || true name='detect node change from directory to file #2' test_expect_success "$name" ' rm -f "$GIT_DIR"/index && - git checkout -f -b mybranch4 remotes/git-svn && + git checkout -f -b mybranch4 ${remotes_git_svn} && rm -rf dir && git update-index --remove -- dir/file && touch dir && echo asdf > dir && git update-index --add -- dir && git commit -m "$name" && - test_must_fail git-svn set-tree --find-copies-harder --rmdir \ - remotes/git-svn..mybranch4' || true + test_must_fail git svn set-tree --find-copies-harder --rmdir \ + ${remotes_git_svn}..mybranch4' || true name='remove executable bit from a file' test_expect_success "$name" ' rm -f "$GIT_DIR"/index && - git checkout -f -b mybranch5 remotes/git-svn && + git checkout -f -b mybranch5 ${remotes_git_svn} && chmod -x exec.sh && git update-index exec.sh && git commit -m "$name" && - git-svn set-tree --find-copies-harder --rmdir \ - remotes/git-svn..mybranch5 && + git svn set-tree --find-copies-harder --rmdir \ + ${remotes_git_svn}..mybranch5 && svn up "$SVN_TREE" && test ! -x "$SVN_TREE"/exec.sh' @@ -127,8 +127,8 @@ test_expect_success "$name" ' chmod +x exec.sh && git update-index exec.sh && git commit -m "$name" && - git-svn set-tree --find-copies-harder --rmdir \ - remotes/git-svn..mybranch5 && + git svn set-tree --find-copies-harder --rmdir \ + ${remotes_git_svn}..mybranch5 && svn up "$SVN_TREE" && test -x "$SVN_TREE"/exec.sh' @@ -139,8 +139,8 @@ test_expect_success "$name" ' ln -s bar/zzz exec.sh && git update-index exec.sh && git commit -m "$name" && - git-svn set-tree --find-copies-harder --rmdir \ - remotes/git-svn..mybranch5 && + git svn set-tree --find-copies-harder --rmdir \ + ${remotes_git_svn}..mybranch5 && svn up "$SVN_TREE" && test -L "$SVN_TREE"/exec.sh' @@ -151,8 +151,8 @@ test_expect_success "$name" ' ln -s bar/zzz exec-2.sh && git update-index --add bar/zzz exec-2.sh && git commit -m "$name" && - git-svn set-tree --find-copies-harder --rmdir \ - remotes/git-svn..mybranch5 && + git svn set-tree --find-copies-harder --rmdir \ + ${remotes_git_svn}..mybranch5 && svn up "$SVN_TREE" && test -x "$SVN_TREE"/bar/zzz && test -L "$SVN_TREE"/exec-2.sh' @@ -164,8 +164,8 @@ test_expect_success "$name" ' cp help exec-2.sh && git update-index exec-2.sh && git commit -m "$name" && - git-svn set-tree --find-copies-harder --rmdir \ - remotes/git-svn..mybranch5 && + git svn set-tree --find-copies-harder --rmdir \ + ${remotes_git_svn}..mybranch5 && svn up "$SVN_TREE" && test -f "$SVN_TREE"/exec-2.sh && test ! -L "$SVN_TREE"/exec-2.sh && @@ -180,7 +180,7 @@ then echo '# hello' >> exec-2.sh && git update-index exec-2.sh && git commit -m 'éï∏' && - git-svn set-tree HEAD" + git svn set-tree HEAD" unset LC_ALL else say "UTF-8 locale not set, test skipped ($GIT_SVN_LC_ALL)" @@ -190,8 +190,8 @@ name='test fetch functionality (svn => git) with alternate GIT_SVN_ID' GIT_SVN_ID=alt export GIT_SVN_ID test_expect_success "$name" \ - 'git-svn init "$svnrepo" && git-svn fetch && - git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a && + 'git svn init "$svnrepo" && git svn fetch && + git rev-list --pretty=raw ${remotes_git_svn} | grep ^tree | uniq > a && git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b && test_cmp a b' @@ -215,45 +215,45 @@ test_expect_success "$name" "test_cmp a expected" test_expect_success 'exit if remote refs are ambigious' " git config --add svn-remote.svn.fetch \ - bar:refs/remotes/git-svn && - test_must_fail git-svn migrate + bar:refs/${remotes_git_svn} && + test_must_fail git svn migrate " test_expect_success 'exit if init-ing a would clobber a URL' ' svnadmin create "${PWD}/svnrepo2" && svn mkdir -m "mkdir bar" "${svnrepo}2/bar" && git config --unset svn-remote.svn.fetch \ - "^bar:refs/remotes/git-svn$" && - test_must_fail git-svn init "${svnrepo}2/bar" + "^bar:refs/${remotes_git_svn}$" && + test_must_fail git svn init "${svnrepo}2/bar" ' test_expect_success \ 'init allows us to connect to another directory in the same repo' ' - git-svn init --minimize-url -i bar "$svnrepo/bar" && + git svn init --minimize-url -i bar "$svnrepo/bar" && git config --get svn-remote.svn.fetch \ "^bar:refs/remotes/bar$" && git config --get svn-remote.svn.fetch \ - "^:refs/remotes/git-svn$" + "^:refs/${remotes_git_svn}$" ' test_expect_success 'able to dcommit to a subdirectory' " - git-svn fetch -i bar && + git svn fetch -i bar && git checkout -b my-bar refs/remotes/bar && echo abc > d && git update-index --add d && git commit -m '/bar/d should be in the log' && - git-svn dcommit -i bar && + git svn dcommit -i bar && test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" && mkdir newdir && echo new > newdir/dir && git update-index --add newdir/dir && git commit -m 'add a new directory' && - git-svn dcommit -i bar && + git svn dcommit -i bar && test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" && echo foo >> newdir/dir && git update-index newdir/dir && git commit -m 'modify a file in new directory' && - git-svn dcommit -i bar && + git svn dcommit -i bar && test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" " @@ -261,7 +261,7 @@ test_expect_success 'able to set-tree to a subdirectory' " echo cba > d && git update-index d && git commit -m 'update /bar/d' && - git-svn set-tree -i bar HEAD && + git svn set-tree -i bar HEAD && test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" " diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh index f420796c31..1e31d6ea72 100755 --- a/t/t9101-git-svn-props.sh +++ b/t/t9101-git-svn-props.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Eric Wong # -test_description='git-svn property tests' +test_description='git svn property tests' . ./lib-git-svn.sh mkdir import @@ -26,29 +26,29 @@ cd import EOF printf "Hello\r\nWorld\r\n" > crlf - a_crlf=`git-hash-object -w crlf` + a_crlf=`git hash-object -w crlf` printf "Hello\rWorld\r" > cr - a_cr=`git-hash-object -w cr` + a_cr=`git hash-object -w cr` printf "Hello\nWorld\n" > lf - a_lf=`git-hash-object -w lf` + a_lf=`git hash-object -w lf` printf "Hello\r\nWorld" > ne_crlf - a_ne_crlf=`git-hash-object -w ne_crlf` + a_ne_crlf=`git hash-object -w ne_crlf` printf "Hello\nWorld" > ne_lf - a_ne_lf=`git-hash-object -w ne_lf` + a_ne_lf=`git hash-object -w ne_lf` printf "Hello\rWorld" > ne_cr - a_ne_cr=`git-hash-object -w ne_cr` + a_ne_cr=`git hash-object -w ne_cr` touch empty - a_empty=`git-hash-object -w empty` + a_empty=`git hash-object -w empty` printf "\n" > empty_lf - a_empty_lf=`git-hash-object -w empty_lf` + a_empty_lf=`git hash-object -w empty_lf` printf "\r" > empty_cr - a_empty_cr=`git-hash-object -w empty_cr` + a_empty_cr=`git hash-object -w empty_cr` printf "\r\n" > empty_crlf - a_empty_crlf=`git-hash-object -w empty_crlf` + a_empty_crlf=`git hash-object -w empty_crlf` - svn import --no-auto-props -m 'import for git-svn' . "$svnrepo" >/dev/null + svn import --no-auto-props -m 'import for git svn' . "$svnrepo" >/dev/null cd .. rm -rf import @@ -66,16 +66,16 @@ test_expect_success 'setup some commits to svn' \ svn commit -m "Propset Id" && cd ..' -test_expect_success 'initialize git-svn' 'git-svn init "$svnrepo"' -test_expect_success 'fetch revisions from svn' 'git-svn fetch' +test_expect_success 'initialize git svn' 'git svn init "$svnrepo"' +test_expect_success 'fetch revisions from svn' 'git svn fetch' name='test svn:keywords ignoring' test_expect_success "$name" \ - 'git checkout -b mybranch remotes/git-svn && + 'git checkout -b mybranch ${remotes_git_svn} && echo Hi again >> kw.c && git commit -a -m "test keywords ignoring" && - git-svn set-tree remotes/git-svn..mybranch && - git pull . remotes/git-svn' + git svn set-tree ${remotes_git_svn}..mybranch && + git pull . ${remotes_git_svn}' expect='/* $Id$ */' got="`sed -ne 2p kw.c`" @@ -90,8 +90,8 @@ test_expect_success "propset CR on crlf files" \ cd ..' test_expect_success 'fetch and pull latest from svn and checkout a new wc' \ - 'git-svn fetch && - git pull . remotes/git-svn && + 'git svn fetch && + git pull . ${remotes_git_svn} && svn co "$svnrepo" new_wc' for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf @@ -103,8 +103,8 @@ done cd test_wc printf '$Id$\rHello\rWorld\r' > cr printf '$Id$\rHello\rWorld' > ne_cr - a_cr=`printf '$Id$\r\nHello\r\nWorld\r\n' | git-hash-object --stdin` - a_ne_cr=`printf '$Id$\r\nHello\r\nWorld' | git-hash-object --stdin` + a_cr=`printf '$Id$\r\nHello\r\nWorld\r\n' | git hash-object --stdin` + a_ne_cr=`printf '$Id$\r\nHello\r\nWorld' | git hash-object --stdin` test_expect_success 'Set CRLF on cr files' \ 'svn propset svn:eol-style CRLF cr && svn propset svn:eol-style CRLF ne_cr && @@ -113,10 +113,10 @@ cd test_wc svn commit -m "propset CRLF on cr files"' cd .. test_expect_success 'fetch and pull latest from svn' \ - 'git-svn fetch && git pull . remotes/git-svn' + 'git svn fetch && git pull . ${remotes_git_svn}' -b_cr="`git-hash-object cr`" -b_ne_cr="`git-hash-object ne_cr`" +b_cr="`git hash-object cr`" +b_ne_cr="`git hash-object ne_cr`" test_expect_success 'CRLF + $Id$' "test '$a_cr' = '$b_cr'" test_expect_success 'CRLF + $Id$ (no newline)' "test '$a_ne_cr' = '$b_ne_cr'" @@ -145,7 +145,7 @@ test_expect_success 'test show-ignore' " svn propset -R svn:ignore 'no-such-file*' . svn commit -m 'propset svn:ignore' cd .. && - git-svn show-ignore > show-ignore.got && + git svn show-ignore > show-ignore.got && cmp show-ignore.expect show-ignore.got " @@ -161,8 +161,8 @@ cat >create-ignore-index.expect <<\EOF EOF test_expect_success 'test create-ignore' " - git-svn fetch && git pull . remotes/git-svn && - git-svn create-ignore && + git svn fetch && git pull . ${remotes_git_svn} && + git svn create-ignore && cmp ./.gitignore create-ignore.expect && cmp ./deeply/.gitignore create-ignore.expect && cmp ./deeply/nested/.gitignore create-ignore.expect && @@ -182,15 +182,15 @@ EOF # pattern, it can pass even though the propget did not execute on the # right directory. test_expect_success 'test propget' " - git-svn propget svn:ignore . | cmp - prop.expect && + git svn propget svn:ignore . | cmp - prop.expect && cd deeply && - git-svn propget svn:ignore . | cmp - ../prop.expect && - git-svn propget svn:entry:committed-rev nested/directory/.keep \ + git svn propget svn:ignore . | cmp - ../prop.expect && + git svn propget svn:entry:committed-rev nested/directory/.keep \ | cmp - ../prop2.expect && - git-svn propget svn:ignore .. | cmp - ../prop.expect && - git-svn propget svn:ignore nested/ | cmp - ../prop.expect && - git-svn propget svn:ignore ./nested | cmp - ../prop.expect && - git-svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect + git svn propget svn:ignore .. | cmp - ../prop.expect && + git svn propget svn:ignore nested/ | cmp - ../prop.expect && + git svn propget svn:ignore ./nested | cmp - ../prop.expect && + git svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect " cat >prop.expect <<\EOF @@ -210,8 +210,8 @@ Properties on 'nested/directory/.keep': EOF test_expect_success 'test proplist' " - git-svn proplist . | cmp - prop.expect && - git-svn proplist nested/directory/.keep | cmp - prop2.expect + git svn proplist . | cmp - prop.expect && + git svn proplist nested/directory/.keep | cmp - prop2.expect " test_done diff --git a/t/t9102-git-svn-deep-rmdir.sh b/t/t9102-git-svn-deep-rmdir.sh index 0e7ce34b9b..e223218015 100755 --- a/t/t9102-git-svn-deep-rmdir.sh +++ b/t/t9102-git-svn-deep-rmdir.sh @@ -1,5 +1,5 @@ #!/bin/sh -test_description='git-svn rmdir' +test_description='git svn rmdir' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' @@ -9,20 +9,20 @@ test_expect_success 'initialize repo' ' mkdir -p deeply/nested/directory/number/2 && echo foo > deeply/nested/directory/number/1/file && echo foo > deeply/nested/directory/number/2/another && - svn import -m "import for git-svn" . "$svnrepo" && + svn import -m "import for git svn" . "$svnrepo" && cd .. ' -test_expect_success 'mirror via git-svn' ' - git-svn init "$svnrepo" && - git-svn fetch && - git checkout -f -b test-rmdir remotes/git-svn +test_expect_success 'mirror via git svn' ' + git svn init "$svnrepo" && + git svn fetch && + git checkout -f -b test-rmdir ${remotes_git_svn} ' test_expect_success 'Try a commit on rmdir' ' git rm -f deeply/nested/directory/number/2/another && git commit -a -m "remove another" && - git-svn set-tree --rmdir HEAD && + git svn set-tree --rmdir HEAD && svn ls -R "$svnrepo" | grep ^deeply/nested/directory/number/1 ' diff --git a/t/t9103-git-svn-tracked-directory-removed.sh b/t/t9103-git-svn-tracked-directory-removed.sh index 9ffd8458ef..963dd95e4a 100755 --- a/t/t9103-git-svn-tracked-directory-removed.sh +++ b/t/t9103-git-svn-tracked-directory-removed.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Eric Wong # -test_description='git-svn tracking removed top-level path' +test_description='git svn tracking removed top-level path' . ./lib-git-svn.sh test_expect_success 'make history for tracking' ' diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh index 4d964e2db7..0a091e048e 100755 --- a/t/t9104-git-svn-follow-parent.sh +++ b/t/t9104-git-svn-follow-parent.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Eric Wong # -test_description='git-svn fetching' +test_description='git svn fetching' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' @@ -27,8 +27,8 @@ test_expect_success 'initialize repo' ' ' test_expect_success 'init and fetch a moved directory' ' - git-svn init --minimize-url -i thunk "$svnrepo"/thunk && - git-svn fetch -i thunk && + git svn init --minimize-url -i thunk "$svnrepo"/thunk && + git svn fetch -i thunk && test "`git rev-parse --verify refs/remotes/thunk@2`" \ = "`git rev-parse --verify refs/remotes/thunk~1`" && test "`git cat-file blob refs/remotes/thunk:readme |\ @@ -43,7 +43,7 @@ test_expect_success 'init and fetch from one svn-remote' ' trunk:refs/remotes/svn/trunk && git config --add svn-remote.svn.fetch \ thunk:refs/remotes/svn/thunk && - git-svn fetch -i svn/thunk && + git svn fetch -i svn/thunk && test "`git rev-parse --verify refs/remotes/svn/trunk`" \ = "`git rev-parse --verify refs/remotes/svn/thunk~1`" && test "`git cat-file blob refs/remotes/svn/thunk:readme |\ @@ -57,8 +57,8 @@ test_expect_success 'follow deleted parent' ' -r2 "$svnrepo"/trunk "$svnrepo"/junk) && git config --add svn-remote.svn.fetch \ junk:refs/remotes/svn/junk && - git-svn fetch -i svn/thunk && - git-svn fetch -i svn/junk && + git svn fetch -i svn/thunk && + git svn fetch -i svn/junk && test -z "`git diff svn/junk svn/trunk`" && test "`git merge-base svn/junk svn/trunk`" \ = "`git rev-parse svn/trunk`" @@ -69,9 +69,9 @@ test_expect_success 'follow larger parent' ' echo hi > import/trunk/thunk/bump/thud/file && svn import -m "import a larger parent" import "$svnrepo"/larger-parent && svn cp -m "hi" "$svnrepo"/larger-parent "$svnrepo"/another-larger && - git-svn init --minimize-url -i larger \ + git svn init --minimize-url -i larger \ "$svnrepo"/another-larger/trunk/thunk/bump/thud && - git-svn fetch -i larger && + git svn fetch -i larger && git rev-parse --verify refs/remotes/larger && git rev-parse --verify \ refs/remotes/larger-parent/trunk/thunk/bump/thud && @@ -92,15 +92,15 @@ test_expect_success 'follow higher-level parent' ' cd .. svn mkdir -m "new glob at top level" "$svnrepo"/glob && svn mv -m "move blob down a level" "$svnrepo"/blob "$svnrepo"/glob/blob && - git-svn init --minimize-url -i blob "$svnrepo"/glob/blob && - git-svn fetch -i blob + git svn init --minimize-url -i blob "$svnrepo"/glob/blob && + git svn fetch -i blob ' test_expect_success 'follow deleted directory' ' svn mv -m "bye!" "$svnrepo"/glob/blob/hi "$svnrepo"/glob/blob/bye && svn rm -m "remove glob" "$svnrepo"/glob && - git-svn init --minimize-url -i glob "$svnrepo"/glob && - git-svn fetch -i glob && + git svn init --minimize-url -i glob "$svnrepo"/glob && + git svn fetch -i glob && test "`git cat-file blob refs/remotes/glob:blob/bye`" = hi && test "`git ls-tree refs/remotes/glob | wc -l `" -eq 1 ' @@ -129,9 +129,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' ' poke native/t/c.t && svn commit -m "reorg test" && cd .. && - git-svn init --minimize-url -i r9270-t \ + git svn init --minimize-url -i r9270-t \ "$svnrepo"/r9270/trunk/subversion/bindings/swig/perl/native/t && - git-svn fetch -i r9270-t && + git svn fetch -i r9270-t && test `git rev-list r9270-t | wc -l` -eq 2 && test "`git ls-tree --name-only r9270-t~1`" = \ "`git ls-tree --name-only r9270-t`" @@ -139,9 +139,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' ' test_expect_success "track initial change if it was only made to parent" ' svn cp -m "wheee!" "$svnrepo"/r9270/trunk "$svnrepo"/r9270/drunk && - git-svn init --minimize-url -i r9270-d \ + git svn init --minimize-url -i r9270-d \ "$svnrepo"/r9270/drunk/subversion/bindings/swig/perl/native/t && - git-svn fetch -i r9270-d && + git svn fetch -i r9270-d && test `git rev-list r9270-d | wc -l` -eq 3 && test "`git ls-tree --name-only r9270-t`" = \ "`git ls-tree --name-only r9270-d`" && @@ -151,19 +151,19 @@ test_expect_success "track initial change if it was only made to parent" ' test_expect_success "track multi-parent paths" ' svn cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob && - git-svn multi-fetch && + git svn multi-fetch && test `git cat-file commit refs/remotes/glob | \ grep "^parent " | wc -l` -eq 2 ' test_expect_success "multi-fetch continues to work" " - git-svn multi-fetch + git svn multi-fetch " test_expect_success "multi-fetch works off a 'clean' repository" ' rm -r "$GIT_DIR/svn" "$GIT_DIR/refs/remotes" "$GIT_DIR/logs" && mkdir "$GIT_DIR/svn" && - git-svn multi-fetch + git svn multi-fetch ' test_debug 'gitk --all &' diff --git a/t/t9105-git-svn-commit-diff.sh b/t/t9105-git-svn-commit-diff.sh index 63230367bb..ba99abb6d9 100755 --- a/t/t9105-git-svn-commit-diff.sh +++ b/t/t9105-git-svn-commit-diff.sh @@ -1,7 +1,7 @@ #!/bin/sh # # Copyright (c) 2006 Eric Wong -test_description='git-svn commit-diff' +test_description='git svn commit-diff' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' @@ -26,16 +26,16 @@ prev=`git rev-parse --verify HEAD^1` test_expect_success 'test the commit-diff command' ' test -n "$prev" && test -n "$head" && - git-svn commit-diff -r1 "$prev" "$head" "$svnrepo" && + git svn commit-diff -r1 "$prev" "$head" "$svnrepo" && svn co "$svnrepo" wc && cmp readme wc/readme ' -test_expect_success 'commit-diff to a sub-directory (with git-svn config)' ' +test_expect_success 'commit-diff to a sub-directory (with git svn config)' ' svn import -m "sub-directory" import "$svnrepo"/subdir && - git-svn init --minimize-url "$svnrepo"/subdir && - git-svn fetch && - git-svn commit-diff -r3 "$prev" "$head" && + git svn init --minimize-url "$svnrepo"/subdir && + git svn fetch && + git svn commit-diff -r3 "$prev" "$head" && svn cat "$svnrepo"/subdir/readme > readme.2 && cmp readme readme.2 ' diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh index 83896e9687..6eb0fd85c8 100755 --- a/t/t9106-git-svn-commit-diff-clobber.sh +++ b/t/t9106-git-svn-commit-diff-clobber.sh @@ -1,7 +1,7 @@ #!/bin/sh # # Copyright (c) 2006 Eric Wong -test_description='git-svn commit-diff clobber' +test_description='git svn commit-diff clobber' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' @@ -27,7 +27,7 @@ test_expect_success 'commit change from svn side' ' test_expect_success 'commit conflicting change from git' ' echo second line from git >> file && git commit -a -m "second line from git" && - test_must_fail git-svn commit-diff -r1 HEAD~1 HEAD "$svnrepo" + test_must_fail git svn commit-diff -r1 HEAD~1 HEAD "$svnrepo" ' test_expect_success 'commit complementing change from git' ' @@ -36,13 +36,13 @@ test_expect_success 'commit complementing change from git' ' git commit -a -m "second line from svn" && echo third line from git >> file && git commit -a -m "third line from git" && - git-svn commit-diff -r2 HEAD~1 HEAD "$svnrepo" + git svn commit-diff -r2 HEAD~1 HEAD "$svnrepo" ' test_expect_success 'dcommit fails to commit because of conflict' ' - git-svn init "$svnrepo" && - git-svn fetch && - git reset --hard refs/remotes/git-svn && + git svn init "$svnrepo" && + git svn fetch && + git reset --hard refs/${remotes_git_svn} && svn co "$svnrepo" t.svn && cd t.svn && echo fourth line from svn >> file && @@ -52,18 +52,18 @@ test_expect_success 'dcommit fails to commit because of conflict' ' rm -rf t.svn && echo "fourth line from git" >> file && git commit -a -m "fourth line from git" && - test_must_fail git-svn dcommit + test_must_fail git svn dcommit ' test_expect_success 'dcommit does the svn equivalent of an index merge' " - git reset --hard refs/remotes/git-svn && + git reset --hard refs/${remotes_git_svn} && echo 'index merge' > file2 && git update-index --add file2 && git commit -a -m 'index merge' && echo 'more changes' >> file2 && git update-index file2 && git commit -a -m 'more changes' && - git-svn dcommit + git svn dcommit " test_expect_success 'commit another change from svn side' ' @@ -76,8 +76,8 @@ test_expect_success 'commit another change from svn side' ' rm -rf t.svn ' -test_expect_success 'multiple dcommit from git-svn will not clobber svn' " - git reset --hard refs/remotes/git-svn && +test_expect_success 'multiple dcommit from git svn will not clobber svn' " + git reset --hard refs/${remotes_git_svn} && echo new file >> new-file && git update-index --add new-file && git commit -a -m 'new file' && diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh index bc37db9d62..fd185011b7 100755 --- a/t/t9106-git-svn-dcommit-clobber-series.sh +++ b/t/t9106-git-svn-dcommit-clobber-series.sh @@ -1,7 +1,7 @@ #!/bin/sh # # Copyright (c) 2007 Eric Wong -test_description='git-svn dcommit clobber series' +test_description='git svn dcommit clobber series' . ./lib-git-svn.sh test_expect_success 'initialize repo' ' diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh index d9b553ad55..acad16a6f0 100755 --- a/t/t9107-git-svn-migrate.sh +++ b/t/t9107-git-svn-migrate.sh @@ -1,6 +1,6 @@ #!/bin/sh # Copyright (c) 2006 Eric Wong -test_description='git-svn metadata migrations from previous versions' +test_description='git svn metadata migrations from previous versions' . ./lib-git-svn.sh test_expect_success 'setup old-looking metadata' ' @@ -14,34 +14,34 @@ test_expect_success 'setup old-looking metadata' ' done && \ svn import -m test . "$svnrepo" cd .. && - git-svn init "$svnrepo" && - git-svn fetch && + git svn init "$svnrepo" && + git svn fetch && mv "$GIT_DIR"/svn/* "$GIT_DIR"/ && mv "$GIT_DIR"/svn/.metadata "$GIT_DIR"/ && rmdir "$GIT_DIR"/svn && - git update-ref refs/heads/git-svn-HEAD refs/remotes/git-svn && - git update-ref refs/heads/svn-HEAD refs/remotes/git-svn && - git update-ref -d refs/remotes/git-svn refs/remotes/git-svn + git update-ref refs/heads/git-svn-HEAD refs/${remotes_git_svn} && + git update-ref refs/heads/svn-HEAD refs/${remotes_git_svn} && + git update-ref -d refs/${remotes_git_svn} refs/${remotes_git_svn} ' head=`git rev-parse --verify refs/heads/git-svn-HEAD^0` test_expect_success 'git-svn-HEAD is a real HEAD' "test -n '$head'" -test_expect_success 'initialize old-style (v0) git-svn layout' ' +test_expect_success 'initialize old-style (v0) git svn layout' ' mkdir -p "$GIT_DIR"/git-svn/info "$GIT_DIR"/svn/info && echo "$svnrepo" > "$GIT_DIR"/git-svn/info/url && echo "$svnrepo" > "$GIT_DIR"/svn/info/url && - git-svn migrate && - ! test -d "$GIT_DIR"/git-svn && - git rev-parse --verify refs/remotes/git-svn^0 && + git svn migrate && + ! test -d "$GIT_DIR"/git svn && + git rev-parse --verify refs/${remotes_git_svn}^0 && git rev-parse --verify refs/remotes/svn^0 && test "$(git config --get svn-remote.svn.url)" = "$svnrepo" && test `git config --get svn-remote.svn.fetch` = \ - ":refs/remotes/git-svn" + ":refs/${remotes_git_svn}" ' test_expect_success 'initialize a multi-repository repo' ' - git-svn init "$svnrepo" -T trunk -t tags -b branches && + git svn init "$svnrepo" -T trunk -t tags -b branches && git config --get-all svn-remote.svn.fetch > fetch.out && grep "^trunk:refs/remotes/trunk$" fetch.out && test -n "`git config --get svn-remote.svn.branches \ @@ -61,7 +61,7 @@ test_expect_success 'initialize a multi-repository repo' ' # refs should all be different, but the trees should all be the same: test_expect_success 'multi-fetch works on partial urls + paths' " - git-svn multi-fetch && + git svn multi-fetch && for i in trunk a b tags/0.1 tags/0.2 tags/0.3; do git rev-parse --verify refs/remotes/\$i^0 >> refs.out || exit 1; done && @@ -85,7 +85,7 @@ test_expect_success 'migrate --minimize on old inited layout' ' ( mkdir -p "$GIT_DIR"/svn/$ref/info/ && echo "$svnrepo"$path > "$GIT_DIR"/svn/$ref/info/url ) || exit 1; done && - git-svn migrate --minimize && + git svn migrate --minimize && test -z "`git config -l |grep -v "^svn-remote\.git-svn\."`" && git config --get-all svn-remote.svn.fetch > fetch.out && grep "^trunk:refs/remotes/trunk$" fetch.out && @@ -94,11 +94,11 @@ test_expect_success 'migrate --minimize on old inited layout' ' grep "^tags/0\.1:refs/remotes/tags/0\.1$" fetch.out && grep "^tags/0\.2:refs/remotes/tags/0\.2$" fetch.out && grep "^tags/0\.3:refs/remotes/tags/0\.3$" fetch.out - grep "^:refs/remotes/git-svn" fetch.out + grep "^:refs/${remotes_git_svn}" fetch.out ' test_expect_success ".rev_db auto-converted to .rev_map.UUID" ' - git-svn fetch -i trunk && + git svn fetch -i trunk && test -z "$(ls "$GIT_DIR"/svn/trunk/.rev_db.* 2>/dev/null)" && expect="$(ls "$GIT_DIR"/svn/trunk/.rev_map.*)" && test -n "$expect" && @@ -106,7 +106,7 @@ test_expect_success ".rev_db auto-converted to .rev_map.UUID" ' convert_to_rev_db "$expect" "$rev_db" && rm -f "$expect" && test -f "$rev_db" && - git-svn fetch -i trunk && + git svn fetch -i trunk && test -z "$(ls "$GIT_DIR"/svn/trunk/.rev_db.* 2>/dev/null)" && test ! -e "$GIT_DIR"/svn/trunk/.rev_db && test -f "$expect" diff --git a/t/t9108-git-svn-glob.sh b/t/t9108-git-svn-glob.sh index 8b792a1370..d8582b1aa5 100755 --- a/t/t9108-git-svn-glob.sh +++ b/t/t9108-git-svn-glob.sh @@ -1,6 +1,6 @@ #!/bin/sh # Copyright (c) 2007 Eric Wong -test_description='git-svn globbing refspecs' +test_description='git svn globbing refspecs' . ./lib-git-svn.sh cat > expect.end <<EOF @@ -46,7 +46,7 @@ test_expect_success 'test refspec globbing' ' "branches/*/src/a:refs/remotes/branches/*" && git config --add svn-remote.svn.tags\ "tags/*/src/a:refs/remotes/tags/*" && - git-svn multi-fetch && + git svn multi-fetch && git log --pretty=oneline refs/remotes/tags/end | \ sed -e "s/^.\{41\}//" > output.end && test_cmp expect.end output.end && @@ -74,7 +74,7 @@ test_expect_success 'test left-hand-side only globbing' ' poke tags/end/src/b/readme && svn commit -m "try to try" ) && - git-svn fetch two && + git svn fetch two && test `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 && test `git rev-list refs/remotes/two/branches/start | wc -l` -eq 3 && test `git rev-parse refs/remotes/two/branches/start~2` = \ @@ -104,7 +104,7 @@ test_expect_success 'test disallow multi-globs' ' poke tags/end/src/b/readme && svn commit -m "try to try" ) && - test_must_fail git-svn fetch three 2> stderr.three && + test_must_fail git svn fetch three 2> stderr.three && test_cmp expect.three stderr.three ' diff --git a/t/t9108-git-svn-multi-glob.sh b/t/t9108-git-svn-multi-glob.sh index 3583721652..8f79c3f251 100755 --- a/t/t9108-git-svn-multi-glob.sh +++ b/t/t9108-git-svn-multi-glob.sh @@ -1,6 +1,6 @@ #!/bin/sh # Copyright (c) 2007 Eric Wong -test_description='git-svn globbing refspecs' +test_description='git svn globbing refspecs' . ./lib-git-svn.sh cat > expect.end <<EOF @@ -46,7 +46,7 @@ test_expect_success 'test refspec globbing' ' "branches/*/*/src/a:refs/remotes/branches/*/*" && git config --add svn-remote.svn.tags\ "tags/*/src/a:refs/remotes/tags/*" && - git-svn multi-fetch && + git svn multi-fetch && git log --pretty=oneline refs/remotes/tags/end | \ sed -e "s/^.\{41\}//" > output.end && test_cmp expect.end output.end && @@ -74,7 +74,7 @@ test_expect_success 'test left-hand-side only globbing' ' poke tags/end/src/b/readme && svn commit -m "try to try" ) && - git-svn fetch two && + git svn fetch two && test `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 && test `git rev-list refs/remotes/two/branches/v1/start | wc -l` -eq 3 && test `git rev-parse refs/remotes/two/branches/v1/start~2` = \ @@ -123,7 +123,7 @@ test_expect_success 'test another branch' ' "branches/*/*:refs/remotes/four/branches/*/*" && git config --add svn-remote.four.tags \ "tags/*:refs/remotes/four/tags/*" && - git-svn fetch four && + git svn fetch four && test `git rev-list refs/remotes/four/tags/next | wc -l` -eq 5 && test `git rev-list refs/remotes/four/branches/v2/start | wc -l` -eq 3 && test `git rev-parse refs/remotes/four/branches/v2/start~2` = \ @@ -153,7 +153,7 @@ test_expect_success 'test disallow multiple globs' ' poke tags/end/src/b/readme && svn commit -m "try to try" ) && - test_must_fail git-svn fetch three 2> stderr.three && + test_must_fail git svn fetch three 2> stderr.three && test_cmp expect.three stderr.three ' diff --git a/t/t9110-git-svn-use-svm-props.sh b/t/t9110-git-svn-use-svm-props.sh index 04d2a65c08..a06e4c5b8e 100755 --- a/t/t9110-git-svn-use-svm-props.sh +++ b/t/t9110-git-svn-use-svm-props.sh @@ -3,18 +3,18 @@ # Copyright (c) 2007 Eric Wong # -test_description='git-svn useSvmProps test' +test_description='git svn useSvmProps test' . ./lib-git-svn.sh test_expect_success 'load svm repo' ' - svnadmin load -q "$rawsvnrepo" < ../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 \ + 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 \ "$svnrepo"/mirror/argh/a/b/c/d/e && git config svn.useSvmProps true && - git-svn fetch --all + git svn fetch --all ' uuid=161ce429-a9dd-4828-af4a-52023f968c89 @@ -22,40 +22,40 @@ uuid=161ce429-a9dd-4828-af4a-52023f968c89 bar_url=http://mayonaise/svnrepo/bar test_expect_success 'verify metadata for /bar' " git cat-file commit refs/remotes/bar | \ - grep '^git-svn-id: $bar_url@12 $uuid$' && + grep '^${git_svn_id}: $bar_url@12 $uuid$' && git cat-file commit refs/remotes/bar~1 | \ - grep '^git-svn-id: $bar_url@11 $uuid$' && + grep '^${git_svn_id}: $bar_url@11 $uuid$' && git cat-file commit refs/remotes/bar~2 | \ - grep '^git-svn-id: $bar_url@10 $uuid$' && + grep '^${git_svn_id}: $bar_url@10 $uuid$' && git cat-file commit refs/remotes/bar~3 | \ - grep '^git-svn-id: $bar_url@9 $uuid$' && + grep '^${git_svn_id}: $bar_url@9 $uuid$' && git cat-file commit refs/remotes/bar~4 | \ - grep '^git-svn-id: $bar_url@6 $uuid$' && + grep '^${git_svn_id}: $bar_url@6 $uuid$' && git cat-file commit refs/remotes/bar~5 | \ - grep '^git-svn-id: $bar_url@1 $uuid$' + grep '^${git_svn_id}: $bar_url@1 $uuid$' " e_url=http://mayonaise/svnrepo/dir/a/b/c/d/e test_expect_success 'verify metadata for /dir/a/b/c/d/e' " git cat-file commit refs/remotes/e | \ - grep '^git-svn-id: $e_url@1 $uuid$' + grep '^${git_svn_id}: $e_url@1 $uuid$' " dir_url=http://mayonaise/svnrepo/dir test_expect_success 'verify metadata for /dir' " git cat-file commit refs/remotes/dir | \ - grep '^git-svn-id: $dir_url@2 $uuid$' && + grep '^${git_svn_id}: $dir_url@2 $uuid$' && git cat-file commit refs/remotes/dir~1 | \ - grep '^git-svn-id: $dir_url@1 $uuid$' + grep '^${git_svn_id}: $dir_url@1 $uuid$' " test_expect_success 'find commit based on SVN revision number' " - git-svn find-rev r12 | + git svn find-rev r12 | grep `git rev-parse HEAD` " test_expect_success 'empty rebase' " - git-svn rebase + git svn rebase " test_done diff --git a/t/t9111-git-svn-use-svnsync-props.sh b/t/t9111-git-svn-use-svnsync-props.sh index a8d74dcd3a..bd081c2ec3 100755 --- a/t/t9111-git-svn-use-svnsync-props.sh +++ b/t/t9111-git-svn-use-svnsync-props.sh @@ -3,17 +3,17 @@ # Copyright (c) 2007 Eric Wong # -test_description='git-svn useSvnsyncProps test' +test_description='git svn useSvnsyncProps test' . ./lib-git-svn.sh test_expect_success 'load svnsync repo' ' - svnadmin load -q "$rawsvnrepo" < ../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 && + 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 && git config svn.useSvnsyncProps true && - git-svn fetch --all + git svn fetch --all ' uuid=161ce429-a9dd-4828-af4a-52023f968c89 @@ -21,31 +21,31 @@ uuid=161ce429-a9dd-4828-af4a-52023f968c89 bar_url=http://mayonaise/svnrepo/bar test_expect_success 'verify metadata for /bar' " git cat-file commit refs/remotes/bar | \ - grep '^git-svn-id: $bar_url@12 $uuid$' && + grep '^${git_svn_id}: $bar_url@12 $uuid$' && git cat-file commit refs/remotes/bar~1 | \ - grep '^git-svn-id: $bar_url@11 $uuid$' && + grep '^${git_svn_id}: $bar_url@11 $uuid$' && git cat-file commit refs/remotes/bar~2 | \ - grep '^git-svn-id: $bar_url@10 $uuid$' && + grep '^${git_svn_id}: $bar_url@10 $uuid$' && git cat-file commit refs/remotes/bar~3 | \ - grep '^git-svn-id: $bar_url@9 $uuid$' && + grep '^${git_svn_id}: $bar_url@9 $uuid$' && git cat-file commit refs/remotes/bar~4 | \ - grep '^git-svn-id: $bar_url@6 $uuid$' && + grep '^${git_svn_id}: $bar_url@6 $uuid$' && git cat-file commit refs/remotes/bar~5 | \ - grep '^git-svn-id: $bar_url@1 $uuid$' + grep '^${git_svn_id}: $bar_url@1 $uuid$' " e_url=http://mayonaise/svnrepo/dir/a/b/c/d/e test_expect_success 'verify metadata for /dir/a/b/c/d/e' " git cat-file commit refs/remotes/e | \ - grep '^git-svn-id: $e_url@1 $uuid$' + grep '^${git_svn_id}: $e_url@1 $uuid$' " dir_url=http://mayonaise/svnrepo/dir test_expect_success 'verify metadata for /dir' " git cat-file commit refs/remotes/dir | \ - grep '^git-svn-id: $dir_url@2 $uuid$' && + grep '^${git_svn_id}: $dir_url@2 $uuid$' && git cat-file commit refs/remotes/dir~1 | \ - grep '^git-svn-id: $dir_url@1 $uuid$' + grep '^${git_svn_id}: $dir_url@1 $uuid$' " test_done diff --git a/t/t9112-git-svn-md5less-file.sh b/t/t9112-git-svn-md5less-file.sh index d470a920e4..a61d6716d2 100755 --- a/t/t9112-git-svn-md5less-file.sh +++ b/t/t9112-git-svn-md5less-file.sh @@ -42,6 +42,6 @@ EOF test_expect_success 'load svn dumpfile' 'svnadmin load "$rawsvnrepo" < dumpfile.svn' -test_expect_success 'initialize git-svn' 'git-svn init "$svnrepo"' -test_expect_success 'fetch revisions from svn' 'git-svn fetch' +test_expect_success 'initialize git svn' 'git svn init "$svnrepo"' +test_expect_success 'fetch revisions from svn' 'git svn fetch' test_done diff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh index ae78e334ac..e9b6128b3f 100755 --- a/t/t9113-git-svn-dcommit-new-file.sh +++ b/t/t9113-git-svn-dcommit-new-file.sh @@ -8,23 +8,11 @@ # daemon running on a users system if the test fails. # Not all git users will need to interact with SVN. -test_description='git-svn dcommit new files over svn:// test' +test_description='git svn dcommit new files over svn:// test' . ./lib-git-svn.sh -if test -z "$SVNSERVE_PORT" -then - say 'skipping svnserve test. (set $SVNSERVE_PORT to enable)' - test_done - exit -fi - -start_svnserve () { - svnserve --listen-port $SVNSERVE_PORT \ - --root "$rawsvnrepo" \ - --listen-once \ - --listen-host 127.0.0.1 & -} +require_svnserve test_expect_success 'start tracking an empty repo' ' svn mkdir -m "empty dir" "$svnrepo"/empty-dir && diff --git a/t/t9114-git-svn-dcommit-merge.sh b/t/t9114-git-svn-dcommit-merge.sh index 61d7781616..17b2855c4f 100755 --- a/t/t9114-git-svn-dcommit-merge.sh +++ b/t/t9114-git-svn-dcommit-merge.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Eric Wong # Based on a script by Joakim Tjernlund <joakim.tjernlund@transmode.se> -test_description='git-svn dcommit handles merges' +test_description='git svn dcommit handles merges' . ./lib-git-svn.sh diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh index f0fbd3aff7..9be7aefaee 100755 --- a/t/t9115-git-svn-dcommit-funky-renames.sh +++ b/t/t9115-git-svn-dcommit-funky-renames.sh @@ -3,12 +3,12 @@ # Copyright (c) 2007 Eric Wong -test_description='git-svn dcommit can commit renames of files with ugly names' +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+ ' @@ -75,7 +75,7 @@ test_expect_success 'make a commit to test rebase' ' git svn dcommit ' -test_expect_success 'git-svn rebase works inside a fresh-cloned repository' ' +test_expect_success 'git svn rebase works inside a fresh-cloned repository' ' cd test-rebase && git svn rebase && test -e test-rebase-main && diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh index 4b2cc878f6..fd6d1d2046 100755 --- a/t/t9116-git-svn-log.sh +++ b/t/t9116-git-svn-log.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Eric Wong # -test_description='git-svn log tests' +test_description='git svn log tests' . ./lib-git-svn.sh test_expect_success 'setup repository and import' ' @@ -16,8 +16,8 @@ test_expect_success 'setup repository and import' ' done && \ svn import -m test . "$svnrepo" cd .. && - git-svn init "$svnrepo" -T trunk -b branches -t tags && - git-svn fetch && + git svn init "$svnrepo" -T trunk -b branches -t tags && + git svn fetch && git reset --hard trunk && echo bye >> README && git commit -a -m bye && diff --git a/t/t9117-git-svn-init-clone.sh b/t/t9117-git-svn-init-clone.sh index 7a689bb1cd..dde46cd92f 100755 --- a/t/t9117-git-svn-init-clone.sh +++ b/t/t9117-git-svn-init-clone.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Eric Wong # -test_description='git-svn init/clone tests' +test_description='git svn init/clone tests' . ./lib-git-svn.sh diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh index 3281cbd347..7a7c128687 100755 --- a/t/t9118-git-svn-funky-branch-names.sh +++ b/t/t9118-git-svn-funky-branch-names.sh @@ -3,9 +3,13 @@ # Copyright (c) 2007 Eric Wong # -test_description='git-svn funky branch names' +test_description='git svn funky branch names' . ./lib-git-svn.sh +# Abo-Uebernahme (Bug #994) +scary_uri='Abo-Uebernahme%20%28Bug%20%23994%29' +scary_ref='Abo-Uebernahme%20(Bug%20#994)' + test_expect_success 'setup svnrepo' ' mkdir project project/trunk project/branches project/tags && echo foo > project/trunk/foo && @@ -15,6 +19,8 @@ test_expect_success 'setup svnrepo' ' "$svnrepo/pr ject/branches/fun plugin" && svn cp -m "more fun!" "$svnrepo/pr ject/branches/fun plugin" \ "$svnrepo/pr ject/branches/more fun plugin!" && + svn cp -m "scary" "$svnrepo/pr ject/branches/fun plugin" \ + "$svnrepo/pr ject/branches/$scary_uri" && start_httpd ' @@ -23,6 +29,7 @@ test_expect_success 'test clone with funky branch names' ' cd project && git rev-parse "refs/remotes/fun%20plugin" && git rev-parse "refs/remotes/more%20fun%20plugin!" && + git rev-parse "refs/remotes/$scary_ref" && cd .. ' @@ -35,6 +42,15 @@ test_expect_success 'test dcommit to funky branch' " cd .. " +test_expect_success 'test dcommit to scary branch' ' + cd project && + git reset --hard "refs/remotes/$scary_ref" && + echo urls are scary >> foo && + git commit -m "eep" -- foo && + git svn dcommit && + cd .. + ' + stop_httpd test_done diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh index 5fd36a1483..27dd7c273a 100755 --- a/t/t9119-git-svn-info.sh +++ b/t/t9119-git-svn-info.sh @@ -2,16 +2,14 @@ # # Copyright (c) 2007 David D. Kilzer -test_description='git-svn info' +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,80 +47,92 @@ 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 && + 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 + (cd gitwc; git svn 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 + (cd gitwc; git svn info .) > 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 + (cd gitwc; git svn 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 + (cd gitwc; git svn 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 + (cd gitwc; git svn 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" + test "$(cd gitwc; git svn info --url symlink-file)" \ + = "$quoted_svnrepo/symlink-file" ' test_expect_success 'info symlink-directory' " (cd svnwc; svn info symlink-directory) \ > expected.info-symlink-directory && - (cd gitwc; git-svn 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" + test "$(cd gitwc; git svn info --url symlink-directory)" \ + = "$quoted_svnrepo/symlink-directory" ' test_expect_success 'info added-file' " @@ -134,13 +146,13 @@ test_expect_success 'info added-file' " svn add added-file > /dev/null && 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 + (cd gitwc; git svn 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" + test "$(cd gitwc; git svn info --url added-file)" \ + = "$quoted_svnrepo/added-file" ' test_expect_success 'info added-directory' " @@ -155,14 +167,14 @@ test_expect_success 'info added-directory' " cd .. && (cd svnwc; svn info added-directory) \ > expected.info-added-directory && - (cd gitwc; git-svn 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" + test "$(cd gitwc; git svn info --url added-directory)" \ + = "$quoted_svnrepo/added-directory" ' test_expect_success 'info added-symlink-file' " @@ -177,15 +189,15 @@ test_expect_success 'info added-symlink-file' " ptouch gitwc/added-symlink-file svnwc/added-symlink-file && (cd svnwc; svn info added-symlink-file) \ > expected.info-added-symlink-file && - (cd gitwc; git-svn 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" + test "$(cd gitwc; git svn info --url added-symlink-file)" \ + = "$quoted_svnrepo/added-symlink-file" ' test_expect_success 'info added-symlink-directory' " @@ -200,15 +212,15 @@ test_expect_success 'info added-symlink-directory' " ptouch gitwc/added-symlink-directory svnwc/added-symlink-directory && (cd svnwc; svn info added-symlink-directory) \ > expected.info-added-symlink-directory && - (cd gitwc; git-svn 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" + test "$(cd gitwc; git svn info --url added-symlink-directory)" \ + = "$quoted_svnrepo/added-symlink-directory" ' # The next few tests replace the "Text Last Updated" value with a @@ -226,15 +238,15 @@ test_expect_success 'info deleted-file' " (cd svnwc; svn info file) | sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ > expected.info-deleted-file && - (cd gitwc; git-svn info 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" + test "$(cd gitwc; git svn info --url file)" \ + = "$quoted_svnrepo/file" ' test_expect_success 'info deleted-directory' " @@ -247,15 +259,15 @@ test_expect_success 'info deleted-directory' " (cd svnwc; svn info directory) | sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ > expected.info-deleted-directory && - (cd gitwc; git-svn info 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" + test "$(cd gitwc; git svn info --url directory)" \ + = "$quoted_svnrepo/directory" ' test_expect_success 'info deleted-symlink-file' " @@ -268,16 +280,16 @@ test_expect_success 'info deleted-symlink-file' " (cd svnwc; svn info symlink-file) | sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ > expected.info-deleted-symlink-file && - (cd gitwc; git-svn info 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" + test "$(cd gitwc; git svn info --url symlink-file)" \ + = "$quoted_svnrepo/symlink-file" ' test_expect_success 'info deleted-symlink-directory' " @@ -290,16 +302,16 @@ test_expect_success 'info deleted-symlink-directory' " (cd svnwc; svn info symlink-directory) | sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ > expected.info-deleted-symlink-directory && - (cd gitwc; git-svn info 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" + test "$(cd gitwc; git svn info --url 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/t9120-git-svn-clone-with-percent-escapes.sh b/t/t9120-git-svn-clone-with-percent-escapes.sh index 5979e133b9..ef2c0523cd 100755 --- a/t/t9120-git-svn-clone-with-percent-escapes.sh +++ b/t/t9120-git-svn-clone-with-percent-escapes.sh @@ -3,7 +3,7 @@ # Copyright (c) 2008 Kevin Ballard # -test_description='git-svn clone with percent escapes' +test_description='git svn clone with percent escapes' . ./lib-git-svn.sh test_expect_success 'setup svnrepo' ' @@ -21,7 +21,7 @@ else test_expect_success 'test clone with percent escapes' ' git svn clone "$svnrepo/pr%20ject" clone && cd clone && - git rev-parse refs/remotes/git-svn && + git rev-parse refs/${remotes_git_svn} && cd .. ' fi diff --git a/t/t9121-git-svn-fetch-renamed-dir.sh b/t/t9121-git-svn-fetch-renamed-dir.sh index 99230b0810..000cad37c6 100755 --- a/t/t9121-git-svn-fetch-renamed-dir.sh +++ b/t/t9121-git-svn-fetch-renamed-dir.sh @@ -3,12 +3,12 @@ # Copyright (c) 2008 Santhosh Kumar Mani -test_description='git-svn can fetch renamed directories' +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/t9122-git-svn-author.sh b/t/t9122-git-svn-author.sh index 1190576a65..1b1cf47281 100755 --- a/t/t9122-git-svn-author.sh +++ b/t/t9122-git-svn-author.sh @@ -13,7 +13,7 @@ test_expect_success 'setup svn repository' ' ) ' -test_expect_success 'interact with it via git-svn' ' +test_expect_success 'interact with it via git svn' ' mkdir work.git && ( cd work.git && diff --git a/t/t9123-git-svn-rebuild-with-rewriteroot.sh b/t/t9123-git-svn-rebuild-with-rewriteroot.sh index c18878fad1..cf0415274c 100755 --- a/t/t9123-git-svn-rebuild-with-rewriteroot.sh +++ b/t/t9123-git-svn-rebuild-with-rewriteroot.sh @@ -3,21 +3,21 @@ # Copyright (c) 2008 Jan Krüger # -test_description='git-svn respects rewriteRoot during rebuild' +test_description='git svn respects rewriteRoot during rebuild' . ./lib-git-svn.sh mkdir import cd import touch foo - svn import -m 'import for git-svn' . "$svnrepo" >/dev/null + svn import -m 'import for git svn' . "$svnrepo" >/dev/null cd .. rm -rf import test_expect_success 'init, fetch and checkout repository' ' git svn init --rewrite-root=http://invalid.invalid/ "$svnrepo" && git svn fetch - git checkout -b mybranch remotes/git-svn + git checkout -b mybranch ${remotes_git_svn} ' test_expect_success 'remove rev_map' ' diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh index 8223c5909e..263dbf5fc2 100755 --- a/t/t9124-git-svn-dcommit-auto-props.sh +++ b/t/t9124-git-svn-dcommit-auto-props.sh @@ -2,7 +2,7 @@ # # Copyright (c) 2008 Brad King -test_description='git-svn dcommit honors auto-props' +test_description='git svn dcommit honors auto-props' . ./lib-git-svn.sh @@ -16,26 +16,24 @@ enable-auto-props=$1 EOF } -test_expect_success 'initialize git-svn' ' +test_expect_success 'initialize git svn' ' mkdir import && ( cd import && echo foo >foo && - svn import -m "import for git-svn" . "$svnrepo" + svn import -m "import for git svn" . "$svnrepo" ) && rm -rf import && - git-svn init "$svnrepo" - git-svn fetch + git svn init "$svnrepo" + git svn fetch ' 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/t9125-git-svn-multi-glob-branch-names.sh b/t/t9125-git-svn-multi-glob-branch-names.sh index 6b62b52f54..475c751c1c 100755 --- a/t/t9125-git-svn-multi-glob-branch-names.sh +++ b/t/t9125-git-svn-multi-glob-branch-names.sh @@ -1,7 +1,7 @@ #!/bin/sh # Copyright (c) 2008 Marcus Griep -test_description='git-svn multi-glob branch names' +test_description='git svn multi-glob branch names' . ./lib-git-svn.sh test_expect_success 'setup svnrepo' ' diff --git a/t/t9126-git-svn-follow-deleted-readded-directory.sh b/t/t9126-git-svn-follow-deleted-readded-directory.sh new file mode 100755 index 0000000000..edec640e97 --- /dev/null +++ b/t/t9126-git-svn-follow-deleted-readded-directory.sh @@ -0,0 +1,22 @@ +#!/bin/sh +# +# Copyright (c) 2008 Alec Berryman + +test_description='git svn fetch repository with deleted and readded directory' + +. ./lib-git-svn.sh + +# Don't run this by default; it opens up a port. +require_svnserve + +test_expect_success 'load repository' ' + svnadmin load -q "$rawsvnrepo" < "$TEST_DIRECTORY"/t9126/follow-deleted-readded.dump + ' + +test_expect_success 'fetch repository' ' + start_svnserve && + git svn init svn://127.0.0.1:$SVNSERVE_PORT && + git svn fetch + ' + +test_done diff --git a/t/t9126/follow-deleted-readded.dump b/t/t9126/follow-deleted-readded.dump new file mode 100644 index 0000000000..19da5d1ddc --- /dev/null +++ b/t/t9126/follow-deleted-readded.dump @@ -0,0 +1,201 @@ +SVN-fs-dump-format-version: 2 + +UUID: 1807dc6f-c693-4cda-9710-00e1be8c1f21 + +Revision-number: 0 +Prop-content-length: 56 +Content-length: 56 + +K 8 +svn:date +V 27 +2008-09-14T19:53:13.006748Z +PROPS-END + +Revision-number: 1 +Prop-content-length: 111 +Content-length: 111 + +K 7 +svn:log +V 12 +Create trunk +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:13.239689Z +PROPS-END + +Node-path: trunk +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Revision-number: 2 +Prop-content-length: 119 +Content-length: 119 + +K 7 +svn:log +V 20 +Create trunk/project +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:13.548860Z +PROPS-END + +Node-path: trunk/project +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Revision-number: 3 +Prop-content-length: 111 +Content-length: 111 + +K 7 +svn:log +V 12 +add new file +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:15.433630Z +PROPS-END + +Node-path: trunk/project/foo +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 4 +Text-content-md5: d3b07384d113edec49eaa6238ad5ff00 +Content-length: 14 + +PROPS-END +foo + + +Revision-number: 4 +Prop-content-length: 116 +Content-length: 116 + +K 7 +svn:log +V 17 +change foo to bar +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:17.339884Z +PROPS-END + +Node-path: trunk/project/foo +Node-kind: file +Node-action: change +Text-content-length: 4 +Text-content-md5: c157a79031e1c40f85931829bc5fc552 +Content-length: 4 + +bar + + +Revision-number: 5 +Prop-content-length: 114 +Content-length: 114 + +K 7 +svn:log +V 15 +don't like that +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:19.335001Z +PROPS-END + +Node-path: trunk/project +Node-action: delete + + +Revision-number: 6 +Prop-content-length: 110 +Content-length: 110 + +K 7 +svn:log +V 11 +reset trunk +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:19.845897Z +PROPS-END + +Node-path: trunk/project +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 4 +Node-copyfrom-path: trunk/project + + +Revision-number: 7 +Prop-content-length: 113 +Content-length: 113 + +K 7 +svn:log +V 14 +change to quux +K 10 +svn:author +V 4 +alec +K 8 +svn:date +V 27 +2008-09-14T19:53:21.367947Z +PROPS-END + +Node-path: trunk/project/foo +Node-kind: file +Node-action: change +Text-content-length: 5 +Text-content-md5: d3b07a382ec010c01889250fce66fb13 +Content-length: 5 + +quux + + diff --git a/t/t9127-git-svn-partial-rebuild.sh b/t/t9127-git-svn-partial-rebuild.sh new file mode 100755 index 0000000000..87696a92dc --- /dev/null +++ b/t/t9127-git-svn-partial-rebuild.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# +# Copyright (c) 2008 Deskin Miller +# + +test_description='git svn partial-rebuild tests' +. ./lib-git-svn.sh + +test_expect_success 'initialize svnrepo' ' + mkdir import && + ( + cd import && + mkdir trunk branches tags && + cd trunk && + echo foo > foo && + cd .. && + svn import -m "import for git-svn" . "$svnrepo" >/dev/null && + svn copy "$svnrepo"/trunk "$svnrepo"/branches/a \ + -m "created branch a" && + cd .. && + rm -rf import && + svn co "$svnrepo"/trunk trunk && + cd trunk && + echo bar >> foo && + svn ci -m "updated trunk" && + cd .. && + svn co "$svnrepo"/branches/a a && + cd a && + echo baz >> a && + svn add a && + svn ci -m "updated a" && + cd .. && + git svn init --stdlayout "$svnrepo" + ) +' + +test_expect_success 'import an early SVN revision into git' ' + git svn fetch -r1:2 +' + +test_expect_success 'make full git mirror of SVN' ' + mkdir mirror && + ( + cd mirror && + git init && + git svn init --stdlayout "$svnrepo" && + git svn fetch && + cd .. + ) +' + +test_expect_success 'fetch from git mirror and partial-rebuild' ' + git config --add remote.origin.url "file://$PWD/mirror/.git" && + git config --add remote.origin.fetch refs/remotes/*:refs/remotes/* && + git fetch origin && + git svn fetch +' + +test_done diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh index 3e32e84e6c..245a7c3662 100755 --- a/t/t9200-git-cvsexportcommit.sh +++ b/t/t9200-git-cvsexportcommit.sh @@ -9,7 +9,7 @@ test_description='Test export of commits to CVS' cvs >/dev/null 2>&1 if test $? -ne 1 then - test_expect_success 'skipping git-cvsexportcommit tests, cvs not found' : + test_expect_success 'skipping git cvsexportcommit tests, cvs not found' : test_done exit fi @@ -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" && @@ -91,7 +91,7 @@ test_expect_success \ diff F/newfile6.png ../F/newfile6.png )' -# Should fail (but only on the git-cvsexportcommit stage) +# Should fail (but only on the git cvsexportcommit stage) test_expect_success \ 'Fail to change binary more than one generation old' \ 'cat F/newfile6.png >>D/newfile4.png && @@ -160,24 +160,24 @@ 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) && (cd "$CVSWORK" && - git-cvsexportcommit -c $id && + git cvsexportcommit -c $id && check_entries "G g" "with spaces.png/1.1/-kb|with spaces.txt/1.1/" )' 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) && (cd "$CVSWORK" && - git-cvsexportcommit -c $id + git cvsexportcommit -c $id check_entries "G g" "with spaces.png/1.2/-kb|with spaces.txt/1.2/" )' @@ -197,12 +197,12 @@ 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) && (cd "$CVSWORK" && - git-cvsexportcommit -v -c $id && + git cvsexportcommit -v -c $id && check_entries \ "Å/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/1.1/-kb|gårdetsågårdet.txt/1.1/" @@ -222,7 +222,7 @@ test_expect_success \ git commit -a -m "Update two" && id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && - test_must_fail git-cvsexportcommit -c $id + test_must_fail git cvsexportcommit -c $id )' case "$(git config --bool core.filemode)" in @@ -239,7 +239,7 @@ test_expect_success \ git add G/off && git commit -a -m "Execute test" && (cd "$CVSWORK" && - git-cvsexportcommit -c HEAD + git cvsexportcommit -c HEAD test -x G/on && ! test -x G/off )' diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index c6bc0a607f..328444a306 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -3,9 +3,9 @@ # Copyright (c) 2007 Shawn Pearce # -test_description='test git-fast-import utility' +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' @@ -59,7 +59,7 @@ M 755 :4 file4 INPUT_END test_expect_success \ 'A: create pack from stdin' \ - 'git-fast-import --export-marks=marks.out <input && + 'git fast-import --export-marks=marks.out <input && git whatchanged master' test_expect_success \ 'A: verify pack' \ @@ -113,7 +113,7 @@ test_expect_success \ test_expect_success \ 'A: verify marks import' \ - 'git-fast-import \ + 'git fast-import \ --import-marks=marks.out \ --export-marks=marks.new \ </dev/null && @@ -133,7 +133,7 @@ M 755 :2 copy-of-file2 INPUT_END test_expect_success \ 'A: verify marks import does not crash' \ - 'git-fast-import --import-marks=marks.out <input && + 'git fast-import --import-marks=marks.out <input && git whatchanged verify--import-marks' test_expect_success \ 'A: verify pack' \ @@ -166,7 +166,7 @@ M 755 0000000000000000000000000000000000000001 zero1 INPUT_END test_expect_success 'B: fail on invalid blob sha1' ' - test_must_fail git-fast-import <input + test_must_fail git fast-import <input ' rm -f .git/objects/pack_* .git/objects/index_* @@ -181,7 +181,7 @@ from refs/heads/master INPUT_END test_expect_success 'B: fail on invalid branch name ".badbranchname"' ' - test_must_fail git-fast-import <input + test_must_fail git fast-import <input ' rm -f .git/objects/pack_* .git/objects/index_* @@ -196,7 +196,7 @@ from refs/heads/master INPUT_END test_expect_success 'B: fail on invalid branch name "bad[branch]name"' ' - test_must_fail git-fast-import <input + test_must_fail git fast-import <input ' rm -f .git/objects/pack_* .git/objects/index_* @@ -212,7 +212,7 @@ from refs/heads/master INPUT_END test_expect_success \ 'B: accept branch name "TEMP_TAG"' \ - 'git-fast-import <input && + 'git fast-import <input && test -f .git/TEMP_TAG && test `git rev-parse master` = `git rev-parse TEMP_TAG^`' rm -f .git/TEMP_TAG @@ -221,7 +221,7 @@ rm -f .git/TEMP_TAG ### series C ### -newf=`echo hi newf | git-hash-object -w --stdin` +newf=`echo hi newf | git hash-object -w --stdin` oldf=`git rev-parse --verify master:file2` test_tick cat >input <<INPUT_END @@ -239,7 +239,7 @@ D file3 INPUT_END test_expect_success \ 'C: incremental import create pack from stdin' \ - 'git-fast-import <input && + 'git fast-import <input && git whatchanged branch' test_expect_success \ 'C: verify pack' \ @@ -297,7 +297,7 @@ EOF INPUT_END test_expect_success \ 'D: inline data in commit' \ - 'git-fast-import <input && + 'git fast-import <input && git whatchanged branch' test_expect_success \ 'D: verify pack' \ @@ -340,11 +340,11 @@ from refs/heads/branch^0 INPUT_END test_expect_success 'E: rfc2822 date, --date-format=raw' ' - test_must_fail git-fast-import --date-format=raw <input + test_must_fail git fast-import --date-format=raw <input ' test_expect_success \ 'E: rfc2822 date, --date-format=rfc2822' \ - 'git-fast-import --date-format=rfc2822 <input' + 'git fast-import --date-format=rfc2822 <input' test_expect_success \ 'E: verify pack' \ 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' @@ -381,7 +381,7 @@ from refs/heads/branch INPUT_END test_expect_success \ 'F: non-fast-forward update skips' \ - 'if git-fast-import <input + 'if git fast-import <input then echo BAD gfi did not fail return 1 @@ -431,7 +431,7 @@ from refs/heads/branch~1 INPUT_END test_expect_success \ 'G: non-fast-forward update forced' \ - 'git-fast-import --force <input' + 'git fast-import --force <input' test_expect_success \ 'G: verify pack' \ 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' @@ -467,7 +467,7 @@ EOF INPUT_END test_expect_success \ 'H: deletall, add 1' \ - 'git-fast-import <input && + 'git fast-import <input && git whatchanged H' test_expect_success \ 'H: verify pack' \ @@ -507,7 +507,7 @@ from refs/heads/branch INPUT_END test_expect_success \ 'I: export-pack-edges' \ - 'git-fast-import --export-pack-edges=edges.list <input' + 'git fast-import --export-pack-edges=edges.list <input' cat >expect <<EOF .git/objects/pack/pack-.pack: `git rev-parse --verify export-boundary` @@ -541,7 +541,7 @@ COMMIT INPUT_END test_expect_success \ 'J: reset existing branch creates empty commit' \ - 'git-fast-import <input' + 'git fast-import <input' test_expect_success \ 'J: branch has 1 commit, empty tree' \ 'test 1 = `git rev-list J | wc -l` && @@ -571,7 +571,7 @@ from refs/heads/branch^1 INPUT_END test_expect_success \ 'K: reinit branch with from' \ - 'git-fast-import <input' + 'git fast-import <input' test_expect_success \ 'K: verify K^1 = branch^1' \ 'test `git rev-parse --verify branch^1` \ @@ -623,7 +623,7 @@ EXPECT_END test_expect_success \ 'L: verify internal tree sorting' \ - 'git-fast-import <input && + 'git fast-import <input && git diff-tree --abbrev --raw L^ L >output && test_cmp expect output' @@ -649,7 +649,7 @@ cat >expect <<EOF EOF test_expect_success \ 'M: rename file in same subdirectory' \ - 'git-fast-import <input && + 'git fast-import <input && git diff-tree -M -r M1^ M1 >actual && compare_diff_raw expect actual' @@ -670,7 +670,7 @@ cat >expect <<EOF EOF test_expect_success \ 'M: rename file to new subdirectory' \ - 'git-fast-import <input && + 'git fast-import <input && git diff-tree -M -r M2^ M2 >actual && compare_diff_raw expect actual' @@ -691,7 +691,7 @@ cat >expect <<EOF EOF test_expect_success \ 'M: rename subdirectory to new subdirectory' \ - 'git-fast-import <input && + 'git fast-import <input && git diff-tree -M -r M3^ M3 >actual && compare_diff_raw expect actual' @@ -717,7 +717,7 @@ cat >expect <<EOF EOF test_expect_success \ 'N: copy file in same subdirectory' \ - 'git-fast-import <input && + 'git fast-import <input && git diff-tree -C --find-copies-harder -r N1^ N1 >actual && compare_diff_raw expect actual' @@ -751,7 +751,7 @@ cat >expect <<EOF EOF test_expect_success \ 'N: copy then modify subdirectory' \ - 'git-fast-import <input && + 'git fast-import <input && git diff-tree -C --find-copies-harder -r N2^^ N2 >actual && compare_diff_raw expect actual' @@ -775,8 +775,8 @@ INPUT_END test_expect_success \ 'N: copy dirty subdirectory' \ - 'git-fast-import <input && - test `git-rev-parse N2^{tree}` = `git-rev-parse N3^{tree}`' + 'git fast-import <input && + test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`' ### ### series O @@ -815,8 +815,8 @@ INPUT_END test_expect_success \ 'O: comments are all skipped' \ - 'git-fast-import <input && - test `git-rev-parse N3` = `git-rev-parse O1`' + 'git fast-import <input && + test `git rev-parse N3` = `git rev-parse O1`' cat >input <<INPUT_END commit refs/heads/O2 @@ -836,8 +836,8 @@ INPUT_END test_expect_success \ 'O: blank lines not necessary after data commands' \ - 'git-fast-import <input && - test `git-rev-parse N3` = `git-rev-parse O2`' + 'git fast-import <input && + test `git rev-parse N3` = `git rev-parse O2`' test_expect_success \ 'O: repack before next test' \ @@ -881,7 +881,7 @@ commits INPUT_END test_expect_success \ 'O: blank lines not necessary after other commands' \ - 'git-fast-import <input && + 'git fast-import <input && test 8 = `find .git/objects/pack -type f | wc -l` && test `git rev-parse refs/tags/O3-2nd` = `git rev-parse O3^` && git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual && @@ -914,7 +914,7 @@ progress I'm done! INPUT_END test_expect_success \ 'O: progress outputs as requested by input' \ - 'git-fast-import <input >actual && + 'git fast-import <input >actual && grep "progress " <input >expect && test_cmp expect actual' @@ -979,7 +979,7 @@ INPUT_END test_expect_success \ 'P: supermodule & submodule mix' \ - 'git-fast-import <input && + 'git fast-import <input && git checkout subuse1 && rm -rf sub && mkdir sub && cd sub && git init && @@ -989,8 +989,8 @@ test_expect_success \ git submodule init && git submodule update' -SUBLAST=$(git-rev-parse --verify sub) -SUBPREV=$(git-rev-parse --verify sub^) +SUBLAST=$(git rev-parse --verify sub) +SUBPREV=$(git rev-parse --verify sub^) cat >input <<INPUT_END blob @@ -1024,8 +1024,8 @@ test_expect_success \ 'P: verbatim SHA gitlinks' \ 'git branch -D sub && git gc && git prune && - git-fast-import <input && - test $(git-rev-parse --verify subuse2) = $(git-rev-parse --verify subuse1)' + git fast-import <input && + test $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)' test_tick cat >input <<INPUT_END @@ -1045,7 +1045,7 @@ DATA INPUT_END test_expect_success 'P: fail on inline gitlink' ' - test_must_fail git-fast-import <input' + test_must_fail git fast-import <input' test_tick cat >input <<INPUT_END @@ -1068,6 +1068,6 @@ M 160000 :1 sub INPUT_END test_expect_success 'P: fail on blob mark in gitlink' ' - test_must_fail git-fast-import <input' + test_must_fail git fast-import <input' test_done diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh index c19b4a2bab..6ddd7c19fd 100755 --- a/t/t9301-fast-export.sh +++ b/t/t9301-fast-export.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Johannes E. Schindelin # -test_description='git-fast-export' +test_description='git fast-export' . ./test-lib.sh test_expect_success 'setup' ' @@ -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 4b91f8d4c4..c1850d2923 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 ae7082be1d..46ba19be7d 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/t9600-cvsimport.sh b/t/t9600-cvsimport.sh index 0d7786a8c7..d2379e7f62 100755 --- a/t/t9600-cvsimport.sh +++ b/t/t9600-cvsimport.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-cvsimport basic tests' +test_description='git cvsimport basic tests' . ./test-lib.sh CVSROOT=$(pwd)/cvsroot diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh index 9706ee5773..b81d5dfc34 100755 --- a/t/t9700-perl-git.sh +++ b/t/t9700-perl-git.sh @@ -27,18 +27,18 @@ test_expect_success \ echo "changed file 1" > file1 && git commit -a -m "second commit" && - git-config --add color.test.slot1 green && - git-config --add test.string value && - git-config --add test.dupstring value1 && - git-config --add test.dupstring value2 && - git-config --add test.booltrue true && - git-config --add test.boolfalse no && - git-config --add test.boolother other && - git-config --add test.int 2k + git config --add color.test.slot1 green && + git config --add test.string value && + git config --add test.dupstring value1 && + git config --add test.dupstring value2 && + git config --add test.booltrue true && + git config --add test.boolfalse no && + git config --add test.boolother other && + git config --add test.int 2k ' 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 4d2312548a..697daf3ffd 100755 --- a/t/t9700/test.pl +++ b/t/t9700/test.pl @@ -9,15 +9,11 @@ use Test::More qw(no_plan); use Cwd; use File::Basename; -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 @@ -38,7 +34,7 @@ is($r->get_color("color.test.slot1", "red"), $ansi_green, "get_color"); # Failure cases for config: # Save and restore STDERR; we will probably extract this into a # "dies_ok" method and possibly move the STDERR handling to Git.pm. -open our $tmpstderr, ">&", STDERR or die "cannot save STDERR"; close STDERR; +open our $tmpstderr, ">&STDERR" or die "cannot save STDERR"; close STDERR; eval { $r->config("test.dupstring") }; ok($@, "config: duplicate entry in scalar context fails"); eval { $r->config_bool("test.boolother") }; @@ -69,21 +65,25 @@ is($r->ident_person("Name", "email", "123 +0000"), "Name <email>", # objects and hashes ok(our $file1hash = $r->command_oneline('rev-parse', "HEAD:file1"), "(get file hash)"); -our $tmpfile = File::Temp->new; -is($r->cat_blob($file1hash, $tmpfile), 15, "cat_blob: size"); +my $tmpfile = "file.tmp"; +open TEMPFILE, "+>$tmpfile" or die "Can't open $tmpfile: $!"; +is($r->cat_blob($file1hash, \*TEMPFILE), 15, "cat_blob: size"); our $blobcontents; -{ local $/; seek $tmpfile, 0, 0; $blobcontents = <$tmpfile>; } +{ local $/; seek TEMPFILE, 0, 0; $blobcontents = <TEMPFILE>; } is($blobcontents, "changed file 1\n", "cat_blob: data"); -seek $tmpfile, 0, 0; +close TEMPFILE or die "Failed writing to $tmpfile: $!"; is(Git::hash_object("blob", $tmpfile), $file1hash, "hash_object: roundtrip"); -$tmpfile = File::Temp->new(); -print $tmpfile my $test_text = "test blob, to be inserted\n"; +open TEMPFILE, ">$tmpfile" or die "Can't open $tmpfile: $!"; +print TEMPFILE my $test_text = "test blob, to be inserted\n"; +close TEMPFILE or die "Failed writing to $tmpfile: $!"; like(our $newhash = $r->hash_and_insert_object($tmpfile), qr/[0-9a-fA-F]{40}/, "hash_and_insert_object: returns hash"); -$tmpfile = File::Temp->new; -is($r->cat_blob($newhash, $tmpfile), length $test_text, "cat_blob: roundtrip size"); -{ local $/; seek $tmpfile, 0, 0; $blobcontents = <$tmpfile>; } +open TEMPFILE, "+>$tmpfile" or die "Can't open $tmpfile: $!"; +is($r->cat_blob($newhash, \*TEMPFILE), length $test_text, "cat_blob: roundtrip size"); +{ local $/; seek TEMPFILE, 0, 0; $blobcontents = <TEMPFILE>; } is($blobcontents, $test_text, "cat_blob: roundtrip data"); +close TEMPFILE; +unlink $tmpfile; # paths is($r->repo_path, "./.git", "repo_path"); diff --git a/t/test-lib.sh b/t/test-lib.sh index 11c027571b..e2b106cb6a 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" |