gix::discover

Function is_git

source
pub fn is_git(git_dir: &Path) -> Result<Kind, Error>
Expand description

What constitutes a valid git repository, returning the guessed repository kind purely based on the presence of files. Note that the git-config ultimately decides what’s bare.

Returns the Kind of git directory that was passed, possibly alongside the supporting private worktree git dir.

Note that .git files are followed to a valid git directory, which then requires…

  • …a valid head
  • …an objects directory
  • …a refs directory