git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsayjones.plus.com>
To: Jeff Hostetler <git@jeffhostetler.com>, git@vger.kernel.org
Cc: gitster@pobox.com, peff@peff.net, jonathantanmy@google.com
Subject: Re: [PATCH v4 07/10] introduce fetch-object: fetch one promisor object
Date: Thu, 16 Nov 2017 19:57:19 +0000	[thread overview]
Message-ID: <e7b5e42f-b13c-50c8-501c-0100d8c48d00@ramsayjones.plus.com> (raw)
In-Reply-To: <20171116181257.61673-8-git@jeffhostetler.com>



On 16/11/17 18:12, Jeff Hostetler wrote:
> From: Jonathan Tan <jonathantanmy@google.com>
> 
> Introduce fetch-object, providing the ability to fetch one object from a
> promisor remote.
> 
> This uses fetch-pack. To do this, the transport mechanism has been
> updated with 2 flags, "from-promisor" to indicate that the resulting
> pack comes from a promisor remote (and thus should be annotated as such
> by index-pack), and "no-haves" to suppress the sending of "have" lines.
> 
> This will be tested in a subsequent commit.
> 
> NEEDSWORK: update this when we have more information about protocol v2,
> which should allow a way to suppress the ref advertisement and
> officially allow any object type to be "want"-ed.
> 
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
>  Documentation/gitremote-helpers.txt |  6 ++++++
>  Makefile                            |  1 +
>  builtin/fetch-pack.c                |  8 ++++++++
>  builtin/index-pack.c                | 16 +++++++++++++---
>  fetch-object.c                      | 23 +++++++++++++++++++++++
>  fetch-object.h                      |  6 ++++++
>  fetch-pack.c                        |  8 ++++++--
>  fetch-pack.h                        |  2 ++
>  remote-curl.c                       | 14 +++++++++++++-
>  transport.c                         |  8 ++++++++
>  transport.h                         |  8 ++++++++
>  11 files changed, 94 insertions(+), 6 deletions(-)
>  create mode 100644 fetch-object.c
>  create mode 100644 fetch-object.h
> 
[snip]
> diff --git a/fetch-object.c b/fetch-object.c
> new file mode 100644
> index 0000000..f89dbba
> --- /dev/null
> +++ b/fetch-object.c
> @@ -0,0 +1,23 @@
> +#include "cache.h"
> +#include "packfile.h"
> +#include "pkt-line.h"
> +#include "strbuf.h"
> +#include "transport.h"

I note that this still does not #include "fetch_object.h".
[If you recall, this suppresses a sparse warning].

> +
> +void fetch_object(const char *remote_name, const unsigned char *sha1)
> +{
> +	struct remote *remote;
> +	struct transport *transport;
> +	struct ref *ref;
> +
> +	remote = remote_get(remote_name);
> +	if (!remote->url[0])
> +		die(_("Remote with no URL"));
> +	transport = transport_get(remote, remote->url[0]);
> +
> +	ref = alloc_ref(sha1_to_hex(sha1));
> +	hashcpy(ref->old_oid.hash, sha1);
> +	transport_set_option(transport, TRANS_OPT_FROM_PROMISOR, "1");
> +	transport_set_option(transport, TRANS_OPT_NO_HAVES, "1");
> +	transport_fetch_refs(transport, ref);
> +}
> diff --git a/fetch-object.h b/fetch-object.h
> new file mode 100644
> index 0000000..f371300
> --- /dev/null
> +++ b/fetch-object.h
> @@ -0,0 +1,6 @@
> +#ifndef FETCH_OBJECT_H
> +#define FETCH_OBJECT_H
> +
> +extern void fetch_object(const char *remote_name, const unsigned char *sha1);
> +
> +#endif

ATB,
Ramsay Jones



  reply	other threads:[~2017-11-16 19:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16 18:12 [PATCH v4 00/10] Partial clone part 2: fsck and promisors Jeff Hostetler
2017-11-16 18:12 ` [PATCH v4 01/10] extension.partialclone: introduce partial clone extension Jeff Hostetler
2017-11-16 18:12 ` [PATCH v4 02/10] fsck: introduce partialclone extension Jeff Hostetler
2017-11-16 18:12 ` [PATCH v4 03/10] fsck: support refs pointing to promisor objects Jeff Hostetler
2017-11-16 18:12 ` [PATCH v4 04/10] fsck: support referenced " Jeff Hostetler
2017-11-16 18:12 ` [PATCH v4 05/10] fsck: support promisor objects as CLI argument Jeff Hostetler
2017-11-16 18:12 ` [PATCH v4 06/10] index-pack: refactor writing of .keep files Jeff Hostetler
2017-11-16 18:12 ` [PATCH v4 07/10] introduce fetch-object: fetch one promisor object Jeff Hostetler
2017-11-16 19:57   ` Ramsay Jones [this message]
2017-11-17 19:49     ` Jeff Hostetler
2017-11-17 20:17       ` Stefan Beller
2017-11-20 15:56         ` Jeff Hostetler
2017-11-17 20:22       ` Ramsay Jones
2017-11-16 18:12 ` [PATCH v4 08/10] sha1_file: support lazily fetching missing objects Jeff Hostetler
2017-11-16 18:12 ` [PATCH v4 09/10] rev-list: support termination at promisor objects Jeff Hostetler
2017-11-16 18:12 ` [PATCH v4 10/10] gc: do not repack promisor packfiles Jeff Hostetler
2017-11-16 21:57 ` [PATCH v4 00/10] Partial clone part 2: fsck and promisors Jonathan Tan

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=e7b5e42f-b13c-50c8-501c-0100d8c48d00@ramsayjones.plus.com \
    --to=ramsay@ramsayjones.plus.com \
    --cc=git@jeffhostetler.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jonathantanmy@google.com \
    --cc=peff@peff.net \
    /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).