diff mbox series

[PATCHv2,2/5] lib/oe/patch: Add GitApplyTree.commitIgnored()

Message ID 20240219012832.3090768-2-pkj@axis.com
State Accepted, archived
Commit 94f0838b9223b7ece7affaa707e54a5d784da25e
Headers show
Series [PATCHv2,1/5] lib/oe/patch: Make extractPatches() not extract ignored commits | expand

Commit Message

Peter Kjellerstedt Feb. 19, 2024, 1:28 a.m. UTC
This function can be used to create a commit that devtool will ignore
when creating/updating the patches.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---

PATCHv2: No changes.

 meta/lib/oe/patch.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index 70cdb1d9c0..3ded5f3601 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -460,6 +460,16 @@  class GitApplyTree(PatchTree):
             cmd.append('--date="%s"' % date)
         return (tmpfile, cmd)
 
+    @staticmethod
+    def commitIgnored(subject, dir=None, files=None, d=None):
+        if files:
+            runcmd(['git', 'add'] + files, dir)
+        message = "%s\n\n%s" % (subject, GitApplyTree.ignore_commit_prefix)
+        cmd = ["git"]
+        GitApplyTree.gitCommandUserOptions(cmd, d=d)
+        cmd += ["commit", "-m", message, "--no-verify"]
+        runcmd(cmd, dir)
+
     @staticmethod
     def extractPatches(tree, startcommits, outdir, paths=None):
         import tempfile