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

Re: 2.37.2 can't "git pull" but 2.18.0 can

From
Jeff King <peff@peff.net>
Date
Sep 8, 2022, 18:20 UTC
Message-ID
<Yxoydthiq0Hzzx4G@coredump.intra.peff.net>
In-Reply-To
<s46p34qn-rq84-20q6-nr36-594sos6q5qq9@tzk.qr>
On Wed, Sep 07, 2022 at 02:59:08PM +0200, Johannes Schindelin wrote:
Show 36 quoted lines
> At first I thought that this would be the root cause:
> `feature/switch-to-qt5` is not included in the refs to fetch.
> 
> But then I added a test case for that specific scenario:
> 
> -- snip --
> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
> index 081808009b2..6e6ddeb7e63 100755
> --- a/t/t5520-pull.sh
> +++ b/t/t5520-pull.sh
> @@ -218,6 +218,17 @@ test_expect_success 'fail if upstream branch does not exist' '
>  	test_cmp expect file
>  '
> 
> +test_expect_success 'fetch upstream branch even if refspec excludes it' '
> +	git branch tirili &&
> +	git branch tirili2 &&
> +	git init -b tirili downstream &&
> +	git -C downstream remote add -t tirili origin "file://$(pwd)/.git" &&
> +	git -C downstream config branch.tirili.remote origin &&
> +	git -C downstream config branch.tirili.merge refs/heads/tirili2 &&
> +	git -C downstream pull 2>err &&
> +	! grep "configuration specifies to merge" err
> +'
> +
>  test_expect_success 'fail if the index has unresolved entries' '
>  	git checkout -b third second^ &&
>  	test_when_finished "git checkout -f copy && git branch -D third" &&
> 
> -- snap --
> 
> And that test case passes!
> 
> The reason is that we specifically add the ref that needs to be merged to
> the list of refs to be fetched:
> https://github.com/git/git/blob/v2.37.2/builtin/fetch.c#L605-L614

I just sent another message with more details. But the reason this test passes is that "tirili" is a prefix of "tirili2". The v2 feature to limit advertisements works on string prefixes, so asking for "tirili" will let the server advertise both branches. Switching the first branch name like so:

diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 6e6ddeb7e6..7e9ed436d3 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -219,12 +219,12 @@ test_expect_success 'fail if upstream branch does not exist' '
 '
 
 test_expect_success 'fetch upstream branch even if refspec excludes it' '
-	git branch tirili &&
+	git branch tirili1 &&
 	git branch tirili2 &&
-	git init -b tirili downstream &&
-	git -C downstream remote add -t tirili origin "file://$(pwd)/.git" &&
-	git -C downstream config branch.tirili.remote origin &&
-	git -C downstream config branch.tirili.merge refs/heads/tirili2 &&
+	git init -b tirili1 downstream &&
+	git -C downstream remote add -t tirili1 origin "file://$(pwd)/.git" &&
+	git -C downstream config branch.tirili1.remote origin &&
+	git -C downstream config branch.tirili1.merge refs/heads/tirili2 &&
 	git -C downstream pull 2>err &&
 	! grep "configuration specifies to merge" err
 '

causes it to fail just like Lana's case.

-Peff
Previous: Lana DeereNext: Jeff King
Message 6 of 31 in “2.37.2 can't "git pull" but 2.18.0 can”
  1. Lana DeereSep 2, 2022
  2. brian m. carlsonSep 2, 2022
  3. Lana DeereSep 6, 2022
  4. Johannes SchindelinSep 7, 2022
  5. Lana DeereSep 7, 2022
  6. Jeff KingSep 8, 2022
  7. Jeff KingSep 3, 2022
  8. Lana DeereSep 6, 2022
  9. Đoàn Trần Công DanhSep 7, 2022
  10. Lana DeereSep 7, 2022
  11. Jeff KingSep 7, 2022
  12. Lana DeereSep 7, 2022
  13. Jeff KingSep 7, 2022
  14. Lana DeereSep 8, 2022
  15. Jeff KingSep 8, 2022
  16. 0/2 v2 protocol can't "git pull" with restricted refspecJeff King, Sep 8, 2022
  17. 1/2 fetch: stop checking for NULL transport->remote in do_fetch()Jeff King, Sep 8, 2022
  18. 2/2 fetch: add branch.*.merge to default ref-prefix extensionJeff King, Sep 8, 2022
  19. Junio C HamanoSep 8, 2022
  20. Junio C HamanoSep 8, 2022
  21. Jeff KingSep 9, 2022
  22. Junio C HamanoSep 9, 2022
  23. Jeff KingSep 11, 2022
  24. Lana DeereSep 9, 2022
  25. Junio C HamanoSep 9, 2022
  26. Lana DeereSep 12, 2022
  27. Jeff KingSep 13, 2022
  28. Johannes SchindelinSep 5, 2022
  29. Lana DeereSep 6, 2022
  30. Johannes SchindelinSep 7, 2022
  31. Lana DeereSep 7, 2022

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.