summaryrefslogtreecommitdiff
path: root/tools/patman/func_test.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-05-08 05:23:41 +0200
committerSimon Glass <sjg@chromium.org>2025-05-27 10:07:42 +0100
commit3724cbade41a1dd0ec94cd9b511afe005ebf4804 (patch)
treebe036445fce8fde18eb3b139b7bef6f669ae7a99 /tools/patman/func_test.py
parent9302d672a5e63cdb56371eb55dc560fef97c059f (diff)
patman: Clean up creation of the git tree
The test starts with the HEAD pointing to the wrong place, so that the created files appear to be deleted. Fix this by resetting the tree before tests start. Add a check that the tree is clean. Update pygit2 so that the enums are available.
Diffstat (limited to 'tools/patman/func_test.py')
-rw-r--r--tools/patman/func_test.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index 9c7d5d8c381..61df82312ba 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -503,7 +503,7 @@ better than before''')
target = repo.revparse_single('HEAD~2')
# pylint doesn't seem to find this
# pylint: disable=E1101
- repo.reset(target.oid, pygit2.GIT_CHECKOUT_FORCE)
+ repo.reset(target.oid, pygit2.enums.ResetMode.HARD)
self.make_commit_with_file('video: Some video improvements', '''
Fix up the video so that
it looks more purple. Purple is
@@ -543,6 +543,13 @@ complicated as possible''')
repo.config.set_multivar('branch.second.merge', '', 'refs/heads/base')
repo.branches.local.create('base', base_target)
+
+ target = repo.lookup_reference('refs/heads/first')
+ repo.checkout(target, strategy=pygit2.GIT_CHECKOUT_FORCE)
+ target = repo.revparse_single('HEAD')
+ repo.reset(target.oid, pygit2.enums.ResetMode.HARD)
+
+ self.assertFalse(gitutil.check_dirty(self.gitdir, self.tmpdir))
return repo
def test_branch(self):