Skip to content

Commit

Permalink
tests: test exporting to Git after deleting a branch
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvonz committed Nov 10, 2022
1 parent fcce180 commit 67f26cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/tests/test_git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,9 @@ fn test_export_refs_branch_changed() {
git_repo
.reference("refs/heads/feature", commit.id(), false, "test")
.unwrap();
git_repo
.reference("refs/heads/delete-me", commit.id(), false, "test")
.unwrap();
git_repo.set_head("refs/heads/feature").unwrap();

let mut tx = test_data.repo.start_transaction("test");
Expand All @@ -478,6 +481,7 @@ fn test_export_refs_branch_changed() {
"main".to_string(),
RefTarget::Normal(new_commit.id().clone()),
);
tx.mut_repo().remove_local_branch("delete-me");
test_data.repo = tx.commit();
assert_eq!(git::export_refs(&test_data.repo, &git_repo), Ok(()));
assert_eq!(
Expand All @@ -489,6 +493,7 @@ fn test_export_refs_branch_changed() {
.id(),
git_id(&new_commit)
);
assert!(git_repo.find_reference("refs/heads/delete-me").is_err());
// HEAD should be unchanged since its target branch didn't change
assert_eq!(git_repo.head().unwrap().name(), Some("refs/heads/feature"));
}
Expand Down

0 comments on commit 67f26cc

Please sign in to comment.