git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] config/branch: state that <name>.merge is the remote ref
@ 2019-10-16 11:28 Philip Oakley
  2019-10-18  1:32 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Philip Oakley @ 2019-10-16 11:28 UTC (permalink / raw)
  To: GitList; +Cc: Philip Oakley

The branch.<name>.merge value typically looks just like a
local ref. Tell the reader it is the ref name at the remote,
which may be different.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
---

This confusion had me scratching my head for many minutes recently.
A simple clarification would avoid such mental model errors.

 Documentation/config/branch.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/config/branch.txt b/Documentation/config/branch.txt
index a592d522a7..3bfe4f81d3 100644
--- a/Documentation/config/branch.txt
+++ b/Documentation/config/branch.txt
@@ -53,7 +53,9 @@ branch.<name>.pushRemote::
 
 branch.<name>.merge::
 	Defines, together with branch.<name>.remote, the upstream branch
-	for the given branch. It tells 'git fetch'/'git pull'/'git rebase' which
+	for the given branch. It defines the branch name _on the remote_,
+	which may be different from the local branch name.
+	It tells 'git fetch'/'git pull'/'git rebase' which
 	branch to merge and can also affect 'git push' (see push.default).
 	When in branch <name>, it tells 'git fetch' the default
 	refspec to be marked for merging in FETCH_HEAD. The value is
-- 
2.23.0.windows.1.21.g947f504ebe8.dirty


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] config/branch: state that <name>.merge is the remote ref
  2019-10-16 11:28 [PATCH v1] config/branch: state that <name>.merge is the remote ref Philip Oakley
@ 2019-10-18  1:32 ` Junio C Hamano
  2019-10-18 20:53   ` Philip Oakley
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2019-10-18  1:32 UTC (permalink / raw)
  To: Philip Oakley; +Cc: GitList

Philip Oakley <philipoakley@iee.email> writes:

>  branch.<name>.merge::
>  	Defines, together with branch.<name>.remote, the upstream branch
> -	for the given branch. It tells 'git fetch'/'git pull'/'git rebase' which
> +	for the given branch. It defines the branch name _on the remote_,
> +	which may be different from the local branch name.

While I do agree with the goal of make things more clear, I'd avoid
being overly redundant and giving irrelevant information (e.g. the
copy you have locally may be made under arbitrary name that is
different from the name used at the remote).  After all, the users
do not even need to know about the remote-tracking branch to
understand this naming mechanism.

Perhaps something along this line instead:

    The name of the branch at the remote `branch.<name>.remote` that
    is used as the upstream branch for the given branch.  It tells
    `git fetch`, etc., which branch to merge and ...


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] config/branch: state that <name>.merge is the remote ref
  2019-10-18  1:32 ` Junio C Hamano
@ 2019-10-18 20:53   ` Philip Oakley
  2019-10-18 20:59     ` [PATCH v2] " Philip Oakley
  2019-10-18 23:11     ` [PATCH v1] " Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: Philip Oakley @ 2019-10-18 20:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GitList

Hi Junio,

On 18/10/2019 02:32, Junio C Hamano wrote:
> Philip Oakley <philipoakley@iee.email> writes:
>
>>   branch.<name>.merge::
>>   	Defines, together with branch.<name>.remote, the upstream branch
>> -	for the given branch. It tells 'git fetch'/'git pull'/'git rebase' which
>> +	for the given branch. It defines the branch name _on the remote_,
>> +	which may be different from the local branch name.
> While I do agree with the goal of make things more clear, I'd avoid
> being overly redundant and giving irrelevant information (e.g. the
> copy you have locally may be made under arbitrary name that is
> different from the name used at the remote).  After all, the users
> do not even need to know about the remote-tracking branch to
> understand this naming mechanism.
I'd argue that the user has to know about the branch <name> to even get 
here,
and that the key value can be confusing (been there!), so improving the 
understanding
was the aim.

That said, tedious repetition should be avoided, so I'll look to reword 
it while still retaining the emphasis. Perhaps:

branch.<name>.merge::
     Defines, for the local branch <name>, the upstream branch ref
     _on the remote_ (as given by branch.<name>.remote).
     The upstream ref may be different from the local branch ref.

optionally s/different from/ same as/ ?

>
> Perhaps something along this line instead:
>
>      The name of the branch at the remote `branch.<name>.remote` that
>      is used as the upstream branch for the given branch.  It tells
>      `git fetch`, etc., which branch to merge and ...
>
If this, should we also say it (the key value) is that of the upstream 
branch _ref_?

Hmm, *thinks*, I think I'm being swayed by your version. Update to follow.

