@@ -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
+
cmd = ["git"]
GitApplyTree.gitCommandUserOptions(cmd, d=d)
cmd += ["commit", "-m", subject, "--no-verify", "--no-gpg-sign"]
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(+)