X-Git-Url: http://git.scottworley.com/git-cache/blobdiff_plain/c7a6a820cff7b4ffb67867d06235a7255e69c696..eb638847b92912d25b7de4a98418bb96f0d43eec:/test_git_cache.py diff --git a/test_git_cache.py b/test_git_cache.py index 64151fe..caac6a3 100644 --- a/test_git_cache.py +++ b/test_git_cache.py @@ -159,6 +159,17 @@ class TestGitCache(unittest.TestCase): d = git_cache.ensure_rev_available(self.upstream, 'otherbranch', rev) self.assertEqual(_git(d, 'show', '%s:foofile' % rev), b'foo') + def test_catch_up(self) -> None: + _git(self.upstream, 'checkout', '-b', 'otherbranch') + _commit_file(self.upstream, 'foofile', 'foo', 'Foo') + rev = _git(self.upstream, 'log', '--format=%H', '-n1').strip().decode() + d = git_cache.ensure_rev_available(self.upstream, 'otherbranch', rev) + self.assertEqual(_git(d, 'show', '%s:foofile' % rev), b'foo') + _git(self.upstream, 'checkout', 'master') + _git(self.upstream, 'merge', '--ff-only', 'otherbranch') + d = git_cache.ensure_rev_available(self.upstream, 'master', rev) + self.assertEqual(_git(d, 'show', '%s:foofile' % rev), b'foo') + def test_fetch_after_cache_deleted(self) -> None: d1, rev1 = git_cache.fetch(self.upstream, 'master') shutil.rmtree(d1)