This commit is contained in:
Mikayla Maki 2023-05-09 14:49:35 -07:00 committed by Mikayla Maki
parent e98507d8bf
commit 18cec8d64f
No known key found for this signature in database
2 changed files with 23 additions and 34 deletions

View file

@ -3787,14 +3787,9 @@ mod tests {
let oid = repo.index().unwrap().write_tree().unwrap();
let tree = repo.find_tree(oid).unwrap();
if let Some(head) = repo.head().ok() {
let parent_obj = head
.peel(git2::ObjectType::Commit)
.unwrap();
let parent_commit = parent_obj
.as_commit()
.unwrap();
let parent_obj = head.peel(git2::ObjectType::Commit).unwrap();
let parent_commit = parent_obj.as_commit().unwrap();
repo.commit(
Some("HEAD"),
@ -3806,15 +3801,8 @@ mod tests {
)
.expect("Failed to commit with parent");
} else {
repo.commit(
Some("HEAD"),
&signature,
&signature,
msg,
&tree,
&[],
)
.expect("Failed to commit");
repo.commit(Some("HEAD"), &signature, &signature, msg, &tree, &[])
.expect("Failed to commit");
}
}
@ -3842,14 +3830,13 @@ mod tests {
.expect("Could not reset");
}
#[allow(dead_code)]
#[track_caller]
fn git_status(repo: &git2::Repository) -> HashMap<String, git2::Status> {
repo.statuses(None)
.unwrap()
.iter()
.map(|status| {
(status.path().unwrap().to_string(), status.status())
})
.map(|status| (status.path().unwrap().to_string(), status.status()))
.collect()
}
@ -3931,10 +3918,8 @@ mod tests {
let snapshot = tree.snapshot();
let (_, repo) = snapshot.repository_entries.iter().next().unwrap();
dbg!(&repo.statuses);
assert_eq!(repo.statuses.iter().count(), 1);
assert_eq!(repo.statuses.get(&Path::new(A_TXT).into()), None);
assert_eq!(