summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2025-05-08 05:13:35 +0200
committerSimon Glass <[email protected]>2025-05-27 10:07:42 +0100
commit6961eb7e5b251fc9d936eb87dde2f6ce8cdfd631 (patch)
tree7c7f2054f51c4c38b29907530c300e26a6fa781b /tools
parent8e737d41c00b04bd3b1c9f56b8cea8bdbaf87012 (diff)
patman: Use .git as the git directory
In tests, the 'git' directory is a subdirectory of the temporary directory. Rename it to '.git' so that git will automatically find it when git operations are done in the temporary directory. Set up the config before the first git operation, so that this works correctly. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'tools')
-rw-r--r--tools/patman/func_test.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index 624f388966e..5ddefc3a9b1 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -78,7 +78,7 @@ class TestFunctional(unittest.TestCase):
def setUp(self):
self.tmpdir = tempfile.mkdtemp(prefix='patman.')
- self.gitdir = os.path.join(self.tmpdir, 'git')
+ self.gitdir = os.path.join(self.tmpdir, '.git')
self.repo = None
def tearDown(self):
@@ -416,7 +416,7 @@ Changes in v2:
fname (str): Filename of file to create
text (str): Text to put into the file
"""
- path = os.path.join(self.gitdir, fname)
+ path = os.path.join(self.tmpdir, fname)
tools.write_file(path, text, binary=False)
index = self.repo.index
index.add(fname)
@@ -550,7 +550,7 @@ complicated as possible''')
control.setup()
orig_dir = os.getcwd()
try:
- os.chdir(self.gitdir)
+ os.chdir(self.tmpdir)
# Check that it can detect the current branch
self.assertEqual(2, gitutil.count_commits_to_branch(None))
@@ -602,7 +602,7 @@ complicated as possible''')
def test_custom_get_maintainer_script(self):
"""Validate that a custom get_maintainer script gets used."""
self.make_git_tree()
- with directory_excursion(self.gitdir):
+ with directory_excursion(self.tmpdir):
# Setup git.
os.environ['GIT_CONFIG_GLOBAL'] = '/dev/null'
os.environ['GIT_CONFIG_SYSTEM'] = '/dev/null'
@@ -610,8 +610,6 @@ complicated as possible''')
tools.run('git', 'config', 'user.email', '[email protected]')
tools.run('git', 'branch', 'upstream')
tools.run('git', 'branch', '--set-upstream-to=upstream')
- tools.run('git', 'add', '.')
- tools.run('git', 'commit', '-m', 'new commit')
# Setup patman configuration.
with open('.patman', 'w', buffering=1) as f:
@@ -623,6 +621,8 @@ complicated as possible''')
f.write('#!/usr/bin/env python\n'
'print("[email protected]")\n')
os.chmod('dummy-script.sh', 0x555)
+ tools.run('git', 'add', '.')
+ tools.run('git', 'commit', '-m', 'new commit')
# Finally, do the test
with terminal.capture():
@@ -1108,7 +1108,7 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
branch = 'first'
dest_branch = 'first2'
count = 2
- gitdir = os.path.join(self.gitdir, '.git')
+ gitdir = self.gitdir
# Set up the test git tree. We use branch 'first' which has two commits
# in it