Created
June 22, 2021 09:38
-
-
Save AntoineToubhans/380612ce9b26dc3f2668dd85a7835d06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FIRST_COMMIT = list(REPO.iter_commits())[-1] | |
@contextmanager | |
def git_open(path: str, rev: str): | |
commit = REPO.commit(rev) | |
# Hack to get the full blob data stream: compute diff with initial commit | |
diff = commit.diff(FIRST_COMMIT, str(path))[0] | |
yield diff.a_blob.data_stream |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment