]> asedeno.scripts.mit.edu Git - git.git/commitdiff
Merge branch 'jl/maint-fix-test'
authorJunio C Hamano <gitster@pobox.com>
Mon, 6 Sep 2010 23:46:36 +0000 (16:46 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Sep 2010 23:46:36 +0000 (16:46 -0700)
* jl/maint-fix-test:
  Several tests: cd inside subshell instead of around

Conflicts:
t/t9600-cvsimport.sh

1  2 
t/t3903-stash.sh
t/t6050-replace.sh
t/t9100-git-svn-basic.sh
t/t9300-fast-import.sh
t/t9600-cvsimport.sh
t/t9603-cvsimport-patchsets.sh

diff --combined t/t3903-stash.sh
index d99f27a12f40d73094ef286a067f3c6771e61865,3f430122c200dd7ef64aa9293eeb857147801bf4..056bc2b2486ff4621aa0182f97ec149101877761
@@@ -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 dd917d76da4f30ee8079caa17766c71513670d2e,01dfa51f09ab17cf9be182c20cb67e1d2fcbed30..1911802355e654c132ce8febb42270040c96a20b
@@@ -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 &&
       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' '
       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 d5adae640b0b92e049de3c5d5e8996e1db06bcc4,75388f3f07de4ddb0fd4d72794a8cbf97f925ab7..34eb01797b3a289ded1dc92799616615f0c14784
@@@ -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 96d07f183377f8822257cb3a1dad29023b391462,1a205a4d5ab5027f50568234ad0cd56fd60f4af1..7c059204e90722db20bae1d10a0988853f852262
@@@ -853,60 -853,6 +853,60 @@@ test_expect_success 
        'git fast-import <input &&
         test `git rev-parse N2^{tree}` = `git rev-parse N3^{tree}`'
  
 +test_expect_success \
 +      'N: copy directory by id' \
 +      'cat >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 <<COMMIT
 +      copy by tree hash
 +      COMMIT
 +
 +      from refs/heads/branch^0
 +      M 040000 $subdir file3
 +      INPUT_END
 +       git fast-import <input &&
 +       git diff-tree -C --find-copies-harder -r N4^ N4 >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 <<COMMIT
 +      copy by tree hash
 +      COMMIT
 +
 +      from refs/heads/branch^0
 +      M 040000 $subdir file3
 +
 +      commit refs/heads/N5
 +      committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 +      data <<COMMIT
 +      modify directory copy
 +      COMMIT
 +
 +      M 644 inline file3/file5
 +      data <<EOF
 +      $file5_data
 +      EOF
 +      INPUT_END
 +       git fast-import <input &&
 +       git diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&
 +       compare_diff_raw expect actual'
 +
  ###
  ### series O
  ###
@@@ -1110,11 -1056,10 +1110,10 @@@ test_expect_success 
        'P: supermodule & submodule mix' \
        'git fast-import <input &&
         git checkout subuse1 &&
-        rm -rf sub && mkdir sub && cd sub &&
+        rm -rf sub && mkdir sub && (cd sub &&
         git init &&
         git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
-        git checkout master &&
-        cd .. &&
+        git checkout master) &&
         git submodule init &&
         git submodule update'
  
diff --combined t/t9600-cvsimport.sh
index 559ce417954e1ef8276efc860ca63eb0bdcce284,6ef1c340829bbf923902c6fcc61da698832874a2..432b82e3d5a361d0eba329f5d5c56c17009738db
@@@ -3,18 -3,21 +3,18 @@@
  test_description='git cvsimport basic tests'
  . ./lib-cvs.sh
  
 -if ! test_have_prereq PERL; then
 -      skip_all='skipping git cvsimport tests, perl not available'
 -      test_done
 -fi
 -
 -CVSROOT=$(pwd)/cvsroot
 -export CVSROOT
 +test_expect_success PERL 'setup cvsroot environment' '
 +      CVSROOT=$(pwd)/cvsroot &&
 +      export CVSROOT
 +'
  
 -test_expect_success 'setup cvsroot' '$CVS init'
 +test_expect_success PERL 'setup cvsroot' '$CVS init'
  
 -test_expect_success 'setup a cvs module' '
 +test_expect_success PERL 'setup a cvs module' '
  
        mkdir "$CVSROOT/module" &&
        $CVS co -d module-cvs module &&
-       cd module-cvs &&
+       (cd module-cvs &&
        cat <<EOF >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 <<EOF >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^ &&
        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^^ &&
        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
index 93c4fa885eeff16c57a58d8dc4fa7537cde54ea9,2620780fd66f62b8a221684cdd5d3747cd184881..52034c8f77abd2eb0079866331c49a2f5f34e20d
  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