Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork937
How to get git patch-id?#1974
-
This is command-line syntax to get patch-id for a commit
Reference:https://git-scm.com/docs/git-patch-id Q: How can I get the same output using GitPython? |
BetaWas this translation helpful?Give feedback.
All reactions
I got it to work with this:
def get_patch_id(commit: str) -> str: """ Get patch-id of a commit. a patch id is a unique ID for a patch (git show) ref: https://git-scm.com/docs/git-patch-id """ with Repo(repo_path) as repo: with tempfile.TemporaryFile() as temp_file: # output_stream = BytesIO() repo.git.show(commit, output_stream=temp_file) temp_file.seek(0) return repo.git.patch_id(istream=temp_file).split()[0]
Replies: 2 comments
-
You would have to use |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I got it to work with this:
|
BetaWas this translation helpful?Give feedback.