Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/git/recover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,12 @@ mod tests {

#[test]
fn test_current_or_recover_returns_repo_when_cwd_exists() {
// In a test environment, CWD exists, so current_or_recover should succeed
// via the normal Repository::current() path (not recovery).
// Tests run inside a git repo in CI, so Repository::current() succeeds.
// current_or_recover() reads the process CWD via Repository::current().
// When tests run outside any git repo — e.g. the Nix flake build
// sandbox, where pkgs.lib.cleanSource strips .git (#2632) — the
// success branch can't be exercised, and recovery has nothing to
// recover from either, so the function returns Err.
let Ok(_) = Repository::current() else { return };
let (repo, recovered) = current_or_recover().unwrap();
assert!(!recovered);
assert!(repo.repo_path().unwrap().exists());
Expand Down
Loading