From 60e05b91d812fea839f9acc949d98f12039af765 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Fri, 23 Apr 2021 00:14:45 -0600 Subject: open the repo when handling the request it would be smart to not keep the Vec around, but nobody's ever accused me of smart --- src/state.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/state.rs') diff --git a/src/state.rs b/src/state.rs index 004d3e2..deb7c9c 100644 --- a/src/state.rs +++ b/src/state.rs @@ -60,4 +60,9 @@ impl State { pub fn relative_path<'a>(&'a self, subdir: &'a Path) -> &'a Path { subdir.strip_prefix(&self.root).unwrap_or(subdir) } + + pub fn open(&self, path: impl AsRef) -> Result { + let path = self.root.join(path); + Ok(Repository::open_bare(path)?) + } } -- cgit v1.2.3