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 <[email protected]> > --- > 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
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#243512): https://lists.openembedded.org/g/openembedded-core/message/243512 Mute This Topic: https://lists.openembedded.org/mt/120531853/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
