From: Jonathan Nieder <jrnieder@gmail.com>
To: Sverre Rabbelier <srabbelier@gmail.com>
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
Git List <git@vger.kernel.org>,
Ilari Liusvaara <ilari.liusvaara@elisanet.fi>,
Daniel Barkalow <barkalow@iabervon.org>,
Ramkumar Ramachandra <artagnon@gmail.com>
Subject: Re: remote-helpers: http-push protocol
Date: Tue, 7 Sep 2010 17:14:01 -0500 [thread overview]
Message-ID: <20100907221401.GA29102@capella.cs.uchicago.edu> (raw)
In-Reply-To: <AANLkTim=HKiQ-25QEAPPRcH6wwLLAsDdoRqTsanM67SK@mail.gmail.com>
Hi,
Here's a know-nothing view (and I assume you have already done this
legwork; just summarizing for myself). Following along in do_push().
Sverre Rabbelier wrote:
> When fetching from the remote, the helper is called with 'list',
get_ref_map() -> transport_get_remote_refs() ->
transport::get_refs_list()
[...]
> What happens next is the part that confuses me, a certain set of refs
> is pushed, by calling the helper with 'push <refspec>'.
The transport_push() codepath in transport.c. For remote helpers, it
relies on the push_refs() method, calling:
- transport::get_refs_list() to get the list of remote refs
- get_local_heads() for the local refs
- match_refs() to list remote refs matching the refspec/--all/
--mirror
- transport::push_refs() to push the list of refs chosen
- transport_print_push_status() for a nice message
- set_upstreams() to handle --set-upstream requests
- transport_update_tracking_ref() to update the local remote-tracking
refs.
> I am unclear
> how this set of refs is chosen
remote.c's match_refs() calls:
- parse_push_refspec() to convert the refspec strings to
structs refspec, separating src, dest, and +/*/no-dest-specified
flags
- match_explicit_refs() to build a linked list of struct ref
explicitly requested with non-wildcard refspecs (the easy ones)
- check_pattern_match() for each remote ref, to figure out which
refspec, if any, it corresponds to. If any:
- Refs outside the refs/heads/ hierarchy are excluded (unless
--mirror as used) when not named by a refspec, as you mentioned.
- Where actual refspecs are concerned, though, they can match.
- A local peer is determined with find_ref_by_name().
- Enforces the "push matching" rule: do not push a new branch
unless it was explicitly requested by naming it, --all, or
--mirror.
> I see that only refs that have a
> peer_ref are sent, unless mirror is also set (I don't think I
> understand the significance)?
$ git log -S'"matching refs"; traditionally we pushed everything' remote.c
commit 098e711e6c0d123dff2f38d6b804ec632ad7dd78
Author: Junio C Hamano <gitster@pobox.com>
Date: Sun Jul 1 19:00:08 2007 -0700
"git-push $URL" without refspecs pushes only matching branches
When "git push" is run without any refspec (neither on the
command line nor in the config), we used to push "matching refs"
in the sense that anything under refs/ hierarchy that exist on
both ends were updated. This used to be a sane default for
publishing your repository to another back when we did not have
refs/remotes/ hierarchy, but it does not make much sense these
days.
This changes the semantics to push only "matching branches".
So I suspect this is to ensure that with "[push] default = matching",
$ git push
pushes branches and not remote-tracking refs, but
$ git push --mirror
pushes everything.
> After the push, the helper write a set
> of 'ok/error' messages sometimes for refs that were not asked to be
> pushed in the first place
Part of transport::push_refs(). I think it only allows status
messages for refs that were actually pushed; otherwise it will print
warning: helper reported unexpected status of <ref>
> Can you clarify the behavior I described? How can I best hook into the
> 'refs that need to be pushed selection' in the 'export' command [0]?
Hmm --- do you want some other hierarchy than refs/heads/* for the
"push matching" rule?
Thanks for the nice introduction.
prev parent reply other threads:[~2010-09-07 22:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-29 4:57 remote-helpers: http-push protocol Sverre Rabbelier
2010-09-07 22:14 ` Jonathan Nieder [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=20100907221401.GA29102@capella.cs.uchicago.edu \
--to=jrnieder@gmail.com \
--cc=artagnon@gmail.com \
--cc=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=ilari.liusvaara@elisanet.fi \
--cc=spearce@spearce.org \
--cc=srabbelier@gmail.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).