clean_hooks(path)
+ # XXX: Should do this for all remotes?
origin_path = os.path.join(path, 'refs', 'remotes', 'origin')
packed_refs = readfile(os.path.join(path, 'packed-refs'))
if os.path.exists(origin_path) or 'refs/remotes/origin/' in packed_refs:
cmd = ['find', rundir, '-depth', '-type', 'd', '-exec', 'rmdir', '{}', '+']
subprocess.call(cmd, stderr=open('/dev/null', 'w'))
+ # There's a few dirs we need to exist even if they're empty.
+ refdir = os.path.join(rundir, 'refs')
+ if not os.path.isdir(refdir):
+ os.mkdir(refdir)
+
if tmpdir:
cmd = ['rsync', '-a', '--delete', tmpdir + '/', path + '/']
print('Syncing back git repo: %s' % ' '.join(cmd))