From: Paul Barker <paul@pbarker.dev>
To: Jamin Lin <jamin_lin@aspeedtech.com>,
"openembedded-core@lists.openembedded.org"
<openembedded-core@lists.openembedded.org>,
"alex.kanavin@gmail.com" <alex.kanavin@gmail.com>,
"mathieu.dubois-briand@bootlin.com"
<mathieu.dubois-briand@bootlin.com>
Cc: Troy Lee <troy_lee@aspeedtech.com>
Subject: Re: [PATCH v4 1/5] oe/patch: Skip commitIgnored when nothing is actually staged
Date: Sun, 16 Aug 2026 11:50:09 +0100 [thread overview]
Message-ID: <3e5f24dc43f974a5572ab35ad6ab77e0135bbda6.camel@pbarker.dev> (raw)
In-Reply-To: <20260731092634.1127862-2-jamin_lin@aspeedtech.com>
On Fri, 2026-07-31 at 09:26 +0000, Jamin Lin wrote:
> patch.bbclass's patch_task_postfunc calls GitApplyTree.commitIgnored()
> whenever 'git status --porcelain .' reports the source tree as dirty
> after do_patch, to snapshot those changes into the devtool tracking
> repo with 'git add' + 'git commit'.
>
> A path can be reported as dirty by git status purely because it is a
> submodule (or an unregistered embedded git repo) that itself has
> modified or untracked content - for example a recipe with multiple git
> SRC_URI entries where one destsuffix places a repo inside another
> repo's own working tree. The outer repo's tracked commit hash for that
> submodule hasn't changed, so 'git add' has nothing new to stage for it,
> and git refuses to fold the submodule's own dirty state into a plain
> commit without it being resolved first:
>
> $ git commit -m ... --no-verify --no-gpg-sign
> Changes not staged for commit:
> (commit or discard the untracked or modified content in submodules)
> modified: level1 (modified content)
> no changes added to commit (use "git add" and/or "git commit -a")
>
> 'git commit' then exits non-zero with nothing to commit, and
> commitIgnored() propagates that failure straight up, taking the whole
> do_patch task down with it.
>
> Fix by checking 'git diff --cached --name-only' after 'git add': if
> nothing was actually staged, there is nothing meaningful to snapshot,
> so skip the commit (and the note it would otherwise add) instead of
> failing.
>
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
> meta/lib/oe/patch.py | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
> index 1d50e83ab7..944dde1e03 100644
> --- a/meta/lib/oe/patch.py
> +++ b/meta/lib/oe/patch.py
> @@ -516,6 +516,18 @@ class GitApplyTree(PatchTree):
> def commitIgnored(subject, dir=None, files=None, d=None):
> if files:
> runcmd(['git', 'add'] + files, dir)
> +
> + # 'git add' can leave nothing actually staged even though the caller
> + # saw a dirty status: a path can show as modified purely because it
> + # is a submodule/embedded git repository with modified or untracked
> + # content of its own (e.g. a further nested git repo from another
> + # destsuffix SRC_URI entry) - git refuses to record that via a plain
> + # 'git add'/'git commit' without resolving the submodule's own state,
> + # so the commit below would fail with "no changes added to commit".
> + # Skip the commit if there is nothing actually staged.
> + if not runcmd(['git', 'diff', '--cached', '--name-only'], dir).strip():
> + return
This is a lot of text for a simple message, was this AI generated?
We can just say "Skip the commit if there is nothing actually staged"
here.
Best regards,
--
Paul Barker
next prev parent reply other threads:[~2026-08-16 10:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 9:26 [PATCH v4 0/5] devtool: fix standalone clone conversion for nested git repos Jamin Lin
2026-07-31 9:26 ` [PATCH v4 1/5] oe/patch: Skip commitIgnored when nothing is actually staged Jamin Lin
2026-08-16 10:50 ` Paul Barker [this message]
2026-08-17 3:57 ` Jamin Lin
2026-07-31 9:26 ` [PATCH v4 2/5] devtool: Register nested git repos before the initial commit Jamin Lin
2026-08-16 10:59 ` Paul Barker
2026-08-17 3:58 ` Jamin Lin
2026-07-31 9:26 ` [PATCH v4 3/5] devtool-source: Make nested destsuffix git repos standalone Jamin Lin
2026-08-16 11:05 ` Paul Barker
2026-07-31 9:26 ` [PATCH v4 4/5] meta-selftest: Add devtool-test-multi-destsuffix recipe Jamin Lin
2026-07-31 9:26 ` [PATCH v4 5/5] oeqa/selftest/devtool: Add test for multiple nested git destsuffix repos Jamin Lin
2026-08-16 11:08 ` Paul Barker
2026-08-17 4:01 ` Jamin Lin
2026-08-17 6:43 ` [PATCH v4 0/5] devtool: fix standalone clone conversion for nested git repos Jamin Lin
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=3e5f24dc43f974a5572ab35ad6ab77e0135bbda6.camel@pbarker.dev \
--to=paul@pbarker.dev \
--cc=alex.kanavin@gmail.com \
--cc=jamin_lin@aspeedtech.com \
--cc=mathieu.dubois-briand@bootlin.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=troy_lee@aspeedtech.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