From: Junio C Hamano <gitster@pobox.com>
To: Olaf Hering <olaf@aepfle.de>
Cc: git@vger.kernel.org
Subject: Re: changed output in git branch -a
Date: Mon, 30 Jun 2025 06:31:29 -0700 [thread overview]
Message-ID: <xmqqsejh5pam.fsf@gitster.g> (raw)
In-Reply-To: <20250630121839.6252d9d9.olaf@aepfle.de> (Olaf Hering's message of "Mon, 30 Jun 2025 12:23:32 +0200")
Olaf Hering <olaf@aepfle.de> writes:
> my dumb script parses the output of "git --git-dir=some/dir/.git branch -a".
> With git 2.43 it gets the expected list of "remote/branch".
> With git 2.50 it also gets something like "remote/HEAD -> remote/branch".
>
> The newer version runs on a different system. It might be that the repository
> was already cloned with a different format. For some reason it does have
> .git/refs/remotes/${remote}/HEAD, but the system with the older git lacks
> that entry.
I somehow do not think this is a version difference. Assuming that
your default remote is called "origin", I suspect that you have
refs/remotes/origin/HEAD symbolic ref in the repository you use with
Git 2.50, while in the other repository you do not. Both versions
are capable of showing that symbolic ref information.
You can try in the repository where you use Git 2.43
$ git remote set-head origin -a
$ git branch -a
to see if the difference indeed is coming from different versions.
> Is there a way to suppress such lines, or do I need to filter them manually?
> There is no obvious knob mentioned in git-branch(1).
Scripts should be reading "git for-each-ref" output in the first
place. Output from "git branch" is meant for human consumption and
is subject to change any time (even though in this case I suspect it
has not changed.
next prev parent reply other threads:[~2025-06-30 13:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 10:23 changed output in git branch -a Olaf Hering
2025-06-30 11:13 ` Kristoffer Haugsbakk
2025-06-30 13:31 ` Junio C Hamano [this message]
2025-06-30 14:19 ` Olaf Hering
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=xmqqsejh5pam.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=olaf@aepfle.de \
/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.