remote.<name>.push without dst doesn't behave as documented

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> If git push [<repository>] without any <refspec> argument is set to update some ref at the destination with <src> with remote.<repository>.push configuration variable, :<dst> part can be omitted—such a push will update a ref that <src> normally updates without any <refspec> on the command line. Otherwise, missing :<dst> means to update the same ref as the <src>.

https://git-scm.com/docs/git-push#Documentation/git-push.txt-ltrefspecgt82308203

The only case I can think of where refspec is not passed via command
line and it updates a non-matching branch is when push.default =
upstream. But with remote.<repository>.push without dst it starts
updating a matching branch. Either I don't understand what's meant, or
it doesn't behave as documented.

The second test fails:

@test "normally a non-matching ref updates" {
    start_cloned_repo
    git config push.default upstream
    git checkout -b bb
    git branch -u origin/ba
    git commit --allow-empty -m b

    git push

    assert_equal_refs origin/ba bb
}

@test "with remote.<name>.push without dst happens what happens normally" {
    start_cloned_repo
    git config push.default upstream
    git config remote.origin.push 'refs/heads/*'
    git checkout -b bb
    git branch -u origin/ba
    git commit --allow-empty -m b

    git push

    assert_equal_refs origin/ba bb
}

start_cloned_repo() {
    (mkrepo)
    cd "$BATS_TEST_TMPDIR"
    git clone --bare a a.git
    git clone a.git b
    cd b
    git config push.default upstream
    git config user.email you@xxxxxxxxxxx
    git config user.name "Your Name"
}

mkrepo() {
    cd "$BATS_TEST_TMPDIR"
    mkdir a
    (cd a
    git init
    git branch -m ba
    git config user.email you@xxxxxxxxxxx
    git config user.name "Your Name"
    git commit --allow-empty -m a)
}

More details in a gist:
https://gist.github.com/x-yuri/943fd13704b38551da36c8363d7852e1

Regards,
Yuri





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux