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

Re: [PATCH v2 2/2] fetch-pack: respect --no-update-shallow in v2

From
Jeff King <peff@peff.net>
Date
Mar 26, 2019, 18:23 UTC
Message-ID
<20190326182300.GC24105@sigill.intra.peff.net>
In-Reply-To
<943b1cbc61dbcc498a9e34d7d39dc8617cb99195.1553622679.git.jonathantanmy@google.com>
On Tue, Mar 26, 2019 at 10:53:26AM -0700, Jonathan Tan wrote:
Show 28 quoted lines
> @@ -1625,6 +1649,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
>  {
>  	struct ref *ref_cpy;
>  	struct shallow_info si;
> +	struct oid_array shallows_scratch = OID_ARRAY_INIT;
>  
>  	fetch_pack_setup();
>  	if (nr_sought)
> @@ -1649,10 +1674,11 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
>  		die(_("no matching remote head"));
>  	}
>  	if (version == protocol_v2) {
> -		if (shallow && shallow->nr)
> +		if (shallow->nr)
>  			BUG("Protocol V2 does not provide shallows at this point in the fetch");
>  		memset(&si, 0, sizeof(si));
>  		ref_cpy = do_fetch_pack_v2(args, fd, ref, sought, nr_sought,
> +					   &shallows_scratch, &si,
>  					   pack_lockfile);
>  	} else {
>  		prepare_shallow_info(&si, shallow);
> @@ -1680,6 +1706,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
>  	update_shallow(args, sought, nr_sought, &si);
>  cleanup:
>  	clear_shallow_info(&si);
> +	oid_array_clear(&shallows_scratch);
>  	return ref_cpy;
>  }

Yeah, this is much clearer than what I posted earlier. Thanks for thinking it through.

The patches look good to me, modulo the timing of the NULL thing I mentioned elsewhere.

-Peff
Previous: Jonathan TanNext: Jeff King
Message 14 of 18 in “Last big GIT_TEST_PROTOCOL_VERSION=2 fix, hopefully”
  1. 0/2 Last big GIT_TEST_PROTOCOL_VERSION=2 fix, hopefullyJonathan Tan, Mar 25, 2019
  2. 1/2 fetch-pack: call prepare_shallow_info only if v0Jonathan Tan, Mar 25, 2019
  3. Jeff KingMar 26, 2019
  4. 2/2 fetch-pack: respect --no-update-shallow in v2Jonathan Tan, Mar 25, 2019
  5. Jeff KingMar 26, 2019
  6. Duy NguyenMar 26, 2019
  7. Jeff KingMar 26, 2019
  8. Duy NguyenMar 26, 2019
  9. Jonathan TanMar 26, 2019
  10. Jeff KingMar 26, 2019
  11. 0/2 Last big GIT_TEST_PROTOCOL_VERSION=2 fix, hopefullyJonathan Tan, Mar 26, 2019
  12. 1/2 fetch-pack: call prepare_shallow_info only if v0Jonathan Tan, Mar 26, 2019
  13. 2/2 fetch-pack: respect --no-update-shallow in v2Jonathan Tan, Mar 26, 2019
  14. Jeff KingMar 26, 2019
  15. Jeff KingMar 26, 2019
  16. 0/2 Last big GIT_TEST_PROTOCOL_VERSION=2 fix, hopefullyJonathan Tan, Mar 26, 2019
  17. 1/2 fetch-pack: call prepare_shallow_info only if v0Jonathan Tan, Mar 26, 2019
  18. 2/2 fetch-pack: respect --no-update-shallow in v2Jonathan Tan, Mar 26, 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.