Files
yaak-mountain-loop/src-tauri/yaak-git/src/init.rs
2025-11-17 15:22:39 -08:00

15 lines
400 B
Rust

use crate::error::Result;
use crate::repository::open_repo;
use log::info;
use std::path::Path;
pub(crate) fn git_init(dir: &Path) -> Result<()> {
git2::Repository::init(dir)?;
let repo = open_repo(dir)?;
// Default to main instead of master, to align with
// the official Git and GitHub behavior
repo.set_head("refs/heads/main")?;
info!("Initialized {dir:?}");
Ok(())
}