git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Nov 16, 2017, 19:57 UTC
Message-ID
<e7b5e42f-b13c-50c8-501c-0100d8c48d00@ramsayjones.plus.com>
In-Reply-To
<20171116181257.61673-8-git@jeffhostetler.com>
On 16/11/17 18:12, Jeff Hostetler wrote:
Show 33 quoted lines
> 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]
Show 11 quoted lines
> 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].

Show 30 quoted lines
> +
> +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

Previous: Jeff HostetlerNext: Jeff Hostetler
Message 7 of 17 in “Partial clone part 2: fsck and promisors”
  1. 00/10 Partial clone part 2: fsck and promisorsJeff Hostetler, Nov 16, 2017
  2. 04/10 fsck: support referenced promisor objectsJeff Hostetler, Nov 16, 2017
  3. 05/10 fsck: support promisor objects as CLI argumentJeff Hostetler, Nov 16, 2017
  4. 03/10 fsck: support refs pointing to promisor objectsJeff Hostetler, Nov 16, 2017
  5. 06/10 index-pack: refactor writing of .keep filesJeff Hostetler, Nov 16, 2017
  6. 07/10 introduce fetch-object: fetch one promisor objectJeff Hostetler, Nov 16, 2017
  7. Ramsay JonesNov 16, 2017
  8. Jeff HostetlerNov 17, 2017
  9. Ramsay JonesNov 17, 2017
  10. Stefan BellerNov 17, 2017
  11. Jeff HostetlerNov 20, 2017
  12. 02/10 fsck: introduce partialclone extensionJeff Hostetler, Nov 16, 2017
  13. 08/10 sha1_file: support lazily fetching missing objectsJeff Hostetler, Nov 16, 2017
  14. 10/10 gc: do not repack promisor packfilesJeff Hostetler, Nov 16, 2017
  15. 09/10 rev-list: support termination at promisor objectsJeff Hostetler, Nov 16, 2017
  16. 01/10 extension.partialclone: introduce partial clone extensionJeff Hostetler, Nov 16, 2017
  17. Jonathan TanNov 16, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.