From a5ba9bb12d3be1fa6c476ddade98878773ae61f0 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Sun, 31 Dec 2023 02:34:33 +0000 Subject: [PATCH] Fix cross-branch readme cache --- src/git.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/git.rs b/src/git.rs index bbb1263..b4842ac 100644 --- a/src/git.rs +++ a/src/git.rs @@ -26,9 +26,11 @@ use crate::syntax_highlight::ComrakSyntectAdapter; +type ReadmeCacheKey = (PathBuf, Option>); + pub struct Git { commits: Cache>, - readme_cache: Cache)>>, + readme_cache: Cache)>>, syntax_set: SyntaxSet, } @@ -220,7 +222,7 @@ let git = self.git.clone(); git.readme_cache - .try_get_with(self.cache_key.clone(), async move { + .try_get_with((self.cache_key.clone(), self.branch.clone()), async move { tokio::task::spawn_blocking(move || { let repo = self.repo.lock(); -- rgit 0.1.3