git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: Proposal: branch.<name>.remotepush
Date: Thu, 7 Feb 2013 23:48:36 -0500	[thread overview]
Message-ID: <20130208044836.GC4157@sigill.intra.peff.net> (raw)
In-Reply-To: <CALkWK0nA4hQ0VWivk3AVVVq8Rbb-9CpQ9xFsSOsTQtvo4w08rw@mail.gmail.com>

On Thu, Feb 07, 2013 at 09:44:59PM +0530, Ramkumar Ramachandra wrote:

> This has been annoying me for a really long time, but I never really
> got around to scratching this particular itch.  I have a very common
> scenario where I fork a project on GitHub.  I have two configured
> remotes: origin which points to "git://upstream" and mine which points
> to "ssh://mine".  By default, I always want to pull `master` from
> origin and push to mine.

Same here. Even without GitHub, working on git.git I treat Junio as my
"origin", but push to a publishing point.

> Unfortunately, there's only a branch.<name>.remote which specifies
> which remote to use for both pulling and pushing.  There's also a
> remote.<name>.pushurl, but I get the feeling that this exists for an
> entirely different reason: when I have a server with a
> highly-available read-only mirror of the repository at
> git://anongit.*, and a less-available committer-only mirror at
> ssh://*.

Yeah, you don't want to use pushurl. It makes the assumption that you
are pushing to the same remote, so when you, e.g., push to the remote's
refs/heads/master, it will update refs/remotes/origin/master. But that's
not right; that ref should be tracking the true origin, not what you
pushed to.

> How about a branch.<name>.remotepush that specifies a special remote
> for pushing, falling back to branch.<name>.remote?

Sure, though I wonder if you really want a per-branch config, or if you
just want remote.pushDefault or similar, so that you do not have to
configure each branch independently as you create it. I'm imagining
lookup rules something like:

  1. If we are on branch $b, check branch.$b.pushRemote.

  2. If not set, check remote.pushDefault.

  3. If not set, check branch.$b.remote.

  4. If not set, check remote.default (there was a proposal for this a
     few months ago, but it got stalled).

  5. If not set, use "origin".

And then fetching could do the same, with s/push/fetch/. In both cases,
if you are not using the new variables, the behavior is the same as
the current behavior.

-Peff

  parent reply	other threads:[~2013-02-08  4:49 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-07 16:14 Proposal: branch.<name>.remotepush Ramkumar Ramachandra
2013-02-07 17:45 ` Michael Schubert
2013-02-07 19:37   ` Ramkumar Ramachandra
2013-02-07 19:49     ` Ramkumar Ramachandra
2013-02-07 20:14       ` Ramkumar Ramachandra
2013-02-07 23:30     ` Jonathan Nieder
2013-02-07 23:41       ` Junio C Hamano
2013-02-08  7:48         ` Jonathan Nieder
2013-02-08  8:16           ` Junio C Hamano
2013-02-08 10:38             ` Michael J Gruber
2013-02-08 17:11               ` Junio C Hamano
2013-02-08 17:16               ` Junio C Hamano
2013-02-08 18:29                 ` Ramkumar Ramachandra
2013-02-08 19:13                   ` Junio C Hamano
2013-02-08 18:36               ` Jonathan Nieder
2013-02-08 18:42       ` Ramkumar Ramachandra
2013-02-08 19:18         ` Junio C Hamano
2013-02-09  7:29           ` Ramkumar Ramachandra
2013-02-08  4:48 ` Jeff King [this message]
2013-02-08  6:08   ` Junio C Hamano
2013-02-08  6:28     ` Jeff King
2013-02-08  6:45     ` Junio C Hamano
2013-02-08  9:22       ` Jeff King
2013-02-08 17:06         ` Junio C Hamano
2013-02-08 18:03           ` Ramkumar Ramachandra

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=20130208044836.GC4157@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /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).