Skip to content

Commit

Permalink
Merge branch 'jl/maint-fix-test'
Browse files Browse the repository at this point in the history
* jl/maint-fix-test:
  Several tests: cd inside subshell instead of around

Conflicts:
	t/t9600-cvsimport.sh
  • Loading branch information
Junio C Hamano committed Sep 6, 2010
2 parents c2e0940 + fd4ec4f commit 347c47e
Show file tree
Hide file tree
Showing 32 changed files with 256 additions and 260 deletions.
6 changes: 3 additions & 3 deletions t/t1020-subdirectory.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ test_expect_success 'update-index and ls-files' '
one) echo pass one ;;
*) echo bad one; exit 1 ;;
esac &&
cd dir &&
(cd dir &&
git update-index --add two &&
case "`git ls-files`" in
two) echo pass two ;;
*) echo bad two; exit 1 ;;
esac &&
cd .. &&
esac
) &&
case "`git ls-files`" in
dir/two"$LF"one) echo pass both ;;
*) echo bad; exit 1 ;;
Expand Down
6 changes: 3 additions & 3 deletions t/t1302-repo-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ test_expect_success 'gitdir selection on unsupported repo' '
test "$(git config core.repositoryformatversion)" = 99)'

test_expect_success 'gitdir not required mode' '
(git apply --stat test.patch &&
cd test && git apply --stat ../test.patch &&
cd ../test2 && git apply --stat ../test.patch)'
git apply --stat test.patch &&
(cd test && git apply --stat ../test.patch) &&
(cd test2 && git apply --stat ../test.patch)'

test_expect_success 'gitdir required mode on normal repos' '
(git apply --check --index test.patch &&
Expand Down
6 changes: 3 additions & 3 deletions t/t2101-update-index-reupdate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ cat > expected <<\EOF
EOF
test_expect_success 'update-index --update from subdir' \
'echo not so happy >file2 &&
cd dir1 &&
(cd dir1 &&
cat ../file2 >file3 &&
git update-index --again &&
cd .. &&
git update-index --again
) &&
git ls-files -s >current &&
cmp current expected'

Expand Down
4 changes: 1 addition & 3 deletions t/t3060-ls-files-with-tree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,13 @@ test_expect_success setup '

# We have to run from a sub-directory to trigger prune_path
# Then we finally get to run our --with-tree test
cd sub

test_expect_success 'git -ls-files --with-tree should succeed from subdir' '
git ls-files --with-tree=HEAD~1 >../output
(cd sub && git ls-files --with-tree=HEAD~1 >../output)
'

cd ..
test_expect_success \
'git -ls-files --with-tree should add entries from named tree.' \
'test_cmp expected output'
Expand Down
12 changes: 6 additions & 6 deletions t/t3409-rebase-preserve-merges.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ test_expect_success 'setup for merge-preserving rebase' \
git commit -a -m "Modify A2" &&
git clone ./. clone1 &&
cd clone1 &&
(cd clone1 &&
git checkout -b topic origin/topic &&
git merge origin/master &&
cd .. &&
git merge origin/master
) &&
echo Fifth > B &&
git add B &&
git commit -m "Add different B" &&
git clone ./. clone2 &&
cd clone2 &&
(cd clone2 &&
git checkout -b topic origin/topic &&
test_must_fail git merge origin/master &&
echo Resolved > B &&
git add B &&
git commit -m "Merge origin/master into topic" &&
cd .. &&
git commit -m "Merge origin/master into topic"
) &&
git checkout topic &&
echo Fourth >> B &&
Expand Down
6 changes: 3 additions & 3 deletions t/t3903-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ test_expect_success 'apply stashed changes (including index)' '
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' '
Expand Down
6 changes: 3 additions & 3 deletions t/t4041-diff-submodule-option.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ EOF
"

commit_file sm1 &&
cd sm1 &&
head3=$(cd sm1 &&
git reset --hard HEAD~2 >/dev/null &&
head3=$(git rev-parse --verify HEAD | cut -c1-7) &&
cd ..
git rev-parse --verify HEAD | cut -c1-7
)

test_expect_success 'modified submodule(backward)' "
git diff-index -p --submodule=log HEAD >actual &&
Expand Down
18 changes: 9 additions & 9 deletions t/t5510-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ test_expect_success setup '

test_expect_success "clone and setup child repos" '
git clone . one &&
cd one &&
(cd one &&
echo >file updated by one &&
git commit -a -m "updated by one" &&
cd .. &&
git commit -a -m "updated by one"
) &&
git clone . two &&
cd two &&
(cd two &&
git config branch.master.remote one &&
git config remote.one.url ../one/.git/ &&
git config remote.one.fetch refs/heads/master:refs/heads/one &&
cd .. &&
git config remote.one.fetch refs/heads/master:refs/heads/one
) &&
git clone . three &&
cd three &&
(cd three &&
git config branch.master.remote two &&
git config branch.master.merge refs/heads/one &&
mkdir -p .git/remotes &&
{
echo "URL: ../two/.git/"
echo "Pull: refs/heads/master:refs/heads/two"
echo "Pull: refs/heads/one:refs/heads/one"
} >.git/remotes/two &&
cd .. &&
} >.git/remotes/two
) &&
git clone . bundle &&
git clone . seven
'
Expand Down
22 changes: 11 additions & 11 deletions t/t6050-replace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand All @@ -113,8 +113,8 @@ test_expect_success 'repack, clone and fetch work' '
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' '
Expand Down Expand Up @@ -177,10 +177,10 @@ test_expect_success 'create parallel branch without the bug' '

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' '
Expand All @@ -191,20 +191,20 @@ 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' '
Expand Down
6 changes: 3 additions & 3 deletions t/t7400-submodule-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,12 @@ test_expect_success 'submodule <invalid-path> warns' '

