|
13 | 13 | from pre_commit.store import _get_default_directory |
14 | 14 | from pre_commit.store import Store |
15 | 15 | from pre_commit.util import CalledProcessError |
| 16 | +from pre_commit.util import cmd_output |
16 | 17 | from testing.fixtures import git_dir |
17 | 18 | from testing.util import cwd |
18 | 19 | from testing.util import git_commit |
@@ -147,6 +148,20 @@ def fake_shallow_clone(self, *args, **kwargs): |
147 | 148 | assert store.select_all_repos() == [(path, rev, ret)] |
148 | 149 |
|
149 | 150 |
|
| 151 | +def test_clone_tag_not_on_mainline(store, tempdir_factory): |
| 152 | + path = git_dir(tempdir_factory) |
| 153 | + with cwd(path): |
| 154 | + git_commit() |
| 155 | + cmd_output('git', 'checkout', 'master', '-b', 'branch') |
| 156 | + git_commit() |
| 157 | + cmd_output('git', 'tag', 'v1') |
| 158 | + cmd_output('git', 'checkout', 'master') |
| 159 | + cmd_output('git', 'branch', '-D', 'branch') |
| 160 | + |
| 161 | + # previously crashed on unreachable refs |
| 162 | + store.clone(path, 'v1') |
| 163 | + |
| 164 | + |
150 | 165 | def test_create_when_directory_exists_but_not_db(store): |
151 | 166 | # In versions <= 0.3.5, there was no sqlite db causing a need for |
152 | 167 | # backward compatibility |
|
0 commit comments