From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: spearce@spearce.org, Daniel Barkalow <barkalow@iabervon.org>,
git@vger.kernel.org
Subject: Re: [PATCH v3 2/2] fetch/push: readd rsync support
Date: Sat, 29 Sep 2007 23:09:52 -0700 [thread overview]
Message-ID: <7vhclciszz.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0709290134000.28395@racer.site> (Johannes Schindelin's message of "Sat, 29 Sep 2007 01:35:06 +0100 (BST)")
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> We lost rsync support when transitioning from shell to C. Support it
> again (even if the transport is technically deprecated, some people just
> do not have any chance to use anything else).
s/chance/choice/?
> +test "$TEST_RSYNC" && {
Somehow this feels dirty ... perhaps leave early like:
if test -z "$TEST_RSYNC"
then
test_expect_success 'skipping rsync transport tests' :
test_done
exit
fi
> diff --git a/transport.c b/transport.c
> index 4f9cddc..a2ee8f3 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -6,6 +6,330 @@
> ...
> +{
> + struct strbuf buf = STRBUF_INIT, temp_dir = STRBUF_INIT;
> + struct ref dummy, *tail = &dummy;
> + struct child_process rsync;
> + const char *args[5];
> + int temp_dir_len;
> +
> + /* copy the refs to the temporary directory */
> +
> + strbuf_addstr(&temp_dir, git_path("rsync-refs-XXXXXX"));
> + if (!mkdtemp(temp_dir.buf))
> + die ("Could not make temporary directory");
I wonder how portable mkdtemp() is (it does not seem to be POSIX);
would we need something in compat/ perhaps based on tempnam()?
> +static int fetch_objs_via_rsync(struct transport *transport,
> + int nr_objs, struct ref **to_fetch)
> +{
> + struct strbuf buf = STRBUF_INIT;
> + struct child_process rsync;
> + const char *args[8];
> + int result;
> +
> + strbuf_addstr(&buf, transport->url);
> + strbuf_addstr(&buf, "/objects/");
> +
> + memset(&rsync, 0, sizeof(rsync));
> + rsync.argv = args;
> + rsync.stdout_to_stderr = 1;
> + args[0] = "rsync";
> + args[1] = transport->verbose ? "-rv" : "-r";
> + args[2] = "--ignore-existing";
> + args[3] = "--exclude";
> + args[4] = "info";
> + args[5] = buf.buf;
> + args[6] = get_object_directory();
> + args[7] = NULL;
Hmm, we used to do "rsync $remote/objects/ $our/.git/objects/",
but this omits the trailing "/" from our side. I suspect the
reason was to deal with the case where our .git/objects was a
symlink to elsewhere (which was how you did alternates before
alternates was invented), which may not matter anymore these
days.
next prev parent reply other threads:[~2007-09-30 6:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-28 5:06 [PATCH 0/2] rsync support Johannes Schindelin
2007-09-28 5:06 ` [PATCH 1/2] Introduce remove_dir_recursively() Johannes Schindelin
2007-09-28 9:05 ` Junio C Hamano
2007-09-28 12:35 ` Johannes Schindelin
2007-09-28 22:14 ` David Kastrup
2007-09-28 5:07 ` [PATCH 2/2] fetch/push: readd rsync support Johannes Schindelin
2007-09-28 5:20 ` Shawn O. Pearce
2007-09-28 12:22 ` Johannes Schindelin
2007-09-28 9:30 ` Junio C Hamano
2007-09-28 12:53 ` Johannes Schindelin
2007-09-28 15:28 ` [PATCH v2 0/2] rsync support, was Re: [PATCH 0/2] " Johannes Schindelin
2007-09-28 15:28 ` [PATCH v2 1/2] Introduce remove_dir_recursively() Johannes Schindelin
2007-09-28 15:29 ` [PATCH 2/2] fetch/push: readd rsync support Johannes Schindelin
2007-09-28 15:30 ` Johannes Schindelin
2007-09-28 21:20 ` Junio C Hamano
2007-09-28 22:48 ` Johannes Schindelin
2007-09-29 0:35 ` [PATCH v3 " Johannes Schindelin
2007-09-30 6:09 ` Junio C Hamano [this message]
2007-09-30 12:58 ` Johannes Schindelin
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=7vhclciszz.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=barkalow@iabervon.org \
--cc=git@vger.kernel.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).