From: Mike Frysinger Date: Tue, 20 Feb 2018 01:55:02 +0000 (-0500) Subject: git-repack: create .git/refs/ X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=3e24d3aeda344a5e52f04dd5b79c6a341b0ce2bd;p=home.git git-repack: create .git/refs/ --- diff --git a/.bin/git-repack b/.bin/git-repack index da56bea..eb0061b 100755 --- a/.bin/git-repack +++ b/.bin/git-repack @@ -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))