summaryrefslogtreecommitdiff
path: root/submodule-cache.py
diff options
context:
space:
mode:
Diffstat (limited to 'submodule-cache.py')
-rw-r--r--submodule-cache.py15
1 files changed, 0 insertions, 15 deletions
diff --git a/submodule-cache.py b/submodule-cache.py
index 5a0b9b9..b1b2c18 100644
--- a/submodule-cache.py
+++ b/submodule-cache.py
@@ -58,16 +58,6 @@ def get_global_cachedir(create=False, verbose=False):
os.makedirs(le_path, exist_ok=True)
return le_path
-def splitdir_run(repo, spec):
- source_branch, target_branch, prefix = spec.split(':')
- with tempfile.TemporaryDirectory(prefix='sm-split-') as tmpdir:
- try:
- # --force to prevent errors for existing checkouts
- subprocess.run('git worktree add --force'.split() + [tmpdir, source_branch], check=True, cwd=repo)
- subprocess.run('git subtree split'.split() + ['-b', target_branch, '--prefix', prefix], check=True, cwd=tmpdir)
- finally:
- subprocess.run('git worktree remove'.split() + [tmpdir], check=True, cwd=repo)
-
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
@@ -83,8 +73,6 @@ if __name__ == '__main__':
for cfg_id, (url, le_path) in list_submodules().items():
short_id = cfg_id.split('/')[-1]
refdir = path.join(cachedir, short_id)
- branch = get_submodule_prop(cfg_id, 'branch')
- splitdir = get_submodule_prop(cfg_id, 'splitdir')
if not path.isdir(refdir):
print(f'Submodule {short_id} is not cached. Cloning from {url}...')
subprocess.run('git clone --bare'.split() + quiet_opts + [url, refdir], check=True)
@@ -100,9 +88,6 @@ if __name__ == '__main__':
subprocess.run('git fetch'.split() + force_opts, cwd=refdir, check=True)
- if splitdir:
- splitdir_run(refdir, splitdir)
-
print(f'Checking out submodule {short_id}...')
subprocess.run('git submodule update --init --reference'.split() + [refdir, le_path])