(config: EvoGitConfig)
| 89 | |
| 90 | |
| 91 | def init_git_repo(config: EvoGitConfig) -> None: |
| 92 | git_dir = config.git_dir |
| 93 | |
| 94 | subprocess.run( |
| 95 | ["git", "init", "--object-format", config.git_hash], cwd=git_dir, check=True |
| 96 | ) |
| 97 | subprocess.run( |
| 98 | ["git", "config", "user.name", config.git_user_name], cwd=git_dir, check=True |
| 99 | ) |
| 100 | subprocess.run( |
| 101 | ["git", "config", "user.email", config.git_user_email], cwd=git_dir, check=True |
| 102 | ) |
| 103 | if os.path.isdir(config.seed_file): |
| 104 | shutil.copytree(config.seed_file, git_dir) |
| 105 | else: |
| 106 | shutil.copy(config.seed_file, os.path.join(git_dir, config.filename)) |
| 107 | |
| 108 | subprocess.run(["git", "add", "."], cwd=git_dir, check=True) |
| 109 | subprocess.run(["git", "commit", "-q", "-m", "init"], cwd=git_dir, check=True) |
| 110 | # disable auto gc, since we will run it manually at the end of each evaluation |
| 111 | subprocess.run(["git", "config", "gc.auto", "0"], cwd=git_dir, check=True) |
| 112 | config_merge_driver(config) |
| 113 | |
| 114 | if config.remote_repo is not None: |
| 115 | subprocess.run( |
| 116 | ["git", "remote", "add", "origin", config.remote_repo], |
| 117 | cwd=git_dir, |
| 118 | check=True, |
| 119 | ) |
| 120 | subprocess.run( |
| 121 | ["git", "push", "-f", "origin", "master"], cwd=git_dir, check=True |
| 122 | ) |
| 123 | subprocess.run( |
| 124 | ["git", "push", "-d", "origin", "refs/notes/commits"], |
| 125 | cwd=git_dir, |
| 126 | check=True, |
| 127 | ) |
| 128 | |
| 129 | delete_remote_branches(config) |
| 130 | delete_remote_notes(config) |
| 131 | |
| 132 | |
| 133 | def clone_git_repo(config: EvoGitConfig) -> None: |
nothing calls this directly
no test coverage detected