fi
check () {
- (
- cd $1 &&
- git log --format='%s' -1 &&
- git symbolic-ref HEAD
- ) > actual &&
- (
- echo $2 &&
- echo "refs/heads/$3"
- ) > expected &&
+ echo $3 > expected &&
+ git --git-dir=$1/.git log --format='%s' -1 $2 > actual
test_cmp expected actual
}
bzr commit -m one
) &&
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
- check gitrepo one master
+ git clone "bzr::bzrrepo" gitrepo &&
+ check gitrepo HEAD one
'
test_expect_success 'pulling' '
(cd gitrepo && git pull) &&
- check gitrepo two master
+ check gitrepo HEAD two
'
test_expect_success 'pushing' '
(cd gitrepo && git pull && git push) &&
- check gitrepo four master &&
+ check gitrepo HEAD four &&
(
cd gitrepo &&
test_cmp expected actual
'
+# cleanup previous stuff
+rm -rf bzrrepo gitrepo
+
test_expect_success 'fetch utf-8 filenames' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
+ test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C" &&
LC_ALL=en_US.UTF-8
export LC_ALL
) &&
(
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
+ git clone "bzr::bzrrepo" gitrepo &&
cd gitrepo &&
git -c core.quotepath=false ls-files > ../actual
) &&
'
test_expect_success 'push utf-8 filenames' '
+ test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C" &&
+
mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
LC_ALL=en_US.UTF-8
export LC_ALL
) &&
(
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
+ git clone "bzr::bzrrepo" gitrepo &&
cd gitrepo &&
echo test >> "ærø" &&
'
test_expect_success 'pushing a merge' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
+ test_when_finished "rm -rf bzrrepo gitrepo" &&
(
bzr init bzrrepo &&
bzr commit -m one
) &&
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
+ git clone "bzr::bzrrepo" gitrepo &&
(
cd bzrrepo &&
EOF
test_expect_success 'proper bzr repo' '
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
+ test_when_finished "rm -rf bzrrepo gitrepo" &&
bzr init-repo bzrrepo &&
) &&
(
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
+ git clone "bzr::bzrrepo" gitrepo &&
cd gitrepo &&
git for-each-ref --format "%(refname:short)" refs/remotes/origin > ../actual
) &&
- test_cmp ../expected actual
+ test_cmp expected actual
'
test_expect_success 'strip' '
- # Do not imitate this style; always chdir inside a subshell instead
- mkdir -p tmp && cd tmp &&
- test_when_finished "cd .. && rm -rf tmp" &&
+ test_when_finished "rm -rf bzrrepo gitrepo" &&
(
bzr init bzrrepo &&
bzr commit -m two
) &&
- git clone "bzr::$PWD/bzrrepo" gitrepo &&
+ git clone "bzr::bzrrepo" gitrepo &&
(
cd bzrrepo &&