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

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

 



On Wed, Sep 07, 2022 at 02:59:08PM +0200, Johannes Schindelin wrote:

> 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



[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