Re: remote.<name>.merge missing from the git-config man page?

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

 



On Mon, Mar 08, 2021 at 09:27:57AM -0800, Junio C Hamano wrote:
> >> git push origin
>
> >>     Without additional configuration, pushes the current branch
> >>     to the configured upstream (remote.origin.merge configuration
> >>     variable) if it has the same name as the current branch, and
> >>     errors out without pushing otherwise.
>
> Hmph, it seems it talks about the branch on the remote side that is
> configured for the current branch to integrate with.  Most likely
> that is misspelt "branch.<name>.merge" where <name> is the name of
> the branch currently checked out.

I agree; this should definitely refer to "branch.<name>.merge", not
"remote.<name>.merge" (which to my knowledge has never existed).

I had to double check that this "without additional configuration" is
right. Indeed:

  - The default value of the 'push.default' variable is "simple", which
    in a non-triangular workflow calls
    "builtin/push.c:setup_push_upstream()".

  - 'setup_push_upstream()' dies on L213 if strcmp(branch->refname,
    branch->merge[0]->src).

  - Othewrise, it sets up the expected refspec (to push the local branch
    to the remote branch 'branch.<name>.merge').

> The text comes from b2ed944a (push: switch default from "matching"
> to "simple", 2013-01-04); I am a bit surprised how such a typo
> survived this long ;-)

Me too :). Here's a patch to rectify the confusion:

--- >8 ---

Subject: [PATCH] Documentation/git-push.txt: correct configuration typo

In the EXAMPLES section, git-push(1) says that 'git push origin' pushes
the current branch to the value of the 'remote.origin.merge'
configuration.

This wording (which dates back to b2ed944af7 (push: switch default from
"matching" to "simple", 2013-01-04)) is incorrect. There is no such
configuration as 'remote.<name>.merge'. This likely was originally
intended to read "branch.<name>.merge" instead.

Indeed, when 'push.default' is 'simple' (which is the default value, and
is applicable in this scenario per "without additional configuration"),
setup_push_upstream() dies if the branch's local name does not match
'branch.<name>.merge'.

Correct this long-standing typo to resolve some recent confusion on the
intended behavior of this example.

Reported-by: Adam Sharafeddine <adam.shrfdn@xxxxxxxxx>
Reported-by: Fabien Terrani <terranifabien@xxxxxxxxx>
Signed-off-by: Taylor Blau <me@xxxxxxxxxxxx>
---
 Documentation/git-push.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index ab103c82cf..a953c7c387 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -600,7 +600,7 @@ EXAMPLES

 `git push origin`::
 	Without additional configuration, pushes the current branch to
-	the configured upstream (`remote.origin.merge` configuration
+	the configured upstream (`branch.<name>.merge` configuration
 	variable) if it has the same name as the current branch, and
 	errors out without pushing otherwise.
 +
--
2.30.0.667.g81c0cbc6fd




[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