Skip to main content

create_vcs

Function create_vcs 

Source
pub fn create_vcs(
    git_dir: &Path,
    work_tree: &Path,
) -> Result<Arc<dyn Vcs>, VcsError>
Expand description

Open or initialize the per-mem gix repository.

git_dir holds HEAD, refs, objects, and config. work_tree is the mem root (or, in the shared-gitdir idiom, the directory that owns the gitdir). Both must be absolute or already canonicalized — commit strips work_tree from each staged path to compute the in-tree relative path.

On first init the gitdir is bootstrapped and the per-repo config is patched with core.logallrefupdates = true + commit.gpgsign = false. core.worktree is written only when git_dir.parent() != Some(work_tree) (i.e. when the gitdir is not a direct child of the worktree). commit.gpgsign = false is re-applied on every re-open so that a user edit to the per-repo config cannot silently enable signing and hang every memstead mutation waiting for a passphrase.