Commit 330219b5 authored by Jameson Rollins's avatar Jameson Rollins

update for newer git interface

Access of the commit object returns a ValueError if the repo hasn't been
fully initialized yet (no initial commit).
parent 0c94f08a
......@@ -78,6 +78,8 @@ class SystemArchiveGit(object):
except:
pass
# remove any stale index locks
# FIXME: this should not be necessary, and undermines the
# purpose of the lock
try:
os.remove(os.path.join(root, '.git', 'index.lock'))
except:
......@@ -85,11 +87,16 @@ class SystemArchiveGit(object):
# completely remove all files from the index, so we commit
# only a clean set of files (to handle code removes)
if hasattr(repo.head, 'commit'):
if repo.head.is_valid():
for entry in repo.head.commit.tree.traverse():
fullpath = os.path.join(root, entry.path)
if os.path.isfile(fullpath) or os.path.islink(fullpath):
repo.index.remove([entry.path])
# FIXME: should remove *all* files, not just those known to
# index, e.g.:
# for root, dirs, files in os.walk(root):
# dirs[:] = [d for d in dirs if d != '.git']
# ...
# copy and add all usercode files
for path in [system.path] + system.usercode:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment