git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Lana Deere <lana.deere@gmail.com>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>, git@vger.kernel.org
Subject: Re: 2.37.2 can't "git pull" but 2.18.0 can
Date: Wed, 7 Sep 2022 14:59:08 +0200 (CEST)	[thread overview]
Message-ID: <s46p34qn-rq84-20q6-nr36-594sos6q5qq9@tzk.qr> (raw)
In-Reply-To: <CA+4x=b_KP4rMH-EDmVCD_4LHPiLx32J2OJC6Mm5xpQ-QUcSKuA@mail.gmail.com>

Hi Lana,

as per usual, replies inline.

On Tue, 6 Sep 2022, Lana Deere wrote:

> The 'git ls-remote origin' command on both produces about 3600 lines
> of output which appears to consist of all the branches in our repo.
> The two outputs are identical according to diff.  Both include a
> single mention of the switch-to-qt5 branch,
>
> $ diff /tmp/ls-remote*
> [no output here]
> $ grep switch-to-qt5 /tmp/ls-remote.*
> /tmp/ls-remote.2.18:6a9363081d05c313ba6a6ac59183193f1340bb1f
> refs/heads/feature/switch-to-qt5
> /tmp/ls-remote.2.37:6a9363081d05c313ba6a6ac59183193f1340bb1f
> refs/heads/feature/switch-to-qt5
>
> The 'git config -l' from both versions is almost the same - two lines
> have moved around.
> $ diff /tmp/config*
> 1,2d0
> < filter.lfs.required=true
> < filter.lfs.clean=git-lfs clean -- %f
> 4a3,4
> > filter.lfs.required=true
> > filter.lfs.clean=git-lfs clean -- %f
>
> $ cat /tmp/config.2.37
> filter.lfs.smudge=git-lfs smudge -- %f
> filter.lfs.process=git-lfs filter-process
> filter.lfs.required=true
> filter.lfs.clean=git-lfs clean -- %f
> user.name=Lana Deere
> user.email=lana.deere@gmail.com
> filter.lfs.clean=git-lfs clean -- %f
> filter.lfs.smudge=git-lfs smudge -- %f
> filter.lfs.process=git-lfs filter-process
> filter.lfs.required=true
> color.branch=false
> color.diff=false
> color.grep=false
> color.interactive=false
> color.pager=false
> color.showbranch=false
> color.status=false
> color.ui=false
> core.repositoryformatversion=0
> core.filemode=true
> core.bare=false
> core.logallrefupdates=true
> remote.origin.url=http://lana@githost:7990/scm/dp/sw.git
> remote.origin.fetch=+refs/heads/master:refs/remotes/origin/master

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

Now, clearly it is not quite working as intended in your scenario. The
message you pasted is produced by the code in
https://github.com/git/git/blob/v2.37.2/builtin/pull.c#L421-L494, which is
only entered if there are no entries in `.git/FETCH_HEAD` except
`not-for-merge` ones.

Lana, would you mind pasting the contents of `.git/FETCH_HEAD` just after
a failed `git pull`?

Ciao,
Johannes

> branch.master.remote=origin
> branch.master.merge=refs/heads/master
> branch.feature/switch-to-qt5.remote=origin
> branch.feature/switch-to-qt5.merge=refs/heads/feature/switch-to-qt5
>
>
> .. Lana (lana.deere@gmail.com)
>
> On Fri, Sep 2, 2022 at 4:16 PM brian m. carlson
> <sandals@crustytoothpaste.net> wrote:
> >
> > On 2022-09-02 at 19:27:55, Lana Deere wrote:
> > > I'm testing an upgrade to git 2.37.2 from the current version we're
> > > using of 2.18.0.  When I try to pull in my development tree, 2.37.2
> > > gives me an error but 2.18.0 things all is fine:
> > >
> > > $ /tools/linux-x86_64/git/2.37.2/bin/git pull
> > > Your configuration specifies to merge with the ref
> > > 'refs/heads/feature/switch-to-qt5'
> > > from the remote, but no such ref was fetched.
> > >
> > > $ /tools/linux-x86_64/git/2.18.0/bin/git pull
> > > From http://githost:7990/scm/dp/sw
> > >  * branch                  feature/switch-to-qt5 -> FETCH_HEAD
> > > Already up to date.
> > >
> > > Anyone have any ideas about this?  All I could find on google was a
> > > suggestion that the "no such ref" message indicates the remote branch
> > > was deleted, but that's not the case here.
> >
> > Can you provide the output of `git ls-remote origin` (assuming that's
> > the remote you're using) and `git config -l` (the latter with both
> > versions)?  I don't know of any reason why Git 2.37 should be broken in
> > this regard, but I suspect that there's a difference in configuration
> > between the two leading to this.
> > --
> > brian m. carlson (he/him or they/them)
> > Toronto, Ontario, CA
>

  reply	other threads:[~2022-09-07 12:59 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 19:27 2.37.2 can't "git pull" but 2.18.0 can Lana Deere
2022-09-02 20:16 ` brian m. carlson
2022-09-06 18:26   ` Lana Deere
2022-09-07 12:59     ` Johannes Schindelin [this message]
2022-09-07 15:59       ` Lana Deere
2022-09-08 18:20       ` Jeff King
2022-09-03  1:07 ` Jeff King
2022-09-06 19:37   ` Lana Deere
2022-09-07  2:11     ` Đoàn Trần Công Danh
2022-09-07 15:56       ` Lana Deere
2022-09-07 18:21         ` Jeff King
2022-09-07 18:53           ` Lana Deere
2022-09-07 21:10             ` Jeff King
2022-09-08 16:46               ` Lana Deere
2022-09-08 18:14                 ` Jeff King
2022-09-08 19:23                   ` [PATCH 0/2] v2 protocol can't "git pull" with restricted refspec Jeff King
2022-09-08 19:24                     ` [PATCH 1/2] fetch: stop checking for NULL transport->remote in do_fetch() Jeff King
2022-09-08 19:26                     ` [PATCH 2/2] fetch: add branch.*.merge to default ref-prefix extension Jeff King
2022-09-08 20:36                       ` Junio C Hamano
2022-09-08 20:48                         ` Junio C Hamano
2022-09-09  2:17                           ` Jeff King
2022-09-09  5:23                             ` Junio C Hamano
2022-09-11  5:08                               ` Jeff King
2022-09-09 17:32                   ` 2.37.2 can't "git pull" but 2.18.0 can Lana Deere
2022-09-09 18:27                     ` Junio C Hamano
2022-09-12 14:58                       ` Lana Deere
2022-09-13  0:28                         ` Jeff King
2022-09-05 10:25 ` Johannes Schindelin
2022-09-06 18:38   ` Lana Deere
2022-09-07 10:20     ` Johannes Schindelin
2022-09-07 16:01       ` Lana Deere

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s46p34qn-rq84-20q6-nr36-594sos6q5qq9@tzk.qr \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=lana.deere@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).