Merge branch 'es/blame-L-breakage'
[gitweb.git] / contrib / remote-helpers / test-bzr.sh
index 4ab73ec4e558df528f89f7263fb9c4c7e5fda025..dce281f91195cde4937b935910ec73f597bb826a 100755 (executable)
@@ -18,15 +18,8 @@ if ! python -c 'import bzrlib'; then
 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
 }
 
@@ -41,8 +34,8 @@ test_expect_success 'cloning' '
        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' '
@@ -54,7 +47,7 @@ test_expect_success 'pulling' '
 
        (cd gitrepo && git pull) &&
 
-       check gitrepo two master
+       check gitrepo HEAD two
 '
 
 test_expect_success 'pushing' '
@@ -89,7 +82,7 @@ test_expect_success 'roundtrip' '
 
        (cd gitrepo && git pull && git push) &&
 
-       check gitrepo four master &&
+       check gitrepo HEAD four &&
 
        (
        cd gitrepo &&
@@ -190,9 +183,11 @@ test_expect_success 'different authors' '
        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
@@ -214,7 +209,7 @@ test_expect_success 'fetch utf-8 filenames' '
        ) &&
 
        (
-       git clone "bzr::$PWD/bzrrepo" gitrepo &&
+       git clone "bzr::bzrrepo" gitrepo &&
        cd gitrepo &&
        git -c core.quotepath=false ls-files > ../actual
        ) &&
@@ -223,8 +218,9 @@ test_expect_success 'fetch utf-8 filenames' '
 '
 
 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
@@ -239,7 +235,7 @@ test_expect_success 'push utf-8 filenames' '
        ) &&
 
        (
-       git clone "bzr::$PWD/bzrrepo" gitrepo &&
+       git clone "bzr::bzrrepo" gitrepo &&
        cd gitrepo &&
 
        echo test >> "ærø" &&
@@ -255,8 +251,7 @@ test_expect_success 'push utf-8 filenames' '
 '
 
 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 &&
@@ -266,7 +261,7 @@ test_expect_success 'pushing a merge' '
        bzr commit -m one
        ) &&
 
-       git clone "bzr::$PWD/bzrrepo" gitrepo &&
+       git clone "bzr::bzrrepo" gitrepo &&
 
        (
        cd bzrrepo &&
@@ -297,8 +292,7 @@ origin/trunk
 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 &&
 
@@ -318,18 +312,16 @@ test_expect_success 'proper bzr repo' '
        ) &&
 
        (
-       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 &&
@@ -343,7 +335,7 @@ test_expect_success 'strip' '
        bzr commit -m two
        ) &&
 
-       git clone "bzr::$PWD/bzrrepo" gitrepo &&
+       git clone "bzr::bzrrepo" gitrepo &&
 
        (
        cd bzrrepo &&