python: 3.11.8 (main, Feb 29 2024, 12:19:47) [GCC]
libgit2: 1.8.0
pygit2: 1.14.1
dullahan: False
dullahan: False
ref: refs/heads/master
Traceback (most recent call last):
File "/home/hramrach/kbuild/testrepo.py", line 41, in <module>
repo.branches.local.create('feature', feature_commit_oid)
File "/usr/lib64/python3.11/site-packages/pygit2/branches.py", line 78, in create
return self._repository.create_branch(name, commit, force)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument 2 must be _pygit2.Commit, not _pygit2.Oid
Why?!
Clearly the Oid can be deterministically converted to a commit so long as it refers to one. The code already needs to access the on-disk repository and is inspecting the parameter, throwing an exception when it does not like it. Why can't it determine if the Oid refers to a commit, and convert it automatically when it does?
code
output
Why?!
Clearly the Oid can be deterministically converted to a commit so long as it refers to one. The code already needs to access the on-disk repository and is inspecting the parameter, throwing an exception when it does not like it. Why can't it determine if the Oid refers to a commit, and convert it automatically when it does?