Fix issue with submodules

This commit is contained in:
Gergely Polonkai 2016-06-13 15:34:34 +02:00
parent ab3dbc2880
commit 9ce2a31fca

View File

@ -10,7 +10,7 @@ import shutil
from midiutil.MidiFile import MIDIFile
from StringIO import StringIO
from git import Repo
from git import Repo, Tree
from git.objects.blob import Blob
from time import sleep
@ -32,7 +32,10 @@ def get_file_sha(commit, file_name):
while True:
try:
tree = tree[elements.pop(0)]
element = elements.pop(0)
if isinstance(tree[element], Tree):
tree = tree[element]
except (KeyError, IndexError):
# The file has been deleted, return the hash of an empty file
return 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'