💾 Archived View for lists.flounder.online › patches › threads › 20210320204652.5797-1-johann@qwertqw… captured on 2022-04-28 at 19:24:52. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
From: johann@qwertqwefsday.eu
Date: Sat, 20 Mar 2021 21:46:49 +0100
Message-Id: 20210320204652.5797-1-johann@qwertqwefsday.eu
To: <~aw/patches@lists.sr.ht>
Cc: "Johann150" <johann@qwertqwefsday.eu>
--------------------------------------
From: Johann150 <johann@qwertqwefsday.eu>
The export directory should not be in the workdir for non-bare repos,
instead always check the git directory, i.e. the repo for bare repos or
the .git directory for non-bare repos.
---
src/main.rs | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/main.rs b/src/main.rs
index fe97363..21b620d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -106,13 +106,12 @@ async fn index(_req: Request<()>) -> tide::Result {
.map(|entries| {
entries
.filter_map(|entry| Some(entry.ok()?.path()))
- .filter(|entry| {
- // check for the export file
- let mut path = entry.clone();
- path.push(&CONFIG.export_ok);
- path.exists()
- })
.filter_map(|entry| Repository::open(entry).ok())
+ .filter(|repo| {
+ // check for the export file in the git directory
+ // (the .git subfolder for non-bare repos)
+ repo.path().join(&CONFIG.export_ok).exists()
+ })
.collect::<Vec<_>>()
})
.map_err(|e| tide::log::warn!("can not read repositories: {}", e))
--
2.20.1