From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Ramkumar Ramachandra <artagnon@gmail.com>,
Git List <git@vger.kernel.org>
Subject: Re: [PATCH 3/3] remote: introduce and fill branch->pushremote
Date: Mon, 13 Jan 2014 15:27:30 -0500 [thread overview]
Message-ID: <20140113202730.GA32542@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqtxd763lf.fsf@gitster.dls.corp.google.com>
On Mon, Jan 13, 2014 at 12:15:08PM -0800, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > It does not matter for actually pushing, because to do a non-default
> > push, you must always specify a remote. But "@{publish}" will ask the
> > question "even if I am on 'side' now, what would happen if I were to
> > default-push on 'master'?".
>
> In a similar wording to yours, it can be said that B@{upstream} is
> "what would happen if I were to default-pull on 'B'?".
Right. I wondered at first if there was a similar bug in @{upstream},
but as I noted earlier, it is not defined if a per-branch remote is not
set. The answer to your question above is "nothing", so we do not have
to worry about it. :)
> A related tangent is what should B@{publish} should yield when there
> is no triangular configuration variables like remote.pushdefault,
> branch.B.pushremote and a possible future extension branch.B.push
> are defined. The definition you gave, i.e. "if I were to
> default-push", gives a good guideline, I think.
Yes, that is what I tried for with my original patches. (e.g.,
"push.default=upstream" should just make @{publish} a synonym for
@{upstream}, which is what my patch did). I punted on "simple", but it
would ideally do the same thing as "push". Which is why I do not think
my patches are appropriate as-is; they need to somehow share the logic
with "git push" rather than try to reimplement it.
> I.e. "git push origin master" does tell us to push out 'master', but
> it does not explicitly say what ref to update. It may be set to
> update their remotes/satellite/master when we are emulating a fetch
> in reverse by pushing, via e.g.
>
> [remote "origin"]
> push = refs/heads/master:refs/remotes/satellite/master
>
> and it would be intuitive if we make "master@{publish}" resolve to
> "refs/remotes/satellite/master" in such a case.
Right. And my patches did that (or at least I intended them to :) ) by
applying the push refspec (if any), and then applying the fetch refspec
on top of that. But again, that seems like policy that should be shared
with "git push".
That being said, I do not think your example is the best one for
@{publish}. You have not specified any remote at all. I think the
closest "push" behavior for @{publish} would be something like:
git checkout master && git push
I.e., where would _that_ push go?
> One thing that makes things a bit fuzzy is what should happen if
> you have more than one push destinations. For example:
>
> [remote "home"]
> pushurl = ...
> push = refs/heads/master:refs/remotes/satellite/master
>
> [remote "github"]
> pushurl = ...
> mirror
>
> [remote]
> pushdefault = ???
>
> "git push home" updates their 'refs/remotes/satellite/master' with
> my 'master' with the above, while "git push github" will update
> their 'refs/heads/master' with 'master'.
>
> We can say master@{publish} is 'remotes/satellite/master' if
> remote.pushdefault (or 'branch.master.pushremote") is set to 'home',
> it is 'master' if it is 'github', and if "git push" while sitting on
> 'master' does not push it anywhere then master@{publish} is an
> error. There may be a better definition of what "if I were to
> default-push" really means, but I don't think of any offhand.
Exactly. I do not think the multiple push destinations matter here,
because it is always "what would I do if I were on the branch". At most
one of them can be the default in that case (based on the config as you
noted).
-Peff
prev parent reply other threads:[~2014-01-13 20:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-12 17:11 [PATCH 0/3] Minor preparation for @{publish} Ramkumar Ramachandra
2014-01-12 17:11 ` [PATCH 1/3] t1507 (rev-parse-upstream): fix typo in test title Ramkumar Ramachandra
2014-01-12 17:11 ` [PATCH 2/3] interpret_branch_name: factor out upstream handling Ramkumar Ramachandra
2014-01-12 17:11 ` [PATCH 3/3] remote: introduce and fill branch->pushremote Ramkumar Ramachandra
2014-01-13 8:34 ` Jeff King
2014-01-13 11:22 ` Ramkumar Ramachandra
2014-01-13 18:59 ` Jeff King
2014-01-13 20:15 ` Junio C Hamano
2014-01-13 20:27 ` Jeff King [this message]
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=20140113202730.GA32542@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).