-
-
Notifications
You must be signed in to change notification settings - Fork 957
How to perform git cat-file
?
#1570
-
Is there an API for git cat-file
? I did not find it in the docs.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
Use repo.rev_parse("revspec")
to obtain an object hash
, and with repo.odb.info(hash)
it should be possible to learn what kind of object it is. All objects except for trees can be printed directly. That can probably be done with repo.odb.stream(hash)
or maybe there is a method for that on the info
object returned earlier.
It's not obvious how to figure that out from the docs, it's hard to discover, and the above will need some experimentation but should give enough hints to figure the details out from there. If in doubt, repo.git.cat_file("revspec", p=true)
will definitely do it.
Beta Was this translation helpful? Give feedback.