is_inside_git_repo

Function is_inside_git_repo 

Source
pub fn is_inside_git_repo(base_dir: &Path) -> bool
Expand description

Return true if the project folder specified by the Config is inside a Git repository.

The check walks up the directory hierarchy looking for a .git file or directory (note .git can be a file that contains a gitdir entry). This approach does not require the git binary or the git2 crate and is therefore fairly lightweight.

Note that this does not detect work‑trees created with git worktree add where the checkout lives outside the main repository directory. If you need Codex to work from such a checkout simply pass the --allow-no-git-exec CLI flag that disables the repo requirement.