remote-bzr: simplify test checks
[gitweb.git] / contrib / remote-helpers / test-hg-hg-git.sh
index 041041ddb14cc40ab8f4dd50521afb47affcccc5..2219284382f0e987423ae00e5bd89e9b7a4b0046 100755 (executable)
@@ -27,7 +27,8 @@ fi
 
 # clone to a git repo with git
 git_clone_git () {
-       git clone -q "hg::$PWD/$1" $2
+       git clone -q "hg::$1" $2 &&
+       (cd $2 && git checkout master && git branch -D default)
 }
 
 # clone to an hg repo with git
@@ -36,7 +37,7 @@ hg_clone_git () {
        hg init $2 &&
        hg -R $2 bookmark -i master &&
        cd $1 &&
-       git push -q "hg::$PWD/../$2" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
+       git push -q "hg::../$2" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*'
        ) &&
 
        (cd $2 && hg -q update)
@@ -61,10 +62,10 @@ hg_clone_hg () {
 hg_push_git () {
        (
        cd $2
-       old=$(git symbolic-ref --short HEAD)
        git checkout -q -b tmp &&
-       git fetch -q "hg::$PWD/../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
-       git checkout -q $old &&
+       git fetch -q "hg::../$1" 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' &&
+       git branch -D default &&
+       git checkout -q @{-1} &&
        git branch -q -D tmp 2> /dev/null || true
        )
 }