+ git_cache.ensure_rev_available(self.upstream, 'main', rev)
+
+ def test_fetch_raises_on_amend_after_cache_deleted(self) -> None:
+ d, _ = git_cache.fetch(self.upstream, 'main')
+ shutil.rmtree(d)
+ _git(self.upstream, 'commit', '--amend', '-m', 'Amended')
+ with self.assertRaises(Exception):
+ git_cache.fetch(self.upstream, 'main')
+
+ def test_ensure_raises_on_amend_after_cache_deleted(self) -> None:
+ d, _ = git_cache.fetch(self.upstream, 'main')
+ shutil.rmtree(d)
+ _git(self.upstream, 'commit', '--amend', '-m', 'Amended')
+ rev = _git(self.upstream, 'log', '--format=%H', '-n1').strip().decode()
+ with self.assertRaises(Exception):
+ git_cache.ensure_rev_available(self.upstream, 'main', rev)
+
+ def test_force_fetch_after_amend(self) -> None:
+ git_cache.fetch(self.upstream, 'main')
+ _git(self.upstream, 'commit', '--amend', '-m', 'Amended')
+ git_cache.fetch(self.upstream, 'main', force=True)
+
+ def test_force_ensure_after_amend(self) -> None:
+ git_cache.fetch(self.upstream, 'main')
+ _git(self.upstream, 'commit', '--amend', '-m', 'Amended')
+ rev = _git(self.upstream, 'log', '--format=%H', '-n1').strip().decode()
+ git_cache.ensure_rev_available(
+ self.upstream, 'main', rev, force=True)
+
+ def test_force_fetch_after_amend_and_cache_delete(self) -> None:
+ d, _ = git_cache.fetch(self.upstream, 'main')
+ shutil.rmtree(d)
+ _git(self.upstream, 'commit', '--amend', '-m', 'Amended')
+ git_cache.fetch(self.upstream, 'main', force=True)
+
+ def test_force_ensure_after_amend_and_cache_delete(self) -> None:
+ d, _ = git_cache.fetch(self.upstream, 'main')
+ shutil.rmtree(d)
+ _git(self.upstream, 'commit', '--amend', '-m', 'Amended')
+ rev = _git(self.upstream, 'log', '--format=%H', '-n1').strip().decode()
+ git_cache.ensure_rev_available(
+ self.upstream, 'main', rev, force=True)