]> git.wh0rd.org - home.git/blobdiff - .bin/git-repack
check-services: ignore icon caches & memfd
[home.git] / .bin / git-repack
index b225fca147d19e2ecbc3e9a5f236e99f74e9107b..063ff81a8547f93e00cabd2524d2ad8278f019de 100755 (executable)
@@ -63,6 +63,7 @@ def readfile(path):
     """Read |path| and return its data"""
     if os.path.isfile(path):
         return open(path).read()
+    return ''
 
 
 def unlink(path):
@@ -150,6 +151,10 @@ def repack(path):
         print('Repacking git repo: %s' % ' '.join(cmd))
         subprocess.check_call(cmd, cwd='/')
 
+        # Clean empty dirs.
+        cmd = ['find', rundir, '-depth', '-type', 'd', '-exec', 'rmdir', '{}', '+']
+        subprocess.call(cmd, stderr=open('/dev/null', 'w'))
+
         if tmpdir:
             cmd = ['rsync', '-a', '--delete', tmpdir + '/', path + '/']
             print('Syncing back git repo: %s' % ' '.join(cmd))