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/settings.py b/tools/patman/settings.py
index 7a0866c..def932d 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -364,7 +364,8 @@
if config_fname is None:
config_fname = '%s/.patman' % os.getenv('HOME')
- git_local_config_fname = os.path.join(gitutil.get_top_level(), '.patman')
+ git_local_config_fname = os.path.join(gitutil.get_top_level() or '',
+ '.patman')
has_config = False
has_git_local_config = False