7d90056cf346e69891ec455e44ba16e88f32af90
   1#!/bin/sh
   2#
   3# Copyright (c) 2012 Felipe Contreras
   4#
   5# Base commands from hg-git tests:
   6# https://bitbucket.org/durin42/hg-git/src
   7#
   8
   9test_description='Test remote-hg'
  10
  11test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=${0%/*}/../../t
  12. "$TEST_DIRECTORY"/test-lib.sh
  13
  14if ! test_have_prereq PYTHON
  15then
  16        skip_all='skipping remote-hg tests; python not available'
  17        test_done
  18fi
  19
  20if ! python -c 'import mercurial'
  21then
  22        skip_all='skipping remote-hg tests; mercurial not available'
  23        test_done
  24fi
  25
  26check () {
  27        echo $3 >expected &&
  28        git --git-dir=$1/.git log --format='%s' -1 $2 >actual
  29        test_cmp expected actual
  30}
  31
  32check_branch () {
  33        if test -n "$3"
  34        then
  35                echo $3 >expected &&
  36                hg -R $1 log -r $2 --template '{desc}\n' >actual &&
  37                test_cmp expected actual
  38        else
  39                hg -R $1 branches >out &&
  40                ! grep $2 out
  41        fi
  42}
  43
  44check_bookmark () {
  45        if test -n "$3"
  46        then
  47                echo $3 >expected &&
  48                hg -R $1 log -r "bookmark('$2')" --template '{desc}\n' >actual &&
  49                test_cmp expected actual
  50        else
  51                hg -R $1 bookmarks >out &&
  52                ! grep $2 out
  53        fi
  54}
  55
  56check_push () {
  57        expected_ret=$1 ret=0 ref_ret=0
  58
  59        shift
  60        git push origin "$@" 2>error
  61        ret=$?
  62        cat error
  63
  64        while IFS=':' read branch kind
  65        do
  66                case "$kind" in
  67                'new')
  68                        grep "^ \* \[new branch\] *${branch} -> ${branch}$" error || ref_ret=1
  69                        ;;
  70                'non-fast-forward')
  71                        grep "^ ! \[rejected\] *${branch} -> ${branch} (non-fast-forward)$" error || ref_ret=1
  72                        ;;
  73                'fetch-first')
  74                        grep "^ ! \[rejected\] *${branch} -> ${branch} (fetch first)$" error || ref_ret=1
  75                        ;;
  76                'forced-update')
  77                        grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *${branch} -> ${branch} (forced update)$" error || ref_ret=1
  78                        ;;
  79                '')
  80                        grep "^   [a-f0-9]*\.\.[a-f0-9]* *${branch} -> ${branch}$" error || ref_ret=1
  81                        ;;
  82                esac
  83                test $ref_ret -ne 0 && echo "match for '$branch' failed" && break
  84        done
  85
  86        if test $expected_ret -ne $ret || test $ref_ret -ne 0
  87        then
  88                return 1
  89        fi
  90
  91        return 0
  92}
  93
  94setup () {
  95        (
  96        echo "[ui]"
  97        echo "username = H G Wells <wells@example.com>"
  98        echo "[extensions]"
  99        echo "mq ="
 100        ) >>"$HOME"/.hgrc &&
 101
 102        GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230" &&
 103        GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" &&
 104        export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
 105}
 106
 107setup
 108
 109test_expect_success 'cloning' '
 110        test_when_finished "rm -rf gitrepo*" &&
 111
 112        (
 113        hg init hgrepo &&
 114        cd hgrepo &&
 115        echo zero >content &&
 116        hg add content &&
 117        hg commit -m zero
 118        ) &&
 119
 120        git clone "hg::hgrepo" gitrepo &&
 121        check gitrepo HEAD zero
 122'
 123
 124test_expect_success 'cloning with branches' '
 125        test_when_finished "rm -rf gitrepo*" &&
 126
 127        (
 128        cd hgrepo &&
 129        hg branch next &&
 130        echo next >content &&
 131        hg commit -m next
 132        ) &&
 133
 134        git clone "hg::hgrepo" gitrepo &&
 135        check gitrepo origin/branches/next next
 136'
 137
 138test_expect_success 'cloning with bookmarks' '
 139        test_when_finished "rm -rf gitrepo*" &&
 140
 141        (
 142        cd hgrepo &&
 143        hg checkout default &&
 144        hg bookmark feature-a &&
 145        echo feature-a >content &&
 146        hg commit -m feature-a
 147        ) &&
 148
 149        git clone "hg::hgrepo" gitrepo &&
 150        check gitrepo origin/feature-a feature-a
 151'
 152
 153test_expect_success 'update bookmark' '
 154        test_when_finished "rm -rf gitrepo*" &&
 155
 156        (
 157        cd hgrepo &&
 158        hg bookmark devel
 159        ) &&
 160
 161        (
 162        git clone "hg::hgrepo" gitrepo &&
 163        cd gitrepo &&
 164        git checkout --quiet devel &&
 165        echo devel >content &&
 166        git commit -a -m devel &&
 167        git push --quiet
 168        ) &&
 169
 170        check_bookmark hgrepo devel devel
 171'
 172
 173test_expect_success 'new bookmark' '
 174        test_when_finished "rm -rf gitrepo*" &&
 175
 176        (
 177        git clone "hg::hgrepo" gitrepo &&
 178        cd gitrepo &&
 179        git checkout --quiet -b feature-b &&
 180        echo feature-b >content &&
 181        git commit -a -m feature-b &&
 182        git push --quiet origin feature-b
 183        ) &&
 184
 185        check_bookmark hgrepo feature-b feature-b
 186'
 187
 188# cleanup previous stuff
 189rm -rf hgrepo
 190
 191author_test () {
 192        echo $1 >>content &&
 193        hg commit -u "$2" -m "add $1" &&
 194        echo "$3" >>../expected
 195}
 196
 197test_expect_success 'authors' '
 198        test_when_finished "rm -rf hgrepo gitrepo" &&
 199
 200        (
 201        hg init hgrepo &&
 202        cd hgrepo &&
 203
 204        touch content &&
 205        hg add content &&
 206
 207        >../expected &&
 208        author_test alpha "" "H G Wells <wells@example.com>" &&
 209        author_test beta "beta" "beta <unknown>" &&
 210        author_test gamma "gamma <test@example.com> (comment)" "gamma <test@example.com>" &&
 211        author_test delta "<delta@example.com>" "Unknown <delta@example.com>" &&
 212        author_test epsilon "epsilon<test@example.com>" "epsilon <test@example.com>" &&
 213        author_test zeta "zeta <test@example.com" "zeta <test@example.com>" &&
 214        author_test eta " eta " "eta <unknown>" &&
 215        author_test theta "theta < test@example.com >" "theta <test@example.com>" &&
 216        author_test iota "iota >test@example.com>" "iota <test@example.com>" &&
 217        author_test kappa "kappa < test <at> example <dot> com>" "kappa <unknown>" &&
 218        author_test lambda "lambda@example.com" "Unknown <lambda@example.com>" &&
 219        author_test mu "mu.mu@example.com" "Unknown <mu.mu@example.com>"
 220        ) &&
 221
 222        git clone "hg::hgrepo" gitrepo &&
 223        git --git-dir=gitrepo/.git log --reverse --format="%an <%ae>" >actual &&
 224
 225        test_cmp expected actual
 226'
 227
 228test_expect_success 'strip' '
 229        test_when_finished "rm -rf hgrepo gitrepo" &&
 230
 231        (
 232        hg init hgrepo &&
 233        cd hgrepo &&
 234
 235        echo one >>content &&
 236        hg add content &&
 237        hg commit -m one &&
 238
 239        echo two >>content &&
 240        hg commit -m two
 241        ) &&
 242
 243        git clone "hg::hgrepo" gitrepo &&
 244
 245        (
 246        cd hgrepo &&
 247        hg strip 1 &&
 248
 249        echo three >>content &&
 250        hg commit -m three &&
 251
 252        echo four >>content &&
 253        hg commit -m four
 254        ) &&
 255
 256        (
 257        cd gitrepo &&
 258        git fetch &&
 259        git log --format="%s" origin/master >../actual
 260        ) &&
 261
 262        hg -R hgrepo log --template "{desc}\n" >expected &&
 263        test_cmp actual expected
 264'
 265
 266test_expect_success 'remote push with master bookmark' '
 267        test_when_finished "rm -rf hgrepo gitrepo*" &&
 268
 269        (
 270        hg init hgrepo &&
 271        cd hgrepo &&
 272        echo zero >content &&
 273        hg add content &&
 274        hg commit -m zero &&
 275        hg bookmark master &&
 276        echo one >content &&
 277        hg commit -m one
 278        ) &&
 279
 280        (
 281        git clone "hg::hgrepo" gitrepo &&
 282        cd gitrepo &&
 283        echo two >content &&
 284        git commit -a -m two &&
 285        git push
 286        ) &&
 287
 288        check_branch hgrepo default two
 289'
 290
 291cat >expected <<\EOF
 292changeset:   0:6e2126489d3d
 293tag:         tip
 294user:        A U Thor <author@example.com>
 295date:        Mon Jan 01 00:00:00 2007 +0230
 296summary:     one
 297
 298EOF
 299
 300test_expect_success 'remote push from master branch' '
 301        test_when_finished "rm -rf hgrepo gitrepo*" &&
 302
 303        hg init hgrepo &&
 304
 305        (
 306        git init gitrepo &&
 307        cd gitrepo &&
 308        git remote add origin "hg::../hgrepo" &&
 309        echo one >content &&
 310        git add content &&
 311        git commit -a -m one &&
 312        git push origin master
 313        ) &&
 314
 315        hg -R hgrepo log >actual &&
 316        cat actual &&
 317        test_cmp expected actual &&
 318
 319        check_branch hgrepo default one
 320'
 321
 322GIT_REMOTE_HG_TEST_REMOTE=1
 323export GIT_REMOTE_HG_TEST_REMOTE
 324
 325test_expect_success 'remote cloning' '
 326        test_when_finished "rm -rf gitrepo*" &&
 327
 328        (
 329        hg init hgrepo &&
 330        cd hgrepo &&
 331        echo zero >content &&
 332        hg add content &&
 333        hg commit -m zero
 334        ) &&
 335
 336        git clone "hg::hgrepo" gitrepo &&
 337        check gitrepo HEAD zero
 338'
 339
 340test_expect_success 'moving remote clone' '
 341        test_when_finished "rm -rf gitrepo*" &&
 342
 343        (
 344        git clone "hg::hgrepo" gitrepo &&
 345        mv gitrepo gitrepo2 &&
 346        cd gitrepo2 &&
 347        git fetch
 348        )
 349'
 350
 351test_expect_success 'remote update bookmark' '
 352        test_when_finished "rm -rf gitrepo*" &&
 353
 354        (
 355        cd hgrepo &&
 356        hg bookmark devel
 357        ) &&
 358
 359        (
 360        git clone "hg::hgrepo" gitrepo &&
 361        cd gitrepo &&
 362        git checkout --quiet devel &&
 363        echo devel >content &&
 364        git commit -a -m devel &&
 365        git push --quiet
 366        ) &&
 367
 368        check_bookmark hgrepo devel devel
 369'
 370
 371test_expect_success 'remote new bookmark' '
 372        test_when_finished "rm -rf gitrepo*" &&
 373
 374        (
 375        git clone "hg::hgrepo" gitrepo &&
 376        cd gitrepo &&
 377        git checkout --quiet -b feature-b &&
 378        echo feature-b >content &&
 379        git commit -a -m feature-b &&
 380        git push --quiet origin feature-b
 381        ) &&
 382
 383        check_bookmark hgrepo feature-b feature-b
 384'
 385
 386test_expect_success 'remote push diverged' '
 387        test_when_finished "rm -rf gitrepo*" &&
 388
 389        git clone "hg::hgrepo" gitrepo &&
 390
 391        (
 392        cd hgrepo &&
 393        hg checkout default &&
 394        echo bump >content &&
 395        hg commit -m bump
 396        ) &&
 397
 398        (
 399        cd gitrepo &&
 400        echo diverge >content &&
 401        git commit -a -m diverged &&
 402        check_push 1 <<-\EOF
 403        master:non-fast-forward
 404        EOF
 405        ) &&
 406
 407        check_branch hgrepo default bump
 408'
 409
 410test_expect_success 'remote update bookmark diverge' '
 411        test_when_finished "rm -rf gitrepo*" &&
 412
 413        (
 414        cd hgrepo &&
 415        hg checkout tip^ &&
 416        hg bookmark diverge
 417        ) &&
 418
 419        git clone "hg::hgrepo" gitrepo &&
 420
 421        (
 422        cd hgrepo &&
 423        echo "bump bookmark" >content &&
 424        hg commit -m "bump bookmark"
 425        ) &&
 426
 427        (
 428        cd gitrepo &&
 429        git checkout --quiet diverge &&
 430        echo diverge >content &&
 431        git commit -a -m diverge &&
 432        check_push 1 <<-\EOF
 433        diverge:fetch-first
 434        EOF
 435        ) &&
 436
 437        check_bookmark hgrepo diverge "bump bookmark"
 438'
 439
 440test_expect_success 'remote new bookmark multiple branch head' '
 441        test_when_finished "rm -rf gitrepo*" &&
 442
 443        (
 444        git clone "hg::hgrepo" gitrepo &&
 445        cd gitrepo &&
 446        git checkout --quiet -b feature-c HEAD^ &&
 447        echo feature-c >content &&
 448        git commit -a -m feature-c &&
 449        git push --quiet origin feature-c
 450        ) &&
 451
 452        check_bookmark hgrepo feature-c feature-c
 453'
 454
 455# cleanup previous stuff
 456rm -rf hgrepo
 457
 458test_expect_success 'fetch special filenames' '
 459        test_when_finished "rm -rf hgrepo gitrepo && LC_ALL=C" &&
 460
 461        LC_ALL=en_US.UTF-8
 462        export LC_ALL
 463
 464        (
 465        hg init hgrepo &&
 466        cd hgrepo &&
 467
 468        echo test >> "æ rø" &&
 469        hg add "æ rø" &&
 470        echo test >> "ø~?" &&
 471        hg add "ø~?" &&
 472        hg commit -m add-utf-8 &&
 473        echo test >> "æ rø" &&
 474        hg commit -m test-utf-8 &&
 475        hg rm "ø~?" &&
 476        hg mv "æ rø" "ø~?" &&
 477        hg commit -m hg-mv-utf-8
 478        ) &&
 479
 480        (
 481        git clone "hg::hgrepo" gitrepo &&
 482        cd gitrepo &&
 483        git -c core.quotepath=false ls-files > ../actual
 484        ) &&
 485        echo "ø~?" > expected &&
 486        test_cmp expected actual
 487'
 488
 489test_expect_success 'push special filenames' '
 490        test_when_finished "rm -rf hgrepo gitrepo && LC_ALL=C" &&
 491
 492        mkdir -p tmp && cd tmp &&
 493
 494        LC_ALL=en_US.UTF-8
 495        export LC_ALL
 496
 497        (
 498        hg init hgrepo &&
 499        cd hgrepo &&
 500
 501        echo one >> content &&
 502        hg add content &&
 503        hg commit -m one
 504        ) &&
 505
 506        (
 507        git clone "hg::hgrepo" gitrepo &&
 508        cd gitrepo &&
 509
 510        echo test >> "æ rø" &&
 511        git add "æ rø" &&
 512        git commit -m utf-8 &&
 513
 514        git push
 515        ) &&
 516
 517        (cd hgrepo &&
 518        hg update &&
 519        hg manifest > ../actual
 520        ) &&
 521
 522        printf "content\næ rø\n" > expected &&
 523        test_cmp expected actual
 524'
 525
 526setup_big_push () {
 527        (
 528        hg init hgrepo &&
 529        cd hgrepo &&
 530        echo zero >content &&
 531        hg add content &&
 532        hg commit -m zero &&
 533        hg bookmark bad_bmark1 &&
 534        echo one >content &&
 535        hg commit -m one &&
 536        hg bookmark bad_bmark2 &&
 537        hg bookmark good_bmark &&
 538        hg bookmark -i good_bmark &&
 539        hg -q branch good_branch &&
 540        echo "good branch" >content &&
 541        hg commit -m "good branch" &&
 542        hg -q branch bad_branch &&
 543        echo "bad branch" >content &&
 544        hg commit -m "bad branch"
 545        ) &&
 546
 547        git clone "hg::hgrepo" gitrepo &&
 548
 549        (
 550        cd gitrepo &&
 551        echo two >content &&
 552        git commit -q -a -m two &&
 553
 554        git checkout -q good_bmark &&
 555        echo three >content &&
 556        git commit -q -a -m three &&
 557
 558        git checkout -q bad_bmark1 &&
 559        git reset --hard HEAD^ &&
 560        echo four >content &&
 561        git commit -q -a -m four &&
 562
 563        git checkout -q bad_bmark2 &&
 564        git reset --hard HEAD^ &&
 565        echo five >content &&
 566        git commit -q -a -m five &&
 567
 568        git checkout -q -b new_bmark master &&
 569        echo six >content &&
 570        git commit -q -a -m six &&
 571
 572        git checkout -q branches/good_branch &&
 573        echo seven >content &&
 574        git commit -q -a -m seven &&
 575        echo eight >content &&
 576        git commit -q -a -m eight &&
 577
 578        git checkout -q branches/bad_branch &&
 579        git reset --hard HEAD^ &&
 580        echo nine >content &&
 581        git commit -q -a -m nine &&
 582
 583        git checkout -q -b branches/new_branch master &&
 584        echo ten >content &&
 585        git commit -q -a -m ten
 586        )
 587}
 588
 589test_expect_success 'remote big push' '
 590        test_when_finished "rm -rf hgrepo gitrepo*" &&
 591
 592        setup_big_push
 593
 594        (
 595        cd gitrepo &&
 596
 597        check_push 1 --all <<-\EOF
 598        master
 599        good_bmark
 600        branches/good_branch
 601        new_bmark:new
 602        branches/new_branch:new
 603        bad_bmark1:non-fast-forward
 604        bad_bmark2:non-fast-forward
 605        branches/bad_branch:non-fast-forward
 606        EOF
 607        ) &&
 608
 609        check_branch hgrepo default one &&
 610        check_branch hgrepo good_branch "good branch" &&
 611        check_branch hgrepo bad_branch "bad branch" &&
 612        check_branch hgrepo new_branch '' &&
 613        check_bookmark hgrepo good_bmark one &&
 614        check_bookmark hgrepo bad_bmark1 one &&
 615        check_bookmark hgrepo bad_bmark2 one &&
 616        check_bookmark hgrepo new_bmark ''
 617'
 618
 619test_expect_success 'remote big push fetch first' '
 620        test_when_finished "rm -rf hgrepo gitrepo*" &&
 621
 622        (
 623        hg init hgrepo &&
 624        cd hgrepo &&
 625        echo zero >content &&
 626        hg add content &&
 627        hg commit -m zero &&
 628        hg bookmark bad_bmark &&
 629        hg bookmark good_bmark &&
 630        hg bookmark -i good_bmark &&
 631        hg -q branch good_branch &&
 632        echo "good branch" >content &&
 633        hg commit -m "good branch" &&
 634        hg -q branch bad_branch &&
 635        echo "bad branch" >content &&
 636        hg commit -m "bad branch"
 637        ) &&
 638
 639        git clone "hg::hgrepo" gitrepo &&
 640
 641        (
 642        cd hgrepo &&
 643        hg bookmark -f bad_bmark &&
 644        echo update_bmark >content &&
 645        hg commit -m "update bmark"
 646        ) &&
 647
 648        (
 649        cd gitrepo &&
 650        echo two >content &&
 651        git commit -q -a -m two &&
 652
 653        git checkout -q good_bmark &&
 654        echo three >content &&
 655        git commit -q -a -m three &&
 656
 657        git checkout -q bad_bmark &&
 658        echo four >content &&
 659        git commit -q -a -m four &&
 660
 661        git checkout -q branches/bad_branch &&
 662        echo five >content &&
 663        git commit -q -a -m five &&
 664
 665        check_push 1 --all <<-\EOF &&
 666        master
 667        good_bmark
 668        bad_bmark:fetch-first
 669        branches/bad_branch:festch-first
 670        EOF
 671
 672        git fetch &&
 673
 674        check_push 1 --all <<-\EOF
 675        master
 676        good_bmark
 677        bad_bmark:non-fast-forward
 678        branches/bad_branch:non-fast-forward
 679        EOF
 680        )
 681'
 682
 683test_expect_success 'remote big push force' '
 684        test_when_finished "rm -rf hgrepo gitrepo*" &&
 685
 686        setup_big_push
 687
 688        (
 689        cd gitrepo &&
 690
 691        check_push 0 --force --all <<-\EOF
 692        master
 693        good_bmark
 694        branches/good_branch
 695        new_bmark:new
 696        branches/new_branch:new
 697        bad_bmark1:forced-update
 698        bad_bmark2:forced-update
 699        branches/bad_branch:forced-update
 700        EOF
 701        ) &&
 702
 703        check_branch hgrepo default six &&
 704        check_branch hgrepo good_branch eight &&
 705        check_branch hgrepo bad_branch nine &&
 706        check_branch hgrepo new_branch ten &&
 707        check_bookmark hgrepo good_bmark three &&
 708        check_bookmark hgrepo bad_bmark1 four &&
 709        check_bookmark hgrepo bad_bmark2 five &&
 710        check_bookmark hgrepo new_bmark six
 711'
 712
 713test_expect_success 'remote big push dry-run' '
 714        test_when_finished "rm -rf hgrepo gitrepo*" &&
 715
 716        setup_big_push
 717
 718        (
 719        cd gitrepo &&
 720
 721        check_push 1 --dry-run --all <<-\EOF &&
 722        master
 723        good_bmark
 724        branches/good_branch
 725        new_bmark:new
 726        branches/new_branch:new
 727        bad_bmark1:non-fast-forward
 728        bad_bmark2:non-fast-forward
 729        branches/bad_branch:non-fast-forward
 730        EOF
 731
 732        check_push 0 --dry-run master good_bmark new_bmark branches/good_branch branches/new_branch <<-\EOF
 733        master
 734        good_bmark
 735        branches/good_branch
 736        new_bmark:new
 737        branches/new_branch:new
 738        EOF
 739        ) &&
 740
 741        check_branch hgrepo default one &&
 742        check_branch hgrepo good_branch "good branch" &&
 743        check_branch hgrepo bad_branch "bad branch" &&
 744        check_branch hgrepo new_branch '' &&
 745        check_bookmark hgrepo good_bmark one &&
 746        check_bookmark hgrepo bad_bmark1 one &&
 747        check_bookmark hgrepo bad_bmark2 one &&
 748        check_bookmark hgrepo new_bmark ''
 749'
 750
 751test_expect_success 'remote double failed push' '
 752        test_when_finished "rm -rf hgrepo gitrepo*" &&
 753
 754        (
 755        hg init hgrepo &&
 756        cd hgrepo &&
 757        echo zero >content &&
 758        hg add content &&
 759        hg commit -m zero &&
 760        echo one >content &&
 761        hg commit -m one
 762        ) &&
 763
 764        (
 765        git clone "hg::hgrepo" gitrepo &&
 766        cd gitrepo &&
 767        git reset --hard HEAD^ &&
 768        echo two >content &&
 769        git commit -a -m two &&
 770        test_expect_code 1 git push &&
 771        test_expect_code 1 git push
 772        )
 773'
 774
 775test_expect_success 'clone remote with master null bookmark, then push to the bookmark' '
 776        test_when_finished "rm -rf gitrepo* hgrepo*" &&
 777
 778        hg init hgrepo &&
 779        (
 780                cd hgrepo &&
 781                echo a >a &&
 782                hg add a &&
 783                hg commit -m a &&
 784                hg bookmark -r null master
 785        ) &&
 786
 787        git clone "hg::hgrepo" gitrepo &&
 788        check gitrepo HEAD a &&
 789        (
 790                cd gitrepo &&
 791                git checkout --quiet -b master &&
 792                echo b >b &&
 793                git add b &&
 794                git commit -m b &&
 795                git push origin master
 796        )
 797'
 798
 799test_expect_success 'clone remote with default null bookmark, then push to the bookmark' '
 800        test_when_finished "rm -rf gitrepo* hgrepo*" &&
 801
 802        hg init hgrepo &&
 803        (
 804                cd hgrepo &&
 805                echo a >a &&
 806                hg add a &&
 807                hg commit -m a &&
 808                hg bookmark -r null -f default
 809        ) &&
 810
 811        git clone "hg::hgrepo" gitrepo &&
 812        check gitrepo HEAD a &&
 813        (
 814                cd gitrepo &&
 815                git checkout --quiet -b default &&
 816                echo b >b &&
 817                git add b &&
 818                git commit -m b &&
 819                git push origin default
 820        )
 821'
 822
 823test_expect_success 'clone remote with generic null bookmark, then push to the bookmark' '
 824        test_when_finished "rm -rf gitrepo* hgrepo*" &&
 825
 826        hg init hgrepo &&
 827        (
 828                cd hgrepo &&
 829                echo a >a &&
 830                hg add a &&
 831                hg commit -m a &&
 832                hg bookmark -r null bmark
 833        ) &&
 834
 835        git clone "hg::hgrepo" gitrepo &&
 836        check gitrepo HEAD a &&
 837        (
 838                cd gitrepo &&
 839                git checkout --quiet -b bmark &&
 840                git remote -v &&
 841                echo b >b &&
 842                git add b &&
 843                git commit -m b &&
 844                git push origin bmark
 845        )
 846'
 847
 848test_done