diff --git a/ci.py b/ci.py index bda599db59e3..838687647af0 100644 --- a/ci.py +++ b/ci.py @@ -269,7 +269,13 @@ def switch_branch(path, branch): cur_branch = check_output('git rev-parse HEAD'.split(), cwd=path).decode().strip() if cur_branch != branch: branches = check_output('git ls-remote --heads origin'.split(), cwd=path) - branches = [line.split("/")[-1] for line in branches.decode().strip().split("\n")] + # Prefer refs/heads/ so branch names containing "/" (e.g. cursor/foo) + # are preserved; split("/")[-1] would keep only the last path segment. + branches = [ + line.split("refs/heads/", 1)[-1] + for line in branches.decode().strip().split("\n") + if line.strip() + ] if branch in branches: print(f'Switch to branch: {branch} (from {cur_branch})')