Skip to content

Commit

Permalink
Auto-tree conversion in index from-tree
Browse files Browse the repository at this point in the history
I really love rev-specs.
It's save to put multiple `^{tree}` behind each other.
  • Loading branch information
Byron committed Oct 12, 2022
1 parent 08d5c0b commit bae4589
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gitoxide-core/src/repository/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ use std::ffi::OsString;
use std::{io::BufWriter, path::PathBuf};

pub fn from_tree(
spec: OsString,
mut spec: OsString,
index_path: Option<PathBuf>,
force: bool,
repo: git::Repository,
mut out: impl std::io::Write,
) -> anyhow::Result<()> {
spec.push("^{tree}");
let spec = git::path::os_str_into_bstr(&spec)?;
let tree = repo.rev_parse_single(spec)?;
let state = git::index::State::from_tree(&tree, |oid, buf| repo.objects.find_tree_iter(oid, buf).ok())?;
Expand Down

0 comments on commit bae4589

Please sign in to comment.