patman: Deal with git safe-directory warning
When running tests where the .git directory is not owned by the current
user, various warnings are produced and the tests fail. This happens in
CI.
For patman itself, modify the gitutil.get_top_level() function to return
None in this case. Ensure that the warning is not shown, since it creates
about 1000 lines of output.
For checkpatch, the same warning is produced even though --no-tree is
given. Suppress that as well.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/patman/project.py b/tools/patman/project.py
index d6143a6..e633401 100644
--- a/tools/patman/project.py
+++ b/tools/patman/project.py
@@ -18,7 +18,8 @@
"""
top_level = gitutil.get_top_level()
- if os.path.exists(os.path.join(top_level, "include", "u-boot")):
+ if (not top_level or
+ os.path.exists(os.path.join(top_level, "include", "u-boot"))):
return "u-boot"
elif os.path.exists(os.path.join(top_level, "kernel")):
return "linux"