Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pygit2.GitError: no error #1315

Open
hramrach opened this issue Sep 5, 2024 · 1 comment
Open

pygit2.GitError: no error #1315

hramrach opened this issue Sep 5, 2024 · 1 comment

Comments

@hramrach
Copy link

hramrach commented Sep 5, 2024

Traceback (most recent call last):
File "/home/hramrach/kbuild/python/tests/test_branch_graph.py", line 32, in setUp
self.repo.lookup_branch(branch).set_target(commit)
_pygit2.GitError: no error

???

@hramrach
Copy link
Author

hramrach commented Sep 6, 2024

import pygit2
from pygit2.enums import FileMode
from pathlib import Path
import tempfile
import shutil
import sys

print(f"python: {sys.version}")
print(f"libgit2: {pygit2.LIBGIT2_VERSION}")
print(f"pygit2: {pygit2.__version__}")

data = {
'longterm': '6.6',
'master': '6.11-rc6',
'stable': '6.10',
}

base = Path(tempfile.mkdtemp())

repo = pygit2.init_repository(base, bare=True)
sig = pygit2.Signature('Test User', '[email protected]')
commit = None
for branch in data:
    tree = repo.TreeBuilder()
    version = data[branch]
    tree.insert('version', repo.create_blob(version.encode()), FileMode.BLOB)
    commit = repo[repo.create_commit('HEAD', sig, sig, f'{branch} commit', tree.write(), [commit.oid] if commit else [])]
    if branch == 'master':
        try:
            repo.lookup_branch(branch).set_target(commit)
        except pygit2.GitError as e:
            print(repr(e))
            None
    else:
        repo.branches.local.create(branch, commit)

shutil.rmtree(base, ignore_errors=True)
python: 3.11.9 (main, Apr 18 2024, 16:44:43) [GCC]
libgit2: 1.8.0
pygit2: 1.14.1
GitError('no error')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@hramrach and others