test_expect_success 'add submodules without specifying an explicit path' '
mkdir repo &&
cd repo &&
(cd repo &&
git init &&
echo r >r &&
git add r &&
git commit -m "repo commit 1" &&
cd .. &&
git commit -m "repo commit 1"
) &&
git clone --bare repo/ bare.git &&
cd addtest &&
git submodule add "$submodurl/repo" &&
Expand Down
6 changes: 3 additions & 3 deletions t/t7401-submodule-summary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ EOF
"

commit_file sm1 &&
cd sm1 &&
head3=$(cd sm1 &&
git reset --hard HEAD~2 >/dev/null &&
head3=$(git rev-parse --verify HEAD | cut -c1-7) &&
cd ..
git rev-parse --verify HEAD | cut -c1-7
)

test_expect_success 'modified submodule(backward)' "
git submodule summary >actual &&
Expand Down
6 changes: 3 additions & 3 deletions t/t9100-git-svn-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ esac
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 &&
Expand All @@ -31,8 +31,8 @@ test_expect_success \
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"'

Expand Down
16 changes: 8 additions & 8 deletions t/t9101-git-svn-props.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ cd ..
rm -rf import
test_expect_success 'checkout working copy from svn' 'svn co "$svnrepo" test_wc'
test_expect_success 'setup some commits to svn' \
'cd test_wc &&
'(cd test_wc &&
echo Greetings >> kw.c &&
poke kw.c &&
svn_cmd commit -m "Not yet an Id" &&
Expand All @@ -63,8 +63,8 @@ test_expect_success 'setup some commits to svn' \
svn_cmd commit -m "Modified file, but still not yet an Id" &&
svn_cmd propset svn:keywords Id kw.c &&
poke kw.c &&
svn_cmd commit -m "Propset Id" &&
cd ..'
svn_cmd commit -m "Propset Id"
)'

test_expect_success 'initialize git svn' 'git svn init "$svnrepo"'
test_expect_success 'fetch revisions from svn' 'git svn fetch'
Expand All @@ -82,12 +82,12 @@ got="`sed -ne 2p kw.c`"
test_expect_success 'raw $Id$ found in kw.c' "test '$expect' = '$got'"

test_expect_success "propset CR on crlf files" \
'cd test_wc &&
'(cd test_wc &&
svn_cmd propset svn:eol-style CR empty &&
svn_cmd propset svn:eol-style CR crlf &&
svn_cmd propset svn:eol-style CR ne_crlf &&
svn_cmd commit -m "propset CR on crlf files" &&
cd ..'
svn_cmd commit -m "propset CR on crlf files"
)'

test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
'git svn fetch &&
Expand Down Expand Up @@ -137,7 +137,7 @@ cat > show-ignore.expect <<\EOF
EOF

test_expect_success 'test show-ignore' "
cd test_wc &&
(cd test_wc &&
mkdir -p deeply/nested/directory &&
touch deeply/nested/directory/.keep &&
svn_cmd add deeply &&
Expand All @@ -146,7 +146,7 @@ test_expect_success 'test show-ignore' "
no-such-file*
' .
svn_cmd commit -m 'propset svn:ignore'
cd .. &&
) &&
git svn show-ignore > show-ignore.got &&
cmp show-ignore.expect show-ignore.got
"
Expand Down
6 changes: 3 additions & 3 deletions t/t9102-git-svn-deep-rmdir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ test_description='git svn rmdir'

test_expect_success 'initialize repo' '
mkdir import &&
cd import &&
(cd import &&
mkdir -p deeply/nested/directory/number/1 &&
mkdir -p deeply/nested/directory/number/2 &&
echo foo > deeply/nested/directory/number/1/file &&
echo foo > deeply/nested/directory/number/2/another &&
svn_cmd import -m "import for git svn" . "$svnrepo" &&
cd ..
svn_cmd import -m "import for git svn" . "$svnrepo"
)
'

test_expect_success 'mirror via git svn' '
Expand Down
Loading

0 comments on commit 347c47e

Please sign in to comment.