{"thread":{"id":"51078","subject":"push docs: inaccurate description of omitted destination?","startedAt":"2019-05-13T03:47:13Z","lastAt":"2019-05-13T09:18:33Z","messageCount":2,"participants":["Kyle Meyer","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"375360","messageId":"87sgtj6mo3.fsf@kyleam.com","threadId":"51078","inReplyTo":null,"subject":"push docs: inaccurate description of omitted destination?","fromName":"Kyle Meyer","fromEmail":"kyle@kyleam.com","sentAt":"2019-05-13T03:47:08Z","receivedAt":"2019-05-13T03:47:13Z","isPatch":false,"sender":{"key":"kyle@kyleam.com","avatar":"https://avatars.githubusercontent.com/u/1297788?v=4"},"body":"It seems to me that push's manpage contains a couple of inaccurate (or\nat least confusingly incomplete) statements about omitting the\ndestination part of the refspec.\n\nFirst, the refspec section of the manpage has this to say:\n\n    If `git push [<repository>]` without any `<refspec>` argument is set to\n    update some ref at the destination with `<src>` with\n    `remote.<repository>.push` configuration variable, `:<dst>` part can\n    be omitted--such a push will update a ref that `<src>` normally updates\n    without any `<refspec>` on the command line.  Otherwise, missing\n    `:<dst>` means to update the same ref as the `<src>`.\n\nReading that, I'd think that, if I haven't configured\nremote.<repository>.push in a way that involves <src>, omitting <dst>\nwill update the remote ref with the same name.  But push.default is also\nconsulted before falling back entirely to using the remote ref with the\nsame name:\n\n    $ git rev-parse --symbolic-full-name HEAD\n    refs/heads/topic\n    $ git rev-parse --symbolic-full-name @{upstream}\n    refs/remotes/origin/master\n    $ git -c push.default=upstream push -n origin topic ;# unmentioned case\n    To ../rem\n       09cc638..58f7f72  topic -> master\n\n    $ git branch --unset-upstream topic\n    $ git -c push.default=upstream push -n origin topic ;# fallback case\n    To ../rem\n     * [new branch]      topic -> topic\n\nSecond, the example section says\n\n    `git push origin master`::\n       Find a ref that matches `master` in the source repository\n       (most likely, it would find `refs/heads/master`), and update\n       the same ref (e.g. `refs/heads/master`) in `origin` repository\n       with it.  If `master` did not exist remotely, it would be\n       created.\n\nPerhaps I'm misreading that, but I'd interpret that as saying the remote\nref with the same name will always be updated, but that doesn't match\nthe refspec description of an omitted destination shown above or the\npush.default-dependent behavior demonstrated in the example above.\n"},{"id":"375371","messageId":"xmqqimuebtlu.fsf@gitster-ct.c.googlers.com","threadId":"51078","inReplyTo":"87sgtj6mo3.fsf@kyleam.com","subject":"Re: push docs: inaccurate description of omitted destination?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-05-13T09:18:21Z","receivedAt":"2019-05-13T09:18:33Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kyle Meyer <kyle@kyleam.com> writes:\n\n> It seems to me that push's manpage contains a couple of inaccurate (or\n> at least confusingly incomplete) statements about omitting the\n> destination part of the refspec.\n>\n> First, the refspec section of the manpage has this to say:\n>\n>     If `git push [<repository>]` without any `<refspec>` argument is set to\n>     update some ref at the destination with `<src>` with\n>     `remote.<repository>.push` configuration variable, `:<dst>` part can\n>     be omitted--such a push will update a ref that `<src>` normally updates\n>     without any `<refspec>` on the command line.  Otherwise, missing\n>     `:<dst>` means to update the same ref as the `<src>`.\n>\n> Reading that, I'd think that, if I haven't configured\n> remote.<repository>.push in a way that involves <src>, omitting <dst>\n> will update the remote ref with the same name.\n\n... if such a push would update the ref at the remote with the same\nname, yes.  Otherwise no.  And that is determined by what push mode\nis being used (e.g. are we using the matching mode?  The current\nmode?  Something else?).\n\n>  But push.default is also\n> consulted before falling back entirely to using the remote ref with the\n> same name:\n\nYes.  The push.default configuration participates in the selection\nof the ref at the remote that gets updated, given a refspec element\nwith a missing :<dst>.  And you do not have to write :<dst> to name\nthe ref that a refspec with missing :<dst> would update anyway.\n\n>     `git push origin master`::\n>        Find a ref that matches `master` in the source repository\n>        (most likely, it would find `refs/heads/master`), and update\n>        the same ref (e.g. `refs/heads/master`) in `origin` repository\n>        with it.  If `master` did not exist remotely, it would be\n>        created.\n>\n> Perhaps I'm misreading that, but I'd interpret that as saying the remote\n> ref with the same name will always be updated,...\n\nThat part is random listing of examples with vanilla configuration,\nso depending on what setting you personally have, the behaviour may\nbe different.\n"}]}