1#![deny(missing_docs, rust_2018_idioms)]
5#![forbid(unsafe_code)]
6
7pub const DOT_GIT_DIR: &str = ".git";
9
10pub const MODULES: &str = "modules";
12
13pub mod repository;
15
16pub mod is_git {
18 use std::path::PathBuf;
19
20 #[derive(Debug, thiserror::Error)]
22 #[allow(missing_docs)]
23 pub enum Error {
24 #[error("Could not find a valid HEAD reference")]
25 FindHeadRef(#[from] gix_ref::file::find::existing::Error),
26 #[error("Missing HEAD at '.git/HEAD'")]
27 MissingHead,
28 #[error("Expected HEAD at '.git/HEAD', got '.git/{}'", .name)]
29 MisplacedHead { name: bstr::BString },
30 #[error("Expected an objects directory at '{}'", .missing.display())]
31 MissingObjectsDirectory { missing: PathBuf },
32 #[error("The worktree's private repo's commondir file at '{}' or it could not be read", .missing.display())]
33 MissingCommonDir { missing: PathBuf, source: std::io::Error },
34 #[error("Expected a refs directory at '{}'", .missing.display())]
35 MissingRefsDirectory { missing: PathBuf },
36 #[error(transparent)]
37 GitFile(#[from] crate::path::from_gitdir_file::Error),
38 #[error("Could not retrieve metadata of \"{path}\"")]
39 Metadata { source: std::io::Error, path: PathBuf },
40 #[error("The repository's config file doesn't exist or didn't have a 'bare' configuration or contained core.worktree without value")]
41 Inconclusive,
42 #[error("Could not obtain current directory for resolving the '.' repository path")]
43 CurrentDir(#[from] std::io::Error),
44 }
45}
46
47mod is;
48pub use is::{bare as is_bare, git as is_git, submodule_git_dir as is_submodule_git_dir};
49
50pub mod upwards;
52pub use upwards::function::{discover as upwards, discover_opts as upwards_opts};
53
54pub mod path;
56
57pub mod parse;