From: phillip.wood123@gmail.com
To: Jeff King <peff@peff.net>, phillip.wood@dunelm.org.uk
Cc: Ondra Medek <xmedeko@gmail.com>, git@vger.kernel.org
Subject: Re: Feature request: git status --branch-only
Date: Thu, 16 Nov 2023 16:09:58 +0000 [thread overview]
Message-ID: <7b4c76c3-4a1c-4d78-85bf-7a160a286dc5@gmail.com> (raw)
In-Reply-To: <20231114201808.GE2092538@coredump.intra.peff.net>
Hi Peff
On 14/11/2023 20:18, Jeff King wrote:
> On Tue, Nov 14, 2023 at 03:02:04PM +0000, Phillip Wood wrote:
>
>> Hi Ondra
>>
>> On 14/11/2023 12:40, Ondra Medek wrote:
>>> Hi Phillip,
>>>
>>> it does not work for a fresh clone of an empty repository
>>>
>>> git for-each-ref --format="%(upstream:short)" refs/heads/master
>>>
>>> outputs nothing, while
>>
>> Oh dear, that's a shame. I wonder if it is a bug because the documentation
>> says that
>>
>> --format="%(upstream:track)"
>>
>> should print "[gone]" whenever an unknown upstream ref is encountered but
>> trying that on a clone of an empty repository gives no output.
>
> I think it would print "gone" if the upstream branch went missing. But
> in this case the actual local branch is missing. And for-each-ref will
> not show an entry at all for a ref that does not exist. The
> "refs/heads/master" on your command line is not a ref, but a pattern,
> and that pattern does not match anything. So it's working as intended.
Oh of course, I'd somehow forgotten that "refs/heads/master" did not
exist so it makes sense that for-each-ref does not print anything.
> I think a more direct tool would be:
>
> git rev-parse --symbolic-full-name master@{upstream}
>
> That convinces branch_get_upstream() to return the value we want, but
> sadly it seems to get lost somewhere in the resolution process, and we
> spit out an error. Arguably that is a bug (with --symbolic or
> --symbolic-full-name, I think it would be OK to resolve names even if
> they don't point to something, but it's possible that would have other
> unexpected side effects).
Yeah, maybe we should look at fixing that - I didn't suggest it because
I knew it did not work on an unborn branch but as you say there is no
obvious reason why it shouldn't
Best Wishes
Phillip
> -Peff
prev parent reply other threads:[~2023-11-16 16:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-14 10:16 Feature request: git status --branch-only Ondra Medek
2023-11-14 12:28 ` Phillip Wood
2023-11-14 12:40 ` Ondra Medek
2023-11-14 15:02 ` Phillip Wood
2023-11-14 19:44 ` Ondra Medek
2023-11-14 20:18 ` Jeff King
2023-11-16 16:09 ` phillip.wood123 [this message]
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=7b4c76c3-4a1c-4d78-85bf-7a160a286dc5@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=phillip.wood@dunelm.org.uk \
--cc=xmedeko@gmail.com \
/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).