Skip to content

Commit

Permalink
feat: improve error messages when path is not found in commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MingweiSamuel committed Jan 26, 2024
1 parent 7892013 commit 8c45160
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/git/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,19 @@ pub fn change_since_last_release(package: &Package, ctx: &crate::Context) -> any
.peel_to_kind(object::Kind::Tree)?
.into_tree()
.peel_to_entry(components.clone())?
.expect("path must exist in current commit")
.unwrap_or_else(|| panic!("path '{}' must exist in current_commit `{}`", dir, current_commit))
.object_id();
let released_dir_id = released_target
.object()?
.peel_to_kind(object::Kind::Tree)?
.into_tree()
.peel_to_entry(components)?
.expect("path must exist as it was supposedly released there")
.unwrap_or_else(|| {
panic!(
"path '{}' in released_target commit `{}` must exist as it was supposedly released there. Was it moved to a different directory?",
dir, released_target
)
})
.object_id();

(released_dir_id != current_dir_id).then_some(PackageChangeKind::ChangedOrNew)
Expand Down

0 comments on commit 8c45160

Please sign in to comment.