Philip

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] config/branch: state that <name>.merge is the remote ref
  2019-10-18 20:53   ` Philip Oakley
@ 2019-10-18 20:59     ` Philip Oakley
  2019-10-18 23:11     ` [PATCH v1] " Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Philip Oakley @ 2019-10-18 20:59 UTC (permalink / raw)
  To: GitList, Junio C Hamano; +Cc: Philip Oakley

The branch.<name>.merge value typically looks just like a
local ref. Tell the reader it is the ref name at the remote,
which may be different.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
---
 Documentation/config/branch.txt | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/config/branch.txt b/Documentation/config/branch.txt
index a592d522a7..cdc19edaaf 100644
--- a/Documentation/config/branch.txt
+++ b/Documentation/config/branch.txt
@@ -52,8 +52,10 @@ branch.<name>.pushRemote::
 	option to override it for a specific branch.
 
 branch.<name>.merge::
-	Defines, together with branch.<name>.remote, the upstream branch
-	for the given branch. It tells 'git fetch'/'git pull'/'git rebase' which
+	The name of the branch ref at the remote `branch.<name>.remote`
+	that is used as the upstream branch for the given branch <name>.
++
+	It tells 'git fetch'/'git pull'/'git rebase' which
 	branch to merge and can also affect 'git push' (see push.default).
 	When in branch <name>, it tells 'git fetch' the default
 	refspec to be marked for merging in FETCH_HEAD. The value is
-- 
2.23.0.windows.1.21.g947f504ebe8.dirty


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] config/branch: state that <name>.merge is the remote ref
  2019-10-18 20:53   ` Philip Oakley
  2019-10-18 20:59     ` [PATCH v2] " Philip Oakley
@ 2019-10-18 23:11     ` Junio C Hamano
  2019-10-19 15:19       ` Philip Oakley
  1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2019-10-18 23:11 UTC (permalink / raw)
  To: Philip Oakley; +Cc: GitList

Philip Oakley <philipoakley@iee.email> writes:

> branch.<name>.merge::
>     Defines, for the local branch <name>, the upstream branch ref
>     _on the remote_ (as given by branch.<name>.remote).
>     The upstream ref may be different from the local branch ref.
>
> optionally s/different from/ same as/ ?

That "optionally" part is exactly why I said "upstream and remote
tracking names may or may not differ is irrelevant information".

>>      The name of the branch at the remote `branch.<name>.remote` that
>>      is used as the upstream branch for the given branch.  It tells
>>      `git fetch`, etc., which branch to merge and ...
>>
> If this, should we also say it (the key value) is that of the upstream
> branch _ref_?

Yeah, that makes it clear that readers should not write "master" and
use "refs/heads/master" instead.  It may even be more (technically)
correct to say just "ref" without branch (this ref does not have to
be a branch at the remote repository at all).  I am not sure if we
want to go that far to make it more correct and also make it hint
that using a non-branch ref is a valid configuration to readers, but
I agree it is a good idea to avoid saying "name" (which implies
that "master" is OK, which is not).

Thanks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] config/branch: state that <name>.merge is the remote ref
  2019-10-18 23:11     ` [PATCH v1] " Junio C Hamano
@ 2019-10-19 15:19       ` Philip Oakley
  0 siblings, 0 replies; 6+ messages in thread
From: Philip Oakley @ 2019-10-19 15:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GitList

Hi Junio,
On 19/10/2019 00:11, Junio C Hamano wrote:
> Philip Oakley <philipoakley@iee.email> writes:
>
>> branch.<name>.merge::
>>      Defines, for the local branch <name>, the upstream branch ref
>>      _on the remote_ (as given by branch.<name>.remote).
>>      The upstream ref may be different from the local branch ref.
>>
>> optionally s/different from/ same as/ ?
> That "optionally" part is exactly why I said "upstream and remote
> tracking names may or may not differ is irrelevant information".
I think we misunderstand each other again. That very potential 
difference, no matter which way described, was the point at hand - that 
is we are talking about refs at different places.

If we have (quite typically) that merge config indicating that we wish 
to merge refs/heads/master with refs/heads/master then it looks like a 
no-op. They are both the same ref (by name / character sequence). 
Without the extra knowledge that one is local and the other is remote 
then the mental model confusion in the reader continues. The 
'optionally' offer was about choosing the best way of coercing the 
reader into considering the alternate viewpoint. Sometime things  need 
to explained both ways, so that at least one will register.

It could be argued that the merge ref should have been 
`refs/remotes/origin/master` (for that typical following case), but it 
isn't (IIUC because of historic backward compatibility), which would 
have at least avoided the local  v remote conundrum.

All that said, I ended up going with your suggested text anyway ;-)
>>>       The name of the branch at the remote `branch.<name>.remote` that
>>>       is used as the upstream branch for the given branch.  It tells
>>>       `git fetch`, etc., which branch to merge and ...
>>>
>> If this, should we also say it (the key value) is that of the upstream
>> branch _ref_?
> Yeah, that makes it clear that readers should not write "master" and
> use "refs/heads/master" instead.  It may even be more (technically)
> correct to say just "ref" without branch (this ref does not have to
> be a branch at the remote repository at all).  I am not sure if we
> want to go that far to make it more correct and also make it hint
> that using a non-branch ref is a valid configuration to readers, but
> I agree it is a good idea to avoid saying "name" (which implies
> that "master" is OK, which is not).
I'd agree. I'll think about the simplified ref comment.

P.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-19 15:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 11:28 [PATCH v1] config/branch: state that <name>.merge is the remote ref Philip Oakley
2019-10-18  1:32 ` Junio C Hamano
2019-10-18 20:53   ` Philip Oakley
2019-10-18 20:59     ` [PATCH v2] " Philip Oakley
2019-10-18 23:11     ` [PATCH v1] " Junio C Hamano
2019-10-19 15:19       ` Philip Oakley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).