From: Junio C Hamano <gitster@pobox.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org, Nicolas Pitre <nico@cam.org>,
Julian Phillips <julian@quantumfyre.co.uk>,
Daniel Barkalow <barkalow@iabervon.org>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [RFC PATCH] upload-pack: expand capability advertises additional refs
Date: Fri, 28 Aug 2009 12:07:21 -0700 [thread overview]
Message-ID: <7vr5uvlpue.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20090828173007.GX1033@spearce.org> (Shawn O. Pearce's message of "Fri\, 28 Aug 2009 10\:30\:07 -0700")
"Shawn O. Pearce" <spearce@spearce.org> writes:
> static void upload_pack(void)
> {
> + git_config(upload_pack_config, NULL);
> + if (!configured_advertise)
> + push_advertise("refs/*");
> +
> + head_ref(scan_ref, NULL);
> + for_each_ref(scan_ref, NULL);
> +
> reset_timeout();
> - head_ref(send_ref, NULL);
> - for_each_ref(send_ref, NULL);
> - packet_flush(1);
> + send_refs();
> receive_needs();
> if (want_obj.nr) {
> get_common_commits();
> @@ -652,6 +764,7 @@ int main(int argc, char **argv)
>
> git_extract_argv0_path(argv[0]);
> read_replace_refs = 0;
> + push_advertise("HEAD");
>
> for (i = 1; i < argc; i++) {
> char *arg = argv[i];
> @@ -667,6 +780,10 @@ int main(int argc, char **argv)
> daemon_mode = 1;
> continue;
> }
> + if (!prefixcmp(arg, "--expand=")) {
> + push_advertise(arg + 9);
> + continue;
> + }
> if (!strcmp(arg, "--")) {
> i++;
> break;
This arrangement of push_advertise() calls are rather curious. I think
your design guidelines are:
- We do want to advertise HEAD, so it can (and should) be unconditional;
- We may want to restrict with configuration, or use "refs/*" as the
fallback default;
- We may want to (extend|replace) advertised set configured in the
configuration file.
I would naively expect the above to be implemented in this order:
- In main, first thing is to do the git_config() bit; if to_advertise is
non-empty after git_config() returns, we have seen upload.advertise.
Otherwise we haven't. Push "refs/*" in the latter case.
- Then, parse the command line. Do we see "--expand="? If so:
. When handling the first "--expand=", clear to_advertise list. This
step is optional---necessary only if we want to make config variable
override-able ;-);
. Then, push the pattern in.
- And finally push "HEAD" in unconditionally.
Which would mean a few things:
- Your version always extends what is read from the configuration with
--expand=, but I think replacing would be the right thing to do.
- configured_advertise global variable can go.
- Instead, to implement "--expand= replaces", we need a local variable in
main() to remember if we already cleared to_advertise of the patterns
read from the configuration file, and use it in the part that parses
"--expand=".
But I may not be thinking clearly; I was up all night because I couldn't
sleep under loud noises of fire-fighting helicopters...
prev parent reply other threads:[~2009-08-28 19:08 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-22 5:52 git fetch --depth=* broken? Nicolas Pitre
2009-08-24 4:04 ` [PATCH] fix simple deepening of a repo Nicolas Pitre
2009-08-24 4:49 ` Junio C Hamano
2009-08-24 13:55 ` Nicolas Pitre
2009-08-24 14:20 ` Johan Herland
2009-08-24 22:21 ` Junio C Hamano
2009-08-24 16:26 ` Daniel Barkalow
2009-08-24 22:30 ` Julian Phillips
2009-08-25 0:18 ` Nicolas Pitre
2009-08-25 2:12 ` Shawn O. Pearce
2009-08-25 5:00 ` Sverre Rabbelier
2009-08-25 5:21 ` Junio C Hamano
2009-08-25 6:12 ` Shawn O. Pearce
2009-08-25 6:33 ` Junio C Hamano
2009-08-25 15:14 ` Shawn O. Pearce
2009-08-26 2:10 ` Shawn O. Pearce
2009-08-26 7:08 ` Johannes Sixt
2009-08-26 8:22 ` Shawn O. Pearce
2009-08-26 9:03 ` Junio C Hamano
2009-08-26 17:03 ` Shawn O. Pearce
2009-08-28 17:30 ` [RFC PATCH] upload-pack: expand capability advertises additional refs Shawn O. Pearce
2009-08-28 19:07 ` Junio C Hamano [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=7vr5uvlpue.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=julian@quantumfyre.co.uk \
--cc=nico@cam.org \
--cc=spearce@spearce.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).