Skip to content

Commit 6b08749

Browse files
committed
Fix one test
1 parent 9ac4ecb commit 6b08749

File tree

1 file changed

+11
-9
lines changed
  • crates/gitbutler-core/tests/virtual_branches

1 file changed

+11
-9
lines changed

crates/gitbutler-core/tests/virtual_branches/mod.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,19 +1077,21 @@ fn unapply_branch() -> Result<()> {
10771077
assert_eq!(branch.files.len(), 1);
10781078
assert!(branch.active);
10791079

1080-
virtual_branches::unapply_branch(project_repository, branch1_id)?;
1080+
let real_branch = virtual_branches::convert_to_real_branch(project_repository, branch1_id)?;
10811081

10821082
let contents = std::fs::read(Path::new(&project.path).join(file_path))?;
10831083
assert_eq!("line1\nline2\nline3\nline4\n", String::from_utf8(contents)?);
10841084
let contents = std::fs::read(Path::new(&project.path).join(file_path2))?;
10851085
assert_eq!("line5\nline6\n", String::from_utf8(contents)?);
10861086

10871087
let (branches, _) = virtual_branches::list_virtual_branches(project_repository)?;
1088-
let branch = &branches.iter().find(|b| b.id == branch1_id).unwrap();
1089-
assert_eq!(branch.files.len(), 1);
1090-
assert!(!branch.active);
1088+
assert!(!branches.iter().any(|b| b.id == branch1_id));
10911089

1092-
apply_branch(project_repository, branch1_id, None)?;
1090+
let branch1_id = virtual_branches::create_virtual_branch_from_branch(
1091+
project_repository,
1092+
&git::Refname::try_from(&real_branch)?,
1093+
None,
1094+
)?;
10931095
let contents = std::fs::read(Path::new(&project.path).join(file_path))?;
10941096
assert_eq!(
10951097
"line1\nline2\nline3\nline4\nbranch1\n",
@@ -1153,12 +1155,12 @@ fn apply_unapply_added_deleted_files() -> Result<()> {
11531155
},
11541156
)?;
11551157

1156-
virtual_branches::unapply_branch(project_repository, branch2_id)?;
1158+
virtual_branches::convert_to_real_branch(project_repository, branch2_id)?;
11571159
// check that file2 is back
11581160
let contents = std::fs::read(Path::new(&project.path).join(file_path2))?;
11591161
assert_eq!("file2\n", String::from_utf8(contents)?);
11601162

1161-
virtual_branches::unapply_branch(project_repository, branch3_id)?;
1163+
virtual_branches::convert_to_real_branch(project_repository, branch3_id)?;
11621164
// check that file3 is gone
11631165
assert!(!Path::new(&project.path).join(file_path3).exists());
11641166

@@ -1218,8 +1220,8 @@ fn detect_mergeable_branch() -> Result<()> {
12181220
.expect("failed to update branch");
12191221

12201222
// unapply both branches and create some conflicting ones
1221-
virtual_branches::unapply_branch(project_repository, branch1_id)?;
1222-
virtual_branches::unapply_branch(project_repository, branch2_id)?;
1223+
virtual_branches::convert_to_real_branch(project_repository, branch1_id)?;
1224+
virtual_branches::convert_to_real_branch(project_repository, branch2_id)?;
12231225

12241226
project_repository.repo().set_head("refs/heads/master")?;
12251227
project_repository

0 commit comments

Comments
 (0)