]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
scripts: patchreview: fix failure when running from a different folder
authorNicolas Dechesne <nicolas.dechesne@oss.qualcomm.com>
Tue, 19 Nov 2024 09:41:09 +0000 (10:41 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 21 Nov 2024 12:14:20 +0000 (12:14 +0000)
When running patchreview with --blame, the scripts runs a git log
command on the analyzed patch. When trying to analyse a layer which is
not in poky tree, we might be running the git log command from outside
the git workspace where the file is located, which results in such
failures:

Missing Signed-off-by tag ([truncated]/meta-qcom-hwe/recipes-devtools/partition-utils/qcom-ptool/0001-ptool.py-Generate-zero-files-in-output-folder-when-s.patch)
fatal: not a git repository (or any parent up to mount point /local/mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Fix this situation by setting the current work dir inside the git
workspace of the patch when running git log.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@oss.qualcomm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/contrib/patchreview.py

index 69ef14eb44a32d1eccb74bd5acb86cb6a1efa243..d8d7b214e5c3f201df4202ec1067f064cf827332 100755 (executable)
@@ -51,7 +51,7 @@ def blame_patch(patch):
     return subprocess.check_output(("git", "log",
                                     "--follow", "--find-renames", "--diff-filter=A",
                                     "--format=%s (%aN <%aE>)",
-                                    "--", patch)).decode("utf-8").splitlines()
+                                    "--", patch), cwd=os.path.dirname(patch)).decode("utf-8").splitlines()
 
 def patchreview(patches):