mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-27 06:27:43 +00:00
tests: test exporting to Git after deleting a branch
This commit is contained in:
parent
f40c8d86a1
commit
979b46b006
1 changed files with 5 additions and 0 deletions
|
@ -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");
|
||||
|
@ -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!(
|
||||
|
@ -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"));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue