securegit 0.8.5

Zero-trust git replacement with 12 built-in security scanners, LLM redteam bridge, universal undo, durable backups, and a 50-tool MCP server
Documentation
use anyhow::Result;
use std::fs;
use std::path::Path;

fn copy_dir_all(src: &Path, dst: &Path) -> Result<()> {
    fs::create_dir_all(dst)?;
    for entry in fs::read_dir(src)? {
        let entry = entry?;
        let ty = entry.file_type()?;
        if ty.is_dir() {
            copy_dir_all(&entry.path(), &dst.join(entry.file_name()))?;
        } else {
            fs::copy(entry.path(), dst.join(entry.file_name()))?;
        }
    }
    Ok(())
}

pub fn convert_bare_to_git_dir(bare_path: &Path, git_dir: &Path) -> Result<()> {
    // Move bare repo to .git directory
    // Try rename first, fall back to copy if cross-device
    if fs::rename(bare_path, git_dir).is_err() {
        copy_dir_all(bare_path, git_dir)?;
        fs::remove_dir_all(bare_path)?;
    }

    // Update config to not be bare
    let config_path = git_dir.join("config");
    if config_path.exists() {
        let content = fs::read_to_string(&config_path)?;
        let updated = content.replace("bare = true", "bare = false");
        fs::write(&config_path, updated)?;
    }

    Ok(())
}