Re: [PATCH v4 07/10] introduce fetch-object: fetch one promisor object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 16/11/17 18:12, Jeff Hostetler wrote:
> From: Jonathan Tan <jonathantanmy@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
>  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





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux