mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-28 12:11:53 +01:00
Move a bunch of git ops to use the git binary (#302)
This commit is contained in:
14
src-tauri/yaak-git/src/init.rs
Normal file
14
src-tauri/yaak-git/src/init.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
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(())
|
||||
}
|
||||
Reference in New Issue
Block a user