fix: is_inside_git_repo should take the directory as a param (#809)

https://github.com/openai/codex/pull/800 made `cwd` a property of
`Config` and made it so the `cwd` is not necessarily
`std::env::current_dir()`. As such, `is_inside_git_repo()` should check
`Config.cwd` rather than `std::env::current_dir()`.

This PR updates `is_inside_git_repo()` to take `Config` instead of an
arbitrary `PathBuf` to force the check to operate on a `Config` where
`cwd` has been resolved to what the user specified.
This commit is contained in:
Michael Bolin
2025-05-04 11:39:10 -07:00
committed by GitHub
parent cd12f0c24a
commit a134bdde49
3 changed files with 29 additions and 32 deletions

View File

@@ -114,7 +114,7 @@ pub fn run_main(cli: Cli) -> std::io::Result<()> {
// modal. The flag is shown when the current working directory is *not*
// inside a Git repository **and** the user did *not* pass the
// `--allow-no-git-exec` flag.
let show_git_warning = !cli.skip_git_repo_check && !is_inside_git_repo();
let show_git_warning = !cli.skip_git_repo_check && !is_inside_git_repo(&config);
try_run_ratatui_app(cli, config, show_git_warning, log_rx);
Ok(())