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

Re: [PATCH] send-pack: never fetch when checking exclusions

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 8, 2019, 04:10 UTC
Message-ID
<xmqqzhibnahi.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20191007213839.233451-1-jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 5 quoted lines
> When building the packfile to be sent, send_pack() is given a list of
> remote refs to be used as exclusions. For each ref, it first checks if
> the ref exists locally, and if it does, passes it with a "^" prefix to
> pack-objects. However, in a partial clone, the check may trigger a lazy
> fetch. Ensure that this lazy fetch does not occur.

Is there any effect worth describing here, other than the obvious "we do not lazily fetch from within the has_object_file() function"?

For example, would this change mean that the resulting pack may include stuff that are reachable from the (missing) negative objects that would not otherwise have to be sent if these objects were available (or made available by the lazy fetching), and we are making a trade-off to send possibly more in order for not fetching? Have we laid enough on the table to help readers if such a trade-off (if we are making one, that is) strikes the right balance?

Thanks.
Show 19 quoted lines
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
>  send-pack.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/send-pack.c b/send-pack.c
> index 6dc16c3211..34c77cbb1a 100644
> --- a/send-pack.c
> +++ b/send-pack.c
> @@ -40,7 +40,8 @@ int option_parse_push_signed(const struct option *opt,
>  
>  static void feed_object(const struct object_id *oid, FILE *fh, int negative)
>  {
> -	if (negative && !has_object_file(oid))
> +	if (negative &&
> +	    !has_object_file_with_flags(oid, OBJECT_INFO_SKIP_FETCH_OBJECT))
>  		return;
>  
>  	if (negative)
Previous: Jonathan TanNext: Jonathan Tan
Message 2 of 9 in “send-pack: never fetch when checking exclusions”
  1. send-pack: never fetch when checking exclusionsJonathan Tan, Oct 7, 2019
  2. Junio C HamanoOct 8, 2019
  3. send-pack: never fetch when checking exclusionsJonathan Tan, Oct 8, 2019
  4. Jeff KingOct 11, 2019
  5. Derrick StoleeOct 11, 2019
  6. Jeff KingOct 11, 2019
  7. Jonathan TanOct 11, 2019
  8. Jeff KingOct 17, 2019
  9. Junio C HamanoOct 12, 2019

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.