This file contains 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
import re | |
import zlib | |
def show_git_tree(sha1): | |
path = '.git/objects/%s/%s' % (sha1[:2], sha1[2:]) | |
with open(path) as fp: | |
content = zlib.decompress(fp.read()) | |
header, body = content.split('\0', 1) | |
for line in re.findall('(\d+) (.*?)\0(.{20})', body, re.MULTILINE): | |
print line[0], line[1], line[2].encode('hex') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment