mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-05 04:36:13 +02:00
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.
This commit is contained in:
parent
9302d672a5
commit
3724cbade4
@ -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):
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
aiohttp==3.9.1
|
||||
ConfigParser==7.1.0
|
||||
importlib_resources==6.5.2
|
||||
pygit2==1.13.3
|
||||
pygit2==1.14.1
|
||||
Requests==2.32.3
|
||||
setuptools==75.8.0
|
||||
|
||||
@ -757,6 +757,24 @@ def get_branch(git_dir=None):
|
||||
return out
|
||||
|
||||
|
||||
def check_dirty(git_dir=None, work_tree=None):
|
||||
"""Check if the tree is dirty
|
||||
|
||||
Args:
|
||||
git_dir (str): Path to git repository (None to use default)
|
||||
|
||||
Return:
|
||||
str: List of dirty filenames and state
|
||||
"""
|
||||
cmd = ['git']
|
||||
if git_dir:
|
||||
cmd += ['--git-dir', git_dir]
|
||||
if work_tree:
|
||||
cmd += ['--work-tree', work_tree]
|
||||
cmd += ['status', '--porcelain', '--untracked-files=no']
|
||||
return command.output(*cmd).splitlines()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import doctest
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user