From: Osama Abdelkader <osama.abdelkader@gmail.com>
To: Paul Barker <paul@pbarker.dev>
Cc: bitbake-devel@lists.openembedded.org
Subject: Re: [PATCH 2/4] bitbake-layers: layerindex-fetch: Fix branch detection method
Date: Fri, 19 Dec 2025 17:05:06 +0100 [thread overview]
Message-ID: <aUV3si3v8V-021Wi@osama> (raw)
In-Reply-To: <c84892212ed26bf08b1e7447391188ea5793a8a3.camel@pbarker.dev>
On Thu, Dec 18, 2025 at 07:39:28PM +0000, Paul Barker wrote:
> On Mon, 2025-12-15 at 23:34 +0100, Osama Abdelkader wrote:
> > On Mon, Dec 15, 2025 at 11:54:20AM +0000, Paul Barker wrote:
> > > On Fri, 2025-12-12 at 20:08 +0100, Osama Abdelkader wrote:
> > > > Replace fragile parsing of 'git branch' output with the more reliable
> > > > 'git rev-parse --abbrev-ref HEAD' command to get the current branch name.
> > > > This avoids parsing issues and is the recommended way to get the current branch name.
> > >
> > > Do you have a source for this recommendation? I thought the preferred
> > > command was `git branch --show-current` as that just prints the branch
> > > name with no extra formatting.
> >
> > Git commands are divided into two groups:
> >
> > Porcelain - High level commands intended to be used at the command line
> > Plumbing - Low level commands intended for use in scripts
> >
> > git rev-parse is a "plumbing" command, meaning its output format is guaranteed to be stable across different versions of Git.
> > It reliably outputs only the raw branch name to standard output.
> >
> > git branch is a "porcelain" command, intended for human users. While git branch --show-current currently behaves helpfully,
> > the formatting of porcelain commands is theoretically subject to change in future Git releases, which could break your build
> > scripts unexpectedly.
> >
> > https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain
> > https://git-scm.com/docs/git-rev-parse
>
> Hi Osama,
>
> Thanks for the additional context! We discussed this on the patch review
> call today.
>
> `git rev-parse --abbrev-ref` is definitely an improvement over calling
> `git branch`, but we have still seen some issues with this command in
> other contexts on the autobuilder. The best command to use seems to be
> `git name-rev --name-only` [1].
>
> [1]: https://git.yoctoproject.org/yocto-autobuilder-helper/commit/?id=1e80c19f62169c536e44f99fdcdf9f1e84c65d99
>
> Best regards,
>
> --
> Paul Barker
>
Hi Paul,
Thanks for the review, okay will change to that.
Best regards,
Osama
next prev parent reply other threads:[~2025-12-19 16:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-12 19:08 [PATCH 0/4] bitbake-layers: layerindex-fetch: respect --branch for already-configured layers Osama Abdelkader
2025-12-12 19:08 ` [PATCH 1/4] bitbake-layers: layerindex-fetch: Fix undefined stderr variable Osama Abdelkader
2025-12-15 11:52 ` Paul Barker
2025-12-12 19:08 ` [PATCH 2/4] bitbake-layers: layerindex-fetch: Fix branch detection method Osama Abdelkader
2025-12-15 11:54 ` Paul Barker
2025-12-15 22:34 ` Osama Abdelkader
2025-12-18 19:39 ` Paul Barker
2025-12-19 16:05 ` Osama Abdelkader [this message]
2025-12-12 19:08 ` [PATCH 3/4] bitbake-layers: layerindex-fetch: Respect --branch for already-configured layers Osama Abdelkader
2025-12-12 19:08 ` [PATCH 4/4] bitbake-layers: layerindex-fetch: Add branch check/switch for cooker layers Osama Abdelkader
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=aUV3si3v8V-021Wi@osama \
--to=osama.abdelkader@gmail.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=paul@pbarker.dev \
/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.