Skip to content

Commit cd31aee

Browse files
committed
fix: Do not simplify first parent. Add test case
1 parent 1d3e8e5 commit cd31aee

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

asyncgit/src/sync/revwalk.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub fn is_continuous(
1717
let repo = repo(repo_path)?;
1818
let mut revwalk = repo.revwalk()?;
1919
revwalk.set_sorting(git2::Sort::TOPOLOGICAL)?;
20-
revwalk.simplify_first_parent()?;
2120
revwalk.push(commits[0].get_oid())?;
2221
let revwalked: Vec<Oid> =
2322
revwalk
@@ -90,7 +89,7 @@ mod tests_is_continuous {
9089
let repo_path: &RepoPath =
9190
&root.as_os_str().to_str().unwrap().into();
9291

93-
let _c0 = commit(repo_path, "commit 0").unwrap();
92+
let c0 = commit(repo_path, "commit 0").unwrap();
9493
let c1 = commit(repo_path, "commit 1").unwrap();
9594
let c2 = commit(repo_path, "commit 2").unwrap();
9695

@@ -106,7 +105,13 @@ mod tests_is_continuous {
106105
"range including merge should not be continuous"
107106
);
108107

109-
let result = is_continuous(repo_path, &[c2, c1]).unwrap();
108+
let result = is_continuous(repo_path, &[c4, c3, c1]).unwrap();
109+
assert!(
110+
!result,
111+
"range including merge should not be continuous (following second parent commit)"
112+
);
113+
114+
let result = is_continuous(repo_path, &[c2, c1, c0]).unwrap();
110115
assert!(
111116
result,
112117
"linear range before merge should be continuous"

0 commit comments

Comments
 (0)