cc202d6d1f
- Add tracing spans with repo labels for archive and blame operations - Implement caching for archive list entries when using OID selectors - Implement caching for blame operations when using OID selectors - Add detailed
30 lines
889 B
Rust
30 lines
889 B
Rust
use crate::bare::GitBare;
|
|
use crate::error::{GitError, GitResult};
|
|
|
|
impl GitBare {
|
|
pub fn init_repository(&self, bare: bool) -> GitResult<()> {
|
|
tracing::info!(
|
|
path = %self.bare_dir.display(),
|
|
bare = bare,
|
|
"initializing repository"
|
|
);
|
|
let mut args = vec!["init".to_string()];
|
|
if bare {
|
|
args.push("--bare".into());
|
|
}
|
|
args.push(self.bare_dir.to_string_lossy().into_owned());
|
|
let result = duct::cmd("git", &args)
|
|
.stdout_capture()
|
|
.stderr_capture()
|
|
.unchecked()
|
|
.run()?;
|
|
if !result.status.success() {
|
|
return Err(GitError::CommandFailed {
|
|
status_code: result.status.code(),
|
|
stderr: String::from_utf8_lossy(&result.stderr).into_owned(),
|
|
});
|
|
}
|
|
Ok(())
|
|
}
|
|
}
|