git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Leandro Lucarella <leandro.lucarella@sociomantic.com>,
	git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: branch.<name>.pushremote not working with push.default simple or upstream
Date: Fri, 07 Jun 2013 08:47:59 -0700	[thread overview]
Message-ID: <7v8v2lvs5s.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CALkWK0miONv_O67SHcfJoXq1x7xPvKu6uefg+TiPGbF-1WJ-bg@mail.gmail.com> (Ramkumar Ramachandra's message of "Fri, 7 Jun 2013 19:41:07 +0530")

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> [+CC: jc, jk]
>
> Leandro Lucarella wrote:
>> I changed branch.master.remote to upstream and set
>> branch.master.pushremote to origin, but when I do I git push I get an
>> error:
>>
>> $ git push --dry-run --verbose
>> fatal: You are pushing to remote 'origin', which is not the upstream of
>> your current branch 'master', without telling me what to push
>> to update which remote branch.
>
> Yes, this is a defect: both remote.pushdefault and
> branch.<name>.pushremote suffer from it.

The upstream and simple modes have been defined to push to
"upstream" repository in central-shared-repository workflow.

At this point in Leandro's example, I think the configuration is:

	[branch "master"]
		remote = upstream
                merge = refs/heads/master
                pushremote = origin

and master@{u} == upstream's master, not origin's.

This shows the "triangular" support in 1.8.3 is only half-finished;
the other half was discussed a few weeks ago ($gmane/224604), but I
do not recall what the current status of the topic is.  I personally
think 'single' the root level of the thread hints is an overkill
mechanism, so here is a suggestion to show one possible way forward.

Until the branch.$name.push mechanism is introduced to specify which
destination branch is updated by the push, and/or branch.$name.push
is not specified after such a mechanism is introduced, I think the
natural extension of the current end-user configuration would be to
redefine "upstream" mode to push to update the branch with the same
name (in the above example, 'master' of 'origin' is updated), when
the "repository that is pushed to, which is different from the
repository that is fetched from" is specified via remote.pushdefault
or branch.$name.pushremote mechanisms.

This incidentally covers "simple" mode, because "pushing to update
the branch with the same name" is the only behaviour accepted by the
mode anyway.

When branch.$name.push mechanism is introduced and the user uses it,
then "upstream", "simple", or any other setting for that matter
would be ignored.  With

	[branch "master"]
		remote = upstream
                merge = refs/heads/master
                pushremote = origin
		push = refs/heads/master

it is clear that "git push" while on 'master' should push to origin
to update its master branch.

  reply	other threads:[~2013-06-07 15:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-07 12:41 branch.<name>.pushremote not working with push.default simple or upstream Leandro Lucarella
2013-06-07 14:11 ` Ramkumar Ramachandra
2013-06-07 15:47   ` Junio C Hamano [this message]
2013-06-07 16:14     ` Leandro Lucarella
2013-06-07 16:57       ` Ramkumar Ramachandra
2013-06-07 17:07         ` Leandro Lucarella
2013-06-07 17:33           ` Ramkumar Ramachandra
2013-06-07 16:51     ` Ramkumar Ramachandra
2013-06-07 18:34       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v8v2lvs5s.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=leandro.lucarella@sociomantic.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).