From 9ce2a31fca38cac283996796a06dd2ead37f6e34 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 13 Jun 2016 15:34:34 +0200 Subject: [PATCH] Fix issue with submodules --- git_sound/gitmidi.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git_sound/gitmidi.py b/git_sound/gitmidi.py index 41a87ef..3415b52 100644 --- a/git_sound/gitmidi.py +++ b/git_sound/gitmidi.py @@ -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'