cargo::ops::cargo_package

Function check_repo_state

source
fn check_repo_state(
    p: &Package,
    src_files: &[PathBuf],
    gctx: &GlobalContext,
    opts: &PackageOpts<'_>,
) -> CargoResult<Option<VcsInfo>>
Expand description

Checks if the package source is in a git DVCS repository. If git, and the source is dirty (e.g., has uncommitted changes), and --allow-dirty has not been passed, then bail! with an informative message. Otherwise return the sha1 hash of the current HEAD commit, or None if no repo is found.