fix(daemon): treat Gitea SSH "Cannot find repository" as a purge hint

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-11-17 15:15:15 +01:00
1 parent 206130df98
commit 2772635ff9
2 files changed
+6 -1

No files matched your search

+5
View File
@@ -22,6 +22,7 @@ pub fn looks_gone(fetch_error: &str) -> bool {
"not found", "not found",
"does not appear to be a git repository", "does not appear to be a git repository",
"does not exist", "does not exist",
"cannot find repository", // Gitea/Forgejo over SSH
"error: 404", "error: 404",
] ]
.iter() .iter()
@@ -183,6 +184,10 @@ mod tests {
assert!(looks_gone( assert!(looks_gone(
"fatal: 'x.git' does not appear to be a git repository" "fatal: 'x.git' does not appear to be a git repository"
)); ));
assert!(looks_gone(
"git fetch -q --prune origin failed (Some(128)): error:\nerror: Cannot find \
repository: dasemu/x\nerror:\nfatal: Could not read from remote repository."
));
assert!(!looks_gone( assert!(!looks_gone(
"ssh: connect to host h port 22: Connection timed out" "ssh: connect to host h port 22: Connection timed out"
)); ));
+1 -1
View File
@@ -127,7 +127,7 @@ A managed repo whose remote was deleted is moved out of the synced tree, never d
purged_dir = "Purged" # default; "" disables the move purged_dir = "Purged" # default; "" disables the move
``` ```
- Trigger: a fetch fails with a "not found"-style error. That is only a hint: the forge serving - Trigger: a fetch fails with a "not found"-style error (also Gitea's SSH "Cannot find repository"). That is only a hint: the forge serving
`origin` must then answer 404 while the same token works (`test_connection`), and still do so `origin` must then answer 404 while the same token works (`test_connection`), and still do so
`purge::CONFIRM_AFTER_SECS` (10 min) after the first confirmation (a gap of more than twice `purge::CONFIRM_AFTER_SECS` (10 min) after the first confirmation (a gap of more than twice
that starts over). A working fetch, or the forge seeing the repo again, clears it. Network or that starts over). A working fetch, or the forge seeing the repo again, clears it. Network or