From: Junio C Hamano Date: Mon, 6 Sep 2010 23:46:36 +0000 (-0700) Subject: Merge branch 'jl/maint-fix-test' X-Git-Tag: v1.7.3-rc2~3^2~6 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/347c47e61e5daf1efb3503724a431e4316c6eb5b?ds=inline;hp=-c Merge branch 'jl/maint-fix-test' * jl/maint-fix-test: Several tests: cd inside subshell instead of around Conflicts: t/t9600-cvsimport.sh --- 347c47e61e5daf1efb3503724a431e4316c6eb5b diff --combined t/t3903-stash.sh index d99f27a12f,3f430122c2..056bc2b248 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@@ -69,9 -69,9 +69,9 @@@ test_expect_success 'apply stashed chan test_expect_success 'unstashing in a subdirectory' ' git reset --hard HEAD && mkdir subdir && - cd subdir && - git stash apply && - cd .. + (cd subdir && + git stash apply + ) ' test_expect_success 'drop top stash' ' @@@ -378,116 -378,4 +378,116 @@@ test_expect_failure 'stash file to dire test foo = "$(cat file/file)" ' +test_expect_success 'stash branch - no stashes on stack, stash-like argument' ' + git stash clear && + test_when_finished "git reset --hard HEAD" && + git reset --hard && + echo foo >> file && + STASH_ID=$(git stash create) && + git reset --hard && + git stash branch stash-branch ${STASH_ID} && + test_when_finished "git reset --hard HEAD && git checkout master && git branch -D stash-branch" && + test $(git ls-files --modified | wc -l) -eq 1 +' + +test_expect_success 'stash branch - stashes on stack, stash-like argument' ' + git stash clear && + test_when_finished "git reset --hard HEAD" && + git reset --hard && + echo foo >> file && + git stash && + test_when_finished "git stash drop" && + echo bar >> file && + STASH_ID=$(git stash create) && + git reset --hard && + git stash branch stash-branch ${STASH_ID} && + test_when_finished "git reset --hard HEAD && git checkout master && git branch -D stash-branch" && + test $(git ls-files --modified | wc -l) -eq 1 +' + +test_expect_success 'stash show - stashes on stack, stash-like argument' ' + git stash clear && + test_when_finished "git reset --hard HEAD" && + git reset --hard && + echo foo >> file && + git stash && + test_when_finished "git stash drop" && + echo bar >> file && + STASH_ID=$(git stash create) && + git reset --hard && + git stash show ${STASH_ID} +' +test_expect_success 'stash show - no stashes on stack, stash-like argument' ' + git stash clear && + test_when_finished "git reset --hard HEAD" && + git reset --hard && + echo foo >> file && + STASH_ID=$(git stash create) && + git reset --hard && + git stash show ${STASH_ID} +' + +test_expect_success 'stash drop - fail early if specified stash is not a stash reference' ' + git stash clear && + test_when_finished "git reset --hard HEAD && git stash clear" && + git reset --hard && + echo foo > file && + git stash && + echo bar > file && + git stash && + test_must_fail git stash drop $(git rev-parse stash@{0}) && + git stash pop && + test bar = "$(cat file)" && + git reset --hard HEAD +' + +test_expect_success 'stash pop - fail early if specified stash is not a stash reference' ' + git stash clear && + test_when_finished "git reset --hard HEAD && git stash clear" && + git reset --hard && + echo foo > file && + git stash && + echo bar > file && + git stash && + test_must_fail git stash pop $(git rev-parse stash@{0}) && + git stash pop && + test bar = "$(cat file)" && + git reset --hard HEAD +' + +test_expect_success 'ref with non-existant reflog' ' + git stash clear && + echo bar5 > file && + echo bar6 > file2 && + git add file2 && + git stash && + ! "git rev-parse --quiet --verify does-not-exist" && + test_must_fail git stash drop does-not-exist && + test_must_fail git stash drop does-not-exist@{0} && + test_must_fail git stash pop does-not-exist && + test_must_fail git stash pop does-not-exist@{0} && + test_must_fail git stash apply does-not-exist && + test_must_fail git stash apply does-not-exist@{0} && + test_must_fail git stash show does-not-exist && + test_must_fail git stash show does-not-exist@{0} && + test_must_fail git stash branch tmp does-not-exist && + test_must_fail git stash branch tmp does-not-exist@{0} && + git stash drop +' + +test_expect_success 'invalid ref of the form stash@{n}, n >= N' ' + git stash clear && + test_must_fail git stash drop stash@{0} && + echo bar5 > file && + echo bar6 > file2 && + git add file2 && + git stash && + test_must_fail git drop stash@{1} && + test_must_fail git pop stash@{1} && + test_must_fail git apply stash@{1} && + test_must_fail git show stash@{1} && + test_must_fail git branch tmp stash@{1} && + git stash drop +' + test_done diff --combined t/t6050-replace.sh index dd917d76da,01dfa51f09..1911802355 --- a/t/t6050-replace.sh +++ b/t/t6050-replace.sh @@@ -104,7 -104,7 +104,7 @@@ test_expect_success '"git fsck" works' test_expect_success 'repack, clone and fetch work' ' git repack -a -d && git clone --no-hardlinks . clone_dir && - cd clone_dir && + (cd clone_dir && git show HEAD~5 | grep "A U Thor" && git show $HASH2 | grep "A U Thor" && git cat-file commit $R && @@@ -113,8 -113,8 +113,8 @@@ git fetch ../ "refs/replace/*:refs/replace/*" && git show HEAD~5 | grep "O Thor" && git show $HASH2 | grep "O Thor" && - git cat-file commit $R && - cd .. + git cat-file commit $R + ) ' test_expect_success '"git replace" listing and deleting' ' @@@ -177,10 -177,10 +177,10 @@@ test_expect_success 'create parallel br test_expect_success 'push to cloned repo' ' git push cloned $HASH6^:refs/heads/parallel && - cd clone_dir && + (cd clone_dir && git checkout parallel && - git log --pretty=oneline | grep $PARA2 && - cd .. + git log --pretty=oneline | grep $PARA2 + ) ' test_expect_success 'push branch with replacement' ' @@@ -191,25 -191,25 +191,25 @@@ git show $HASH6~2 | grep "O Thor" && git show $PARA3 | grep "O Thor" && git push cloned $HASH6^:refs/heads/parallel2 && - cd clone_dir && + (cd clone_dir && git checkout parallel2 && git log --pretty=oneline | grep $PARA3 && - git show $PARA3 | grep "A U Thor" && - cd .. + git show $PARA3 | grep "A U Thor" + ) ' test_expect_success 'fetch branch with replacement' ' git branch tofetch $HASH6 && - cd clone_dir && + (cd clone_dir && git fetch origin refs/heads/tofetch:refs/heads/parallel3 git log --pretty=oneline parallel3 | grep $PARA3 git show $PARA3 | grep "A U Thor" - cd .. + ) ' test_expect_success 'bisect and replacements' ' git bisect start $HASH7 $HASH1 && - test "$S" = "$(git rev-parse --verify HEAD)" && + test "$PARA3" = "$(git rev-parse --verify HEAD)" && git bisect reset && GIT_NO_REPLACE_OBJECTS=1 git bisect start $HASH7 $HASH1 && test "$HASH4" = "$(git rev-parse --verify HEAD)" && diff --combined t/t9100-git-svn-basic.sh index d5adae640b,75388f3f07..34eb01797b --- a/t/t9100-git-svn-basic.sh +++ b/t/t9100-git-svn-basic.sh @@@ -22,7 -22,7 +22,7 @@@ esa test_expect_success \ 'initialize git svn' ' mkdir import && - cd import && + (cd import && echo foo > foo && ln -s foo foo.link mkdir -p dir/a/b/c/d/e && @@@ -31,8 -31,8 +31,8 @@@ echo "zzz" > bar/zzz && echo "#!/bin/sh" > exec.sh && chmod +x exec.sh && - svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null && - cd .. && + svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null + ) && rm -rf import && git svn init "$svnrepo"' @@@ -271,17 -271,6 +271,17 @@@ test_expect_success 'able to dcommit t test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" " +test_expect_success 'dcommit should not fail with a touched file' ' + test_commit "commit-new-file-foo2" foo2 && + test-chmtime =-60 foo && + git svn dcommit +' + +test_expect_success 'rebase should not fail with a touched file' ' + test-chmtime =-60 foo && + git svn rebase +' + test_expect_success 'able to set-tree to a subdirectory' " echo cba > d && git update-index d && diff --combined t/t9300-fast-import.sh index 96d07f1833,1a205a4d5a..7c059204e9 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@@ -853,60 -853,6 +853,60 @@@ test_expect_success 'git fast-import expect <<-\EOF && + :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf + :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf + EOF + subdir=$(git rev-parse refs/heads/branch^0:file2) && + cat >input <<-INPUT_END && + commit refs/heads/N4 + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <actual && + compare_diff_raw expect actual' + +test_expect_success \ + 'N: modify copied tree' \ + 'cat >expect <<-\EOF && + :100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100 newdir/interesting file3/file5 + :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf + :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf + EOF + subdir=$(git rev-parse refs/heads/branch^0:file2) && + cat >input <<-INPUT_END && + commit refs/heads/N5 + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data < $GIT_COMMITTER_DATE + data <actual && + compare_diff_raw expect actual' + ### ### series O ### @@@ -1110,11 -1056,10 +1110,10 @@@ test_expect_success 'P: supermodule & submodule mix' \ 'git fast-import o_fortuna && O Fortuna velut luna @@@ -38,29 -41,28 +38,28 @@@ add "O Fortuna" lyric These public domain lyrics make an excellent sample text. EOF - $CVS commit -F message && - cd .. + $CVS commit -F message + ) ' -test_expect_success 'import a trivial module' ' +test_expect_success PERL 'import a trivial module' ' git cvsimport -a -R -z 0 -C module-git module && test_cmp module-cvs/o_fortuna module-git/o_fortuna ' - test_expect_success PERL 'pack refs' 'cd module-git && git gc && cd ..' -test_expect_success 'pack refs' '(cd module-git && git gc)' ++test_expect_success PERL 'pack refs' '(cd module-git && git gc)' -test_expect_success 'initial import has correct .git/cvs-revisions' ' +test_expect_success PERL 'initial import has correct .git/cvs-revisions' ' (cd module-git && git log --format="o_fortuna 1.1 %H" -1) > expected && test_cmp expected module-git/.git/cvs-revisions ' -test_expect_success 'update cvs module' ' +test_expect_success PERL 'update cvs module' ' - - cd module-cvs && + (cd module-cvs && cat <o_fortuna && O Fortune, like the moon @@@ -83,21 -85,21 +82,21 @@@ translate to Englis My Latin is terrible. EOF - $CVS commit -F message && - cd .. + $CVS commit -F message + ) ' -test_expect_success 'update git module' ' +test_expect_success PERL 'update git module' ' - cd module-git && + (cd module-git && git cvsimport -a -R -z 0 module && - git merge origin && - cd .. && + git merge origin + ) && test_cmp module-cvs/o_fortuna module-git/o_fortuna ' -test_expect_success 'update has correct .git/cvs-revisions' ' +test_expect_success PERL 'update has correct .git/cvs-revisions' ' (cd module-git && git log --format="o_fortuna 1.1 %H" -1 HEAD^ && @@@ -105,28 -107,27 +104,27 @@@ test_cmp expected module-git/.git/cvs-revisions ' -test_expect_success 'update cvs module' ' +test_expect_success PERL 'update cvs module' ' - cd module-cvs && + (cd module-cvs && echo 1 >tick && $CVS add tick && $CVS commit -m 1 - cd .. - + ) ' -test_expect_success 'cvsimport.module config works' ' +test_expect_success PERL 'cvsimport.module config works' ' - cd module-git && + (cd module-git && git config cvsimport.module module && git cvsimport -a -R -z0 && - git merge origin && - cd .. && + git merge origin + ) && test_cmp module-cvs/tick module-git/tick ' -test_expect_success 'second update has correct .git/cvs-revisions' ' +test_expect_success PERL 'second update has correct .git/cvs-revisions' ' (cd module-git && git log --format="o_fortuna 1.1 %H" -1 HEAD^^ && @@@ -135,24 -136,24 +133,24 @@@ test_cmp expected module-git/.git/cvs-revisions ' -test_expect_success 'import from a CVS working tree' ' +test_expect_success PERL 'import from a CVS working tree' ' $CVS co -d import-from-wt module && - cd import-from-wt && + (cd import-from-wt && git cvsimport -a -z0 && echo 1 >expect && git log -1 --pretty=format:%s%n >actual && - test_cmp actual expect && - cd .. + test_cmp actual expect + ) ' -test_expect_success 'no .git/cvs-revisions created by default' ' +test_expect_success PERL 'no .git/cvs-revisions created by default' ' ! test -e import-from-wt/.git/cvs-revisions ' -test_expect_success 'test entire HEAD' 'test_cmp_branch_tree master' +test_expect_success PERL 'test entire HEAD' 'test_cmp_branch_tree master' test_done diff --combined t/t9603-cvsimport-patchsets.sh index 93c4fa885e,2620780fd6..52034c8f77 --- a/t/t9603-cvsimport-patchsets.sh +++ b/t/t9603-cvsimport-patchsets.sh @@@ -14,17 -14,18 +14,17 @@@ test_description='git cvsimport testing for correct patchset estimation' . ./lib-cvs.sh -CVSROOT="$TEST_DIRECTORY"/t9603/cvsroot -export CVSROOT +setup_cvs_test_repository t9603 test_expect_failure 'import with criss cross times on revisions' ' git cvsimport -p"-x" -C module-git module && - cd module-git && + (cd module-git && git log --pretty=format:%s > ../actual-master && git log A~2..A --pretty="format:%s %ad" -- > ../actual-A && echo "" >> ../actual-master && - echo "" >> ../actual-A && - cd .. && + echo "" >> ../actual-A + ) && echo "Rev 4 Rev 3 Rev 2