History

minor refactor

Sebastian Thiel committed 4 years ago

Commit dae710f1 parent 0fb4c911 file · +7 −7Browse files

Unified · Split

cargo-smart-release/src/git/history.rs+7−7
@@ -29,12 +29,12 @@ pub enum SegmentScope { · 28 unmodified lines
2929 }
3030
3131 pub fn collect(handle: &git::easy::Handle) -> anyhow::Result<Option<commit::History>> {
32− let mut repo = handle.clone();
33− repo.object_cache_size(64 * 1024);
34− let reference = match repo.head()?.peeled()?.kind {
32+ let mut handle = handle.clone();
33+ handle.object_cache_size(64 * 1024);
34+ let reference = match handle.head()?.peeled()?.kind {
3535 head::Kind::Detached { .. } => bail!("Refusing to operate on a detached head."),
3636 head::Kind::Unborn { .. } => return Ok(None),
37− head::Kind::Symbolic(r) => r.attach(&repo),
37+ head::Kind::Symbolic(r) => r.attach(&handle),
3838 };
3939
4040 let mut items = Vec::new();
@@ -60,7 +60,7 @@ pub fn collect(handle: &git::easy::Handle) -> anyhow::Result<Option<commit::Hist · 19 unmodified lines
6060 (
6161 message,
6262 tree_id,
63− parent_commit_id.map(|id| id.attach(&repo).object().expect("present").to_commit_ref().tree()),
63+ parent_commit_id.map(|id| id.attach(&handle).object().expect("present").to_commit_ref().tree()),
6464 commit_time,
6565 )
6666 };
@@ -75,9 +75,9 @@ pub fn collect(handle: &git::easy::Handle) -> anyhow::Result<Option<commit::Hist · 8 unmodified lines
7575 }
7676 Ok(m) => m,
7777 };
78− data_by_tree_id.insert(tree_id, repo.find_object(tree_id)?.data.to_owned());
78+ data_by_tree_id.insert(tree_id, handle.find_object(tree_id)?.data.to_owned());
7979 if let Some(tree_id) = parent_tree_id {
80− data_by_tree_id.insert(tree_id, repo.find_object(tree_id)?.data.to_owned());
80+ data_by_tree_id.insert(tree_id, handle.find_object(tree_id)?.data.to_owned());
8181 }
8282 items.push(commit::history::Item {
8383 id: commit_id.detach(),