Openembedded Core Discussions
 help / color / mirror / Atom feed
From: roy@0xbadcaffe.dev
To: openembedded-core@lists.openembedded.org
Cc: Roy Cohen <roy@0xbadcaffe.dev>
Subject: [PATCH] oe.patch: fix Git note identity in commitIgnored
Date: Sun, 18 Oct 2026 22:53:34 +0300	[thread overview]
Message-ID: <20261018195334.3822636-1-roy@0xbadcaffe.dev> (raw)

From: Roy Cohen <roy@0xbadcaffe.dev>

GitApplyTree.commitIgnored() passes the Git user name and email
as positional arguments to addNote(), incorrectly assigning them
to value and commituser.

Pass these as keyword arguments to ensure Git notes can be created
without relying on global Git configuration.

Add a regression test verifying the note content and Git identity.

Fixes [YOCTO #15989]

Signed-off-by: Roy Cohen <roy@0xbadcaffe.dev>
---
 meta/lib/oe/patch.py                        |  2 +-
 meta/lib/oeqa/selftest/cases/oelib/patch.py | 46 +++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index 2277e8835d..f8fc63ac00 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -520,7 +520,7 @@ class GitApplyTree(PatchTree):
         GitApplyTree.gitCommandUserOptions(cmd, d=d)
         cmd += ["commit", "-m", subject, "--no-verify", "--no-gpg-sign"]
         runcmd(cmd, dir)
-        GitApplyTree.addNote(dir, "HEAD", GitApplyTree.ignore_commit, d.getVar('PATCH_GIT_USER_NAME'), d.getVar('PATCH_GIT_USER_EMAIL'))
+        GitApplyTree.addNote(dir, "HEAD", GitApplyTree.ignore_commit, commituser=d.getVar('PATCH_GIT_USER_NAME'), commitemail=d.getVar('PATCH_GIT_USER_EMAIL'))
 
     @staticmethod
     def extractPatches(tree, startcommits, outdir, paths=None):
diff --git a/meta/lib/oeqa/selftest/cases/oelib/patch.py b/meta/lib/oeqa/selftest/cases/oelib/patch.py
index 8492549764..1b7d17813e 100644
--- a/meta/lib/oeqa/selftest/cases/oelib/patch.py
+++ b/meta/lib/oeqa/selftest/cases/oelib/patch.py
@@ -10,6 +10,7 @@ import subprocess
 import sys
 import tempfile
 from unittest.case import TestCase
+from unittest.mock import patch
 
 import oe.patch
 
@@ -280,3 +281,48 @@ class TestGitApplyTree(TestCase):
                 "2021-01-01T12:34:56Z",
             ))
             self.assert_note_and_extract(repo, patchname, "+plain diff change")
+
+    def test_commit_ignored_uses_explicit_identity(self):
+        with tempfile.TemporaryDirectory(prefix="oe-gitapply-note-") as tmpdir:
+            repo = self.make_repo(tmpdir, "source")
+
+            self.git(repo, "config", "--local", "--unset", "user.name")
+            self.git(repo, "config", "--local", "--unset", "user.email")
+
+            with open(os.path.join(repo, "file.txt"), "a") as f:
+                f.write("generated change\n")
+
+            env = {
+                "PATH": os.environ.get("PATH", os.defpath),
+                "HOME": tmpdir,
+                "GIT_CONFIG_GLOBAL": os.devnull,
+                "GIT_CONFIG_NOSYSTEM": "1",
+            }
+
+            with patch.dict(os.environ, env, clear=True):
+                oe.patch.GitApplyTree.commitIgnored(
+                    "Add generated changes",
+                    dir=repo,
+                    files=["file.txt"],
+                    d=PatchTestDataStore(tmpdir),
+                )
+
+                note = oe.patch.runcmd([
+                    "git", "notes", "--ref",
+                    oe.patch.GitApplyTree.notes_ref,
+                    "show", "HEAD",
+                ], repo)
+
+                identity = oe.patch.runcmd([
+                    "git", "log", "-1",
+                    "--format=%an%n%ae%n%cn%n%ce",
+                    oe.patch.GitApplyTree.notes_ref,
+                ], repo).splitlines()
+
+            self.assertEqual(note.strip(), oe.patch.GitApplyTree.ignore_commit)
+            self.assertEqual(identity, [
+                "OE Test",
+                "oe-test@example.com",
+                "OE Test",
+                "oe-test@example.com",
+            ])


                 reply	other threads:[~2026-10-18 19:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261018195334.3822636-1-roy@0xbadcaffe.dev \
    --to=roy@0xbadcaffe.dev \
    --cc=openembedded-core@lists.openembedded.org \
    /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