]> git.wh0rd.org Git - home.git/commitdiff
git-repack: create .git/refs/
authorMike Frysinger <vapier@gentoo.org>
Tue, 20 Feb 2018 01:55:02 +0000 (20:55 -0500)
committerMike Frysinger <vapier@gentoo.org>
Tue, 20 Feb 2018 01:55:02 +0000 (20:55 -0500)
.bin/git-repack

index da56bea35261d196d2436e96b4a3efccc99c1eb4..eb0061b1a7d181090e72cd558f2185490440a31b 100755 (executable)
@@ -142,6 +142,7 @@ def repack(path):
 
         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:
@@ -174,6 +175,11 @@ def repack(path):
         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))