summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: af24059)
raw | patch | inline | side by side (parent: af24059)
author | Jens Lehmann <Jens.Lehmann@web.de> | |
Mon, 6 Sep 2010 18:39:54 +0000 (20:39 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 6 Sep 2010 21:30:53 +0000 (14:30 -0700) |
Fixed all places where it was a straightforward change from cd'ing into a
directory and back via "cd .." to a cd inside a subshell.
Found these places with "git grep -w "cd \.\.".
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
directory and back via "cd .." to a cd inside a subshell.
Found these places with "git grep -w "cd \.\.".
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
32 files changed:
index 56874996a6df278202c0bc476abec4bca3ce99c5..c36157a8960c177fe316a7e0d13df179a5837b34 100755 (executable)
--- a/t/t1020-subdirectory.sh
+++ b/t/t1020-subdirectory.sh
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 ;;
index 8d305b43725f8cf60e7ee802df1923feb98eeae5..c94871993182df3aae4cbfbc57555b17877bd49b 100755 (executable)
--- a/t/t1302-repo-version.sh
+++ b/t/t1302-repo-version.sh
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 &&
index 648184fd983512be57b46fb5903b42e4de5e4704..76ad7c344c0546603fb198a9ffb907d6142cbe84 100755 (executable)
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'
index 3ce501bb9794900b99fbbf2f2ccfbb330f7947a7..25afb4faebc63a21a30024017820f91c6499776d 100755 (executable)
# 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'
index 8f785e7957519eaa3dd1ef946c905054c4fa0e6c..1a362d231a21a03673cc41281db12673363894e1 100755 (executable)
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 &&
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 62e208aadd592ddaa5c519cf328e636d948221c0..3f430122c200dd7ef64aa9293eeb857147801bf4 100755 (executable)
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
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' '
index 8e391cf9a72c6518217526155cbea93d74b9e626..737c3d93ff7bf332120e31ad610396588e4a42df 100755 (executable)
"
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 &&
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 4eb10f602fdcba354c6d140ed6b910ee89641708..34d59d5766841ac03eabfd9bcd152bda7618c207 100755 (executable)
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
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
'
diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh
index 4185b7ca1d3679b458d16753581fe78e3b68b376..01dfa51f09ab17cf9be182c20cb67e1d2fcbed30 100755 (executable)
--- a/t/t6050-replace.sh
+++ b/t/t6050-replace.sh
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' '
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' '
index 9bda97058499ecab88dc6de7551d7909e1ad5a2e..21b08395ce6da07842d4e993d2be50642748fae1 100755 (executable)
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" &&
index cee319da0ae6ef9ec3b220adbb178e116713db2a..b5ad45f447e2c03f74333f7b4078e1d43d8c4ea2 100755 (executable)
"
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 &&
index 13766ab160e48d2b2ecb6e95079077e4a0704c2c..75388f3f07de4ddb0fd4d72794a8cbf97f925ab7 100755 (executable)
--- a/t/t9100-git-svn-basic.sh
+++ b/t/t9100-git-svn-basic.sh
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 &&
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"'
index 929499e996bc33d96ebab0b01ebcac8240e689b7..f53a1a9ea6ce09342b3d8e79e69f3b351988c717 100755 (executable)
--- a/t/t9101-git-svn-props.sh
+++ b/t/t9101-git-svn-props.sh
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" &&
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'
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 &&
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 &&
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
"
index 028fb19e09bbb9e2720e95a5e0b4ddb221f4a0e1..d60a8efac29a551dd93d2bb3ec1b7a2a19dfad45 100755 (executable)
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' '
index bbfd7f4793ab41118e7060bf7c0512309f81a546..236e7de9a9251a22a0eabe1e723aa77b31369508 100755 (executable)
test_expect_success 'initialize repo' '
mkdir import &&
- cd import &&
+ (cd import &&
mkdir -p trunk &&
echo hello > trunk/readme &&
- svn_cmd import -m "initial" . "$svnrepo" &&
- cd .. &&
+ svn_cmd import -m "initial" . "$svnrepo"
+ ) &&
svn_cmd co "$svnrepo" wc &&
- cd wc &&
+ (cd wc &&
echo world >> trunk/readme &&
poke trunk/readme &&
svn_cmd commit -m "another commit" &&
svn_cmd mv trunk thunk &&
echo goodbye >> thunk/readme &&
poke thunk/readme &&
- svn_cmd commit -m "bye now" &&
- cd ..
+ svn_cmd commit -m "bye now"
+ )
'
test_expect_success 'init and fetch a moved directory' '
test_expect_success 'follow higher-level parent' '
svn mkdir -m "follow higher-level parent" "$svnrepo"/blob &&
svn co "$svnrepo"/blob blob &&
- cd blob &&
+ (cd blob &&
echo hi > hi &&
svn add hi &&
- svn commit -m "hihi" &&
- cd ..
+ svn commit -m "hihi"
+ ) &&
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 &&
import/trunk/subversion/bindings/swig/perl/t/larger-parent &&
echo "bad delete test 2" > \
import/trunk/subversion/bindings/swig/perl/another-larger &&
- cd import &&
- svn import -m "r9270 test" . "$svnrepo"/r9270 &&
- cd .. &&
+ (cd import &&
+ svn import -m "r9270 test" . "$svnrepo"/r9270
+ ) &&
svn_cmd co "$svnrepo"/r9270/trunk/subversion/bindings/swig/perl r9270 &&
- cd r9270 &&
+ (cd r9270 &&
svn mkdir native &&
svn mv t native/t &&
for i in a b c; do svn mv $i.pm native/$i.pm; done &&
echo z >> native/t/c.t &&
poke native/t/c.t &&
- svn commit -m "reorg test" &&
- cd .. &&
+ svn commit -m "reorg test"
+ ) &&
git svn init --minimize-url -i r9270-t \
"$svnrepo"/r9270/trunk/subversion/bindings/swig/perl/native/t &&
git svn fetch -i r9270-t &&
index dd48e9cba832a06a34fd1e2c895bb1b19792168f..d432d835aeef1dafebf1c358a2c25009bc5df00e 100755 (executable)
test_expect_success 'initialize repo' '
mkdir import &&
- cd import &&
+ (cd import &&
echo hello > readme &&
- svn_cmd import -m "initial" . "$svnrepo" &&
- cd .. &&
+ svn_cmd import -m "initial" . "$svnrepo"
+ ) &&
echo hello > readme &&
git update-index --add readme &&
git commit -a -m "initial" &&
index 12f21b700ec5216b6aeaa886f862d3e3b1f6682f..af367a18143ff36cc6388d840fc0307322d148cf 100755 (executable)
test_expect_success 'initialize repo' '
mkdir import &&
- cd import &&
+ (cd import &&
echo initial > file &&
- svn_cmd import -m "initial" . "$svnrepo" &&
- cd .. &&
+ svn_cmd import -m "initial" . "$svnrepo"
+ ) &&
echo initial > file &&
git update-index --add file &&
git commit -a -m "initial"
'
test_expect_success 'commit change from svn side' '
svn_cmd co "$svnrepo" t.svn &&
- cd t.svn &&
+ (cd t.svn &&
echo second line from svn >> file &&
poke file &&
- svn_cmd commit -m "second line from svn" &&
- cd .. &&
+ svn_cmd commit -m "second line from svn"
+ ) &&
rm -rf t.svn
'
git svn fetch &&
git reset --hard refs/${remotes_git_svn} &&
svn_cmd co "$svnrepo" t.svn &&
- cd t.svn &&
+ (cd t.svn &&
echo fourth line from svn >> file &&
poke file &&
- svn_cmd commit -m "fourth line from svn" &&
- cd .. &&
+ svn_cmd commit -m "fourth line from svn"
+ ) &&
rm -rf t.svn &&
echo "fourth line from git" >> file &&
git commit -a -m "fourth line from git" &&
test_expect_success 'commit another change from svn side' '
svn_cmd co "$svnrepo" t.svn &&
- cd t.svn &&
+ (cd t.svn &&
echo third line from svn >> file &&
poke file &&
- svn_cmd commit -m "third line from svn" &&
- cd .. &&
+ svn_cmd commit -m "third line from svn"
+ ) &&
rm -rf t.svn
'
index 901b8e09fbc6660456311c04b4b88c20e108c313..f60b30699b765fe76c779fa49f44368de7a1b9d5 100755 (executable)
test_expect_success 'setup old-looking metadata' '
cp "$GIT_DIR"/config "$GIT_DIR"/config-old-git-svn &&
mkdir import &&
- cd import &&
+ (cd import &&
for i in trunk branches/a branches/b \
tags/0.1 tags/0.2 tags/0.3; do
mkdir -p $i && \
echo hello >> $i/README || exit 1
done && \
svn_cmd import -m test . "$svnrepo"
- cd .. &&
+ ) &&
git svn init "$svnrepo" &&
git svn fetch &&
rm -rf "$GIT_DIR"/svn &&
index 84f7c9b4bb00931b57740be32ce7ee29bbb26694..a7d0c7d99e936a98e2c45a4fd2999de254b92ff8 100755 (executable)
test_expect_success 'setup svn repository' '
svn_cmd co "$svnrepo" mysvnwork &&
mkdir -p mysvnwork/trunk &&
- cd mysvnwork &&
+ (cd mysvnwork &&
big_text_block >> trunk/README &&
svn_cmd add trunk &&
- svn_cmd ci -m "first commit" trunk &&
- cd ..
+ svn_cmd ci -m "first commit" trunk
+ )
'
test_expect_success 'setup git mirror and merge' '
index 767799e7a70b91ef6f4e3f4007529f1cb0fd919c..9fdbc9bc95573566aaa73b9599be9cc1305b10d0 100755 (executable)
test_expect_success 'clone the repository to test rebase' '
git svn clone "$svnrepo" test-rebase &&
- cd test-rebase &&
+ (cd test-rebase &&
echo test-rebase > test-rebase &&
git add test-rebase &&
- git commit -m test-rebase &&
- cd ..
+ git commit -m test-rebase
+ )
'
test_expect_success 'make a commit to test rebase' '
diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh
index 0374a7476bcc5b254aa1464d468434ae3205f114..244b5cd3cfed681c83145097232a3dede5ad3034 100755 (executable)
--- a/t/t9116-git-svn-log.sh
+++ b/t/t9116-git-svn-log.sh
test_expect_success 'setup repository and import' '
mkdir import &&
- cd import &&
+ (cd import &&
for i in trunk branches/a branches/b \
tags/0.1 tags/0.2 tags/0.3; do
mkdir -p $i && \
echo hello >> $i/README || exit 1
done && \
svn_cmd import -m test . "$svnrepo"
- cd .. &&
+ ) &&
git svn init "$svnrepo" -T trunk -b branches -t tags &&
git svn fetch &&
git reset --hard trunk &&
index 5fb94fb3d61c2e26dcd448ac5106ec0f9a3a2283..e3f08c448eaf1f6b5ee0665e5a830727b35a2092 100755 (executable)
--- a/t/t9119-git-svn-info.sh
+++ b/t/t9119-git-svn-info.sh
test_expect_success 'setup repository and import' '
mkdir info &&
- cd info &&
+ (cd info &&
echo FIRST > A &&
echo one > file &&
ln -s file symlink-file &&
mkdir directory &&
touch directory/.placeholder &&
ln -s directory symlink-directory &&
- svn_cmd import -m "initial" . "$svnrepo" &&
- cd .. &&
+ svn_cmd import -m "initial" . "$svnrepo"
+ ) &&
svn_cmd co "$svnrepo" svnwc &&
- cd svnwc &&
+ (cd svnwc &&
echo foo > foo &&
svn_cmd add foo &&
svn_cmd commit -m "change outside directory" &&
- svn_cmd update &&
- cd .. &&
+ svn_cmd update
+ ) &&
mkdir gitwc &&
- cd gitwc &&
+ (cd gitwc &&
git svn init "$svnrepo" &&
- git svn fetch &&
- cd .. &&
+ git svn fetch
+ ) &&
ptouch gitwc/file svnwc/file &&
ptouch gitwc/directory svnwc/directory &&
ptouch gitwc/symlink-file svnwc/symlink-file &&
test_expect_success 'info added-file' "
echo two > gitwc/added-file &&
- cd gitwc &&
- git add added-file &&
- cd .. &&
+ (cd gitwc &&
+ git add added-file
+ ) &&
cp gitwc/added-file svnwc/added-file &&
ptouch gitwc/added-file svnwc/added-file &&
- cd svnwc &&
- svn_cmd add added-file > /dev/null &&
- cd .. &&
+ (cd svnwc &&
+ svn_cmd add added-file > /dev/null
+ ) &&
(cd svnwc; svn info added-file) > expected.info-added-file &&
(cd gitwc; git svn info added-file) > actual.info-added-file &&
test_cmp expected.info-added-file actual.info-added-file
mkdir gitwc/added-directory svnwc/added-directory &&
ptouch gitwc/added-directory svnwc/added-directory &&
touch gitwc/added-directory/.placeholder &&
- cd svnwc &&
- svn_cmd add added-directory > /dev/null &&
- cd .. &&
- cd gitwc &&
- git add added-directory &&
- cd .. &&
+ (cd svnwc &&
+ svn_cmd add added-directory > /dev/null
+ ) &&
+ (cd gitwc &&
+ git add added-directory
+ ) &&
(cd svnwc; svn info added-directory) \
> expected.info-added-directory &&
(cd gitwc; git svn info added-directory) \
'
test_expect_success 'info added-symlink-file' "
- cd gitwc &&
+ (cd gitwc &&
ln -s added-file added-symlink-file &&
- git add added-symlink-file &&
- cd .. &&
- cd svnwc &&
+ git add added-symlink-file
+ ) &&
+ (cd svnwc &&
ln -s added-file added-symlink-file &&
- svn_cmd add added-symlink-file > /dev/null &&
- cd .. &&
+ svn_cmd add added-symlink-file > /dev/null
+ ) &&
ptouch gitwc/added-symlink-file svnwc/added-symlink-file &&
(cd svnwc; svn info added-symlink-file) \
> expected.info-added-symlink-file &&
'
test_expect_success 'info added-symlink-directory' "
- cd gitwc &&
+ (cd gitwc &&
ln -s added-directory added-symlink-directory &&
- git add added-symlink-directory &&
- cd .. &&
- cd svnwc &&
+ git add added-symlink-directory
+ ) &&
+ (cd svnwc &&
ln -s added-directory added-symlink-directory &&
- svn_cmd add added-symlink-directory > /dev/null &&
- cd .. &&
+ svn_cmd add added-symlink-directory > /dev/null
+ ) &&
ptouch gitwc/added-symlink-directory svnwc/added-symlink-directory &&
(cd svnwc; svn info added-symlink-directory) \
> expected.info-added-symlink-directory &&
# simply reuses the Last Changed Date.
test_expect_success 'info deleted-file' "
- cd gitwc &&
- git rm -f file > /dev/null &&
- cd .. &&
- cd svnwc &&
- svn_cmd rm --force file > /dev/null &&
- cd .. &&
+ (cd gitwc &&
+ git rm -f file > /dev/null
+ ) &&
+ (cd svnwc &&
+ svn_cmd rm --force file > /dev/null
+ ) &&
(cd svnwc; svn info file) |
sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
> expected.info-deleted-file &&
'
test_expect_success 'info deleted-directory' "
- cd gitwc &&
- git rm -r -f directory > /dev/null &&
- cd .. &&
- cd svnwc &&
- svn_cmd rm --force directory > /dev/null &&
- cd .. &&
+ (cd gitwc &&
+ git rm -r -f directory > /dev/null
+ ) &&
+ (cd svnwc &&
+ svn_cmd rm --force directory > /dev/null
+ ) &&
(cd svnwc; svn info directory) |
sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
> expected.info-deleted-directory &&
'
test_expect_success 'info deleted-symlink-file' "
- cd gitwc &&
- git rm -f symlink-file > /dev/null &&
- cd .. &&
- cd svnwc &&
- svn_cmd rm --force symlink-file > /dev/null &&
- cd .. &&
+ (cd gitwc &&
+ git rm -f symlink-file > /dev/null
+ ) &&
+ (cd svnwc &&
+ svn_cmd rm --force symlink-file > /dev/null
+ ) &&
(cd svnwc; svn info symlink-file) |
sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
> expected.info-deleted-symlink-file &&
'
test_expect_success 'info deleted-symlink-directory' "
- cd gitwc &&
- git rm -f symlink-directory > /dev/null &&
- cd .. &&
- cd svnwc &&
- svn_cmd rm --force symlink-directory > /dev/null &&
- cd .. &&
+ (cd gitwc &&
+ git rm -f symlink-directory > /dev/null
+ ) &&
+ (cd svnwc &&
+ svn_cmd rm --force symlink-directory > /dev/null
+ ) &&
(cd svnwc; svn info symlink-directory) |
sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
> expected.info-deleted-symlink-directory &&
'
test_expect_success 'info unknown-symlink-file' "
- cd gitwc &&
- ln -s unknown-file unknown-symlink-file &&
- cd .. &&
+ (cd gitwc &&
+ ln -s unknown-file 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 unknown-symlink-directory' "
- cd gitwc &&
- ln -s unknown-directory unknown-symlink-directory &&
- cd .. &&
+ (cd gitwc &&
+ ln -s unknown-directory 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
diff --git a/t/t9120-git-svn-clone-with-percent-escapes.sh b/t/t9120-git-svn-clone-with-percent-escapes.sh
index 9d9ebd533cbcbcfc1e23be51bad1e63f4f08c53b..cddb9d4fc4c8aa9f62aec039938e71d79e5853b5 100755 (executable)
test_expect_success 'test clone with percent escapes' '
git svn clone "$svnrepo/pr%20ject" clone &&
- cd clone &&
- git rev-parse refs/${remotes_git_svn} &&
- cd ..
+ (cd clone &&
+ git rev-parse refs/${remotes_git_svn}
+ )
'
# SVN works either way, so should we...
diff --git a/t/t9123-git-svn-rebuild-with-rewriteroot.sh b/t/t9123-git-svn-rebuild-with-rewriteroot.sh
index 045521615c64d1ae938524b0424e1e4260ca8c54..0ed90d982d28810c4f7a018fab3d2f8699b78d95 100755 (executable)
. ./lib-git-svn.sh
mkdir import
-cd import
+(cd import
touch foo
svn_cmd import -m 'import for git svn' . "$svnrepo" >/dev/null
-cd ..
+)
rm -rf import
test_expect_success 'init, fetch and checkout repository' '
diff --git a/t/t9125-git-svn-multi-glob-branch-names.sh b/t/t9125-git-svn-multi-glob-branch-names.sh
index c19418614fc8946b5be5f0014559e53fcc15c060..096abd1fe5e37444a442e698a5d5734823a45798 100755 (executable)
test_expect_success 'test clone with multi-glob in branch names' '
git svn clone -T trunk -b branches/*/* -t tags \
"$svnrepo/project" project &&
- cd project &&
+ (cd project &&
git rev-parse "refs/remotes/v14.1/beta" &&
- git rev-parse "refs/remotes/v14.1/gold" &&
- cd ..
+ git rev-parse "refs/remotes/v14.1/gold"
+ )
'
test_expect_success 'test dcommit to multi-globbed branch' "
- cd project &&
+ (cd project &&
git reset --hard 'refs/remotes/v14.1/gold' &&
echo hello >> foo &&
git commit -m 'hello' -- foo &&
- git svn dcommit &&
- cd ..
+ git svn dcommit
+ )
"
test_done
index 4aab8ecc142d9719fd83b064445fa297cc10a520..2e4789d061fe084024b621708ee27e629c2a004a 100755 (executable)
test_expect_success 'initialize svnrepo' '
mkdir import &&
(
- cd import &&
+ (cd import &&
mkdir trunk branches tags &&
- cd trunk &&
- echo foo > foo &&
- cd .. &&
+ (cd trunk &&
+ echo foo > foo
+ ) &&
svn_cmd import -m "import for git-svn" . "$svnrepo" >/dev/null &&
svn_cmd copy "$svnrepo"/trunk "$svnrepo"/branches/a \
- -m "created branch a" &&
- cd .. &&
+ -m "created branch a"
+ ) &&
rm -rf import &&
svn_cmd co "$svnrepo"/trunk trunk &&
- cd trunk &&
+ (cd trunk &&
echo bar >> foo &&
- svn_cmd ci -m "updated trunk" &&
- cd .. &&
+ svn_cmd ci -m "updated trunk"
+ ) &&
svn_cmd co "$svnrepo"/branches/a a &&
- cd a &&
+ (cd a &&
echo baz >> a &&
svn_cmd add a &&
- svn_cmd ci -m "updated a" &&
- cd .. &&
+ svn_cmd ci -m "updated a"
+ ) &&
git svn init --stdlayout "$svnrepo"
)
'
test_expect_success 'make full git mirror of SVN' '
mkdir mirror &&
(
- cd mirror &&
+ (cd mirror &&
git init &&
git svn init --stdlayout "$svnrepo" &&
- git svn fetch &&
- cd ..
+ git svn fetch
+ )
)
'
index 807e494a3af4eb889711cbd7bb8d20c160557301..4b034a67f305622f146e66914139e58045e2457e 100755 (executable)
test_expect_success 'initialize svnrepo' '
mkdir import &&
(
- cd import &&
+ (cd import &&
mkdir trunk branches tags &&
- cd trunk &&
- echo foo > foo &&
- cd .. &&
- svn_cmd import -m "import for git-svn" . "$svnrepo" >/dev/null &&
- cd .. &&
+ (cd trunk &&
+ echo foo > foo
+ ) &&
+ svn_cmd import -m "import for git-svn" . "$svnrepo" >/dev/null
+ ) &&
rm -rf import &&
svn_cmd co "$svnrepo"/trunk trunk &&
- cd trunk &&
+ (cd trunk &&
echo bar >> foo &&
- svn_cmd ci -m "updated trunk" &&
- cd .. &&
+ svn_cmd ci -m "updated trunk"
+ ) &&
rm -rf trunk
)
'
index 636ca0abb965ad2462a2e1e1ebea2a4183aa19e6..d60da63f7aced3e13a411eee661509ae3790e68f 100755 (executable)
test_expect_success 'initialize repo' '
mkdir import &&
- cd import &&
+ (cd import &&
awk "BEGIN { for (i = 1; i < 64; i++) { print i } }" > file
- svn_cmd import -m "initial" . "$svnrepo" &&
- cd .. &&
+ svn_cmd import -m "initial" . "$svnrepo"
+ ) &&
git svn init "$svnrepo" &&
git svn fetch &&
test -e file
test x"`sed -n -e 58p < file`" = x58 &&
test x"`sed -n -e 61p < file`" = x61 &&
svn_cmd co "$svnrepo" tmp &&
- cd tmp &&
+ (cd tmp &&
perl -i.bak -p -e "s/^58$/5588/" file &&
perl -i.bak -p -e "s/^61$/6611/" file &&
poke file &&
test x"`sed -n -e 58p < file`" = x5588 &&
test x"`sed -n -e 61p < file`" = x6611 &&
- svn_cmd commit -m "58 => 5588, 61 => 6611" &&
- cd ..
+ svn_cmd commit -m "58 => 5588, 61 => 6611"
+ )
'
test_expect_success 'some unrelated changes to git' "
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 2aeed7bd0601a0587f99250377001be6287772e5..1a205a4d5ab5027f50568234ad0cd56fd60f4af1 100755 (executable)
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
'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'
index 925bd0fbedf9865cef834460969c0a9fd2262437..1bbfd824e50ba44f6684cbce3f220a99f17f6cc6 100755 (executable)
'
test_expect_success 'adding files' '
- cd cvswork/subdir &&
+ (cd cvswork &&
+ (cd subdir &&
echo "more text" > src.c &&
GIT_CONFIG="$git_config" cvs -Q add src.c >cvs.log 2>&1 &&
marked_as . src.c "" &&
- echo "psuedo-binary" > temp.bin &&
- cd .. &&
+ echo "psuedo-binary" > temp.bin
+ ) &&
GIT_CONFIG="$git_config" cvs -Q add subdir/temp.bin >cvs.log 2>&1 &&
marked_as subdir temp.bin "-kb" &&
cd subdir &&
GIT_CONFIG="$git_config" cvs -Q ci -m "adding files" >cvs.log 2>&1 &&
marked_as . temp.bin "-kb" &&
marked_as . src.c ""
+ )
'
-cd "$WORKDIR"
test_expect_success 'updating' '
git pull gitcvs.git &&
echo 'hi' > subdir/newfile.bin &&
git add subdir/newfile.bin subdir/file.h subdir/newfile.c binfile.bin &&
git commit -q -m "Add and change some files" &&
git push gitcvs.git >/dev/null &&
- cd cvswork &&
- GIT_CONFIG="$git_config" cvs -Q update &&
- cd .. &&
+ (cd cvswork &&
+ GIT_CONFIG="$git_config" cvs -Q update
+ ) &&
marked_as cvswork textfile.c "" &&
marked_as cvswork binfile.bin -kb &&
marked_as cvswork .gitattributes "" &&
'
test_expect_success 'add text (guess)' '
- cd cvswork &&
+ (cd cvswork &&
echo "simpleText" > simpleText.c &&
- GIT_CONFIG="$git_config" cvs -Q add simpleText.c &&
- cd .. &&
+ GIT_CONFIG="$git_config" cvs -Q add simpleText.c
+ ) &&
marked_as cvswork simpleText.c ""
'
test_expect_success 'add bin (guess)' '
- cd cvswork &&
+ (cd cvswork &&
echo "simpleBin: NUL: Q <- there" | q_to_nul > simpleBin.bin &&
- GIT_CONFIG="$git_config" cvs -Q add simpleBin.bin &&
- cd .. &&
+ GIT_CONFIG="$git_config" cvs -Q add simpleBin.bin
+ ) &&
marked_as cvswork simpleBin.bin -kb
'
test_expect_success 'remove files (guess)' '
- cd cvswork &&
+ (cd cvswork &&
GIT_CONFIG="$git_config" cvs -Q rm -f subdir/file.h &&
- cd subdir &&
- GIT_CONFIG="$git_config" cvs -Q rm -f withCr.bin &&
- cd ../.. &&
+ (cd subdir &&
+ GIT_CONFIG="$git_config" cvs -Q rm -f withCr.bin
+ )) &&
marked_as cvswork/subdir withCr.bin -kb &&
marked_as cvswork/subdir file.h ""
'
test_expect_success 'cvs ci (guess)' '
- cd cvswork &&
- GIT_CONFIG="$git_config" cvs -Q ci -m "add/rm files" >cvs.log 2>&1 &&
- cd .. &&
+ (cd cvswork &&
+ GIT_CONFIG="$git_config" cvs -Q ci -m "add/rm files" >cvs.log 2>&1
+ ) &&
marked_as cvswork textfile.c "" &&
marked_as cvswork binfile.bin -kb &&
marked_as cvswork .gitattributes "" &&
'
test_expect_success 'update subdir of other copy (guess)' '
- cd cvswork2/subdir &&
- GIT_CONFIG="$git_config" cvs -Q update &&
- cd ../.. &&
+ (cd cvswork2/subdir &&
+ GIT_CONFIG="$git_config" cvs -Q update
+ ) &&
marked_as cvswork2 textfile.c "" &&
marked_as cvswork2 binfile.bin -kb &&
marked_as cvswork2 .gitattributes "" &&
git add multilineTxt.c &&
git commit -q -m "modify multiline file" >> "${WORKDIR}/marked.log" &&
git push gitcvs.git >/dev/null &&
- cd cvswork2 &&
+ (cd cvswork2 &&
sed "s/1/replaced_1/" < multilineTxt.c > ml.temp &&
mv ml.temp multilineTxt.c &&
- GIT_CONFIG="$git_config" cvs update > cvs.log 2>&1 &&
- cd .. &&
+ GIT_CONFIG="$git_config" cvs update > cvs.log 2>&1
+ ) &&
marked_as cvswork2 textfile.c "" &&
marked_as cvswork2 binfile.bin -kb &&
marked_as cvswork2 .gitattributes "" &&
diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh
index 2eff9cd68ce2f51618159df402bfb46382d44434..6ef1c340829bbf923902c6fcc61da698832874a2 100755 (executable)
--- a/t/t9600-cvsimport.sh
+++ b/t/t9600-cvsimport.sh
mkdir "$CVSROOT/module" &&
$CVS co -d module-cvs module &&
- cd module-cvs &&
+ (cd module-cvs &&
cat <<EOF >o_fortuna &&
O Fortuna
velut luna
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 'pack refs' 'cd module-git && git gc && cd ..'
+test_expect_success 'pack refs' '(cd module-git && git gc)'
test_expect_success 'initial import has correct .git/cvs-revisions' '
'
test_expect_success 'update cvs module' '
-
- cd module-cvs &&
+ (cd module-cvs &&
cat <<EOF >o_fortuna &&
O Fortune,
like the moon
My Latin is terrible.
EOF
- $CVS commit -F message &&
- cd ..
+ $CVS commit -F message
+ )
'
test_expect_success '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 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' '
- 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 '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
+ )
'
index 958bdce4dd8891fa648ba2bf554b18cae91de712..2620780fd66f62b8a221684cdd5d3747cd184881 100755 (executable)
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