From 2fb0b910a9426c23cd0e8cffde0c5288d873a0fc Mon Sep 17 00:00:00 2001 From: Christos Choutouridis Date: Fri, 27 Jun 2025 12:48:12 +0300 Subject: [PATCH] Avoid check-out branches to speed-up windows slow fs --- git-synchro.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git-synchro.py b/git-synchro.py index 14d9f75..c66449c 100644 --- a/git-synchro.py +++ b/git-synchro.py @@ -64,7 +64,7 @@ def sync_repo(nick, from_entry, to_entry, use_mirror, dry_run=False): """ Synchronizes a repository from from_entry to to_entry. Executes git fetch from the source and git push to the destination. - If --mirror is used, performs full push of all refs. Otherwise, checks out all remote branches and pushes with --all and --tags. + If --mirror is used, performs full push of all refs. Otherwise, creates local tracking branches and pushes them without checking out. """ _, _, from_remote, from_url, local_dir = from_entry _, _, to_remote, to_url, _ = to_entry @@ -94,9 +94,9 @@ def sync_repo(nick, from_entry, to_entry, use_mirror, dry_run=False): for r in remotes: if f'{from_remote}/' in r and '->' not in r: branch = r.strip().split(f'{from_remote}/')[1] - subprocess.run(["git", "checkout", "-B", branch, f"{from_remote}/{branch}"], cwd=local_dir) + subprocess.run(["git", "branch", branch, f"{from_remote}/{branch}"], cwd=local_dir) except subprocess.CalledProcessError as e: - print(f"Error: Failed to checkout remote branches in {local_dir}\nMessage: {e}") + print(f"Error: Failed to create tracking branches in {local_dir}\nMessage: {e}") sys.exit(1) run_git(["git", "push", to_remote, "--all"], cwd=local_dir, dry_run=dry_run) run_git(["git", "push", to_remote, "--tags"], cwd=local_dir, dry_run=dry_run)