From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [Bug] branch.*.merge interpreted too strictly by tracking logic
Date: Tue, 04 Feb 2014 14:49:16 -0800 [thread overview]
Message-ID: <xmqqa9e67atv.fsf@gitster.dls.corp.google.com> (raw)
Start from an empty repository like so:
: gitster track; git init
Initialized empty Git repository in /var/tmp/x/track/.git/
: gitster track/master; git commit --allow-empty -m initial
[master (root-commit) abdcd1c] initial
: gitster track/master; git branch foo
: gitster track/master; git branch bar
: gitster track/master; git commit --allow-empty -m second
[master 78e28f4] second
Now, 'master' has two commits, while 'foo' and 'bar' both are one
commit behind, pointing at 'master^1'.
Let's tell these branches that they are both supposed to be building
on top of 'master'.
: gitster track/master; git config branch.foo.remote .
: gitster track/master; git config branch.foo.merge refs/heads/master
: gitster track/master; git config branch.bar.remote .
: gitster track/master; git config branch.bar.merge master
The difference between the two is that 'foo' spells the @{upstream}
branch in full (which is the recommended practice), while 'bar' is
loose and asks for 'master'.
Let's see what happens on these two branches. First 'foo':
: gitster track/master; git checkout foo
Switched to branch 'foo'
Your branch is behind 'master' by 1 commit, and can be
fast-forwarded.
(use "git pull" to update your local branch)
: gitster track/foo; git pull
From .
* branch master -> FETCH_HEAD
Updating abdcd1c..78e28f4
Fast-forward
The 'checkout' correctly reports that 'foo' is building on (local)
'master'. 'pull' works as expected, of course.
Now, here is the bug part. The same thing on 'bar':
: gitster track/foo; git checkout bar
Switched to branch 'bar'
Your branch is based on 'master', but the upstream is gone.
(use "git branch --unset-upstream" to fixup)
It knows about 'master', but what is "the upstream is gone"? It is
our local repository and it definitely is not gone.
But 'pull' of course works as expected (this behaviour is older and
stable for a long time since even before @{upstream} was invented).
: gitster track/bar; git pull
From .
* branch master -> FETCH_HEAD
Updating abdcd1c..78e28f4
Fast-forward
I suspect that the real culprit is somewhere in wt-status.c
: gitster track/bar; git status
On branch bar
Your branch is based on 'master', but the upstream is gone.
(use "git branch --unset-upstream" to fixup)
nothing to commit, working directory clean
Resolving @{upstream} works just fine for both.
: gitster track/bar; git rev-parse --symbolic-full-name foo@{upstream}
refs/heads/master
: gitster track/bar; git rev-parse --symbolic-full-name bar@{upstream}
refs/heads/master
Thanks.
next reply other threads:[~2014-02-04 22:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 22:49 Junio C Hamano [this message]
2014-02-05 20:50 ` [Bug] branch.*.merge interpreted too strictly by tracking logic Jeff King
2014-02-05 21:05 ` Junio C Hamano
2014-02-05 21:08 ` Jeff King
2014-02-05 21:10 ` Junio C Hamano
2014-10-14 22:14 ` [PATCH] checkout: report upstream correctly even with loosely defined branch.*.merge Junio C Hamano
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=xmqqa9e67atv.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.