cargo::ops::cargo_package::vcs

# Function check_repo_state

Source

    pub fn check_repo_state(
        p: &Package,
        src_files: &[PathEntry],
        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.