Would a method like that fit into repo directly like repo.is_ancestor()
?
I know self.repo.commit(
works, but that does not differentiate between refs and commit hashes.
The fastest way to do this is this one:
\n\n GitPython/git/objects/base.py\n
\n\n Line 65\n in\n 6752fad\n
\n\n | oinfo = repo.odb.info(sha1) | \n
As it will call git cat-file
under the hood it might be that other forms of rev names are also supported, like branch names and the likes. It's certainly something to test out if that's a problem in this case.
A PR is welcome in case you would like to add a method to test for an objects existence on a Repo
.
-
Am I missing something or is that currently missing? The git command would be I used the following before using GitPython:
Would a method like that fit into repo directly like I know |
Beta Was this translation helpful? Give feedback.
-
PS: If this is something that would be ok to include, I'd create the PR, I'm currently doing it with this:
|
Beta Was this translation helpful? Give feedback.
-
PPS: We could also add default values to the |
Beta Was this translation helpful? Give feedback.
-
The fastest way to do this is this one: Line 65 in 6752fad As it will call A PR is welcome in case you would like to add a method to test for an objects existence on a |
Beta Was this translation helpful? Give feedback.
The fastest way to do this is this one:
GitPython/git/objects/base.py
Line 65 in 6752fad
As it will call
git cat-file
under the hood it might be that other forms of rev names are also supported, like branch names and the likes. It's certainly something to test out if that's a problem in this case.A PR is welcome in case you would like to add a method to test for an objects existence on a
Repo
.