From 3e24d3aeda344a5e52f04dd5b79c6a341b0ce2bd Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 19 Feb 2018 20:55:02 -0500 Subject: [PATCH] git-repack: create .git/refs/ --- .bin/git-repack | 6 ++++++ 1 file changed, 6 insertions(+) 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)) -- 2.39.5