Skip to content

Commit 478ef82

Browse files
committed
refactor(engine): resolve conflict in csm.util.ts
1 parent b1ab100 commit 478ef82

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

packages/analysis-engine/src/csm.util.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { FIRST_PARENT_INDEX } from "./csm.const";
21
import type { CommitDict, CommitNode, Stem } from "./types";
32

43
/** Gets the second parent (starting point of merged branch) of a merge commit. */
5-
export const getFirstParentCommit = (baseCommitNode: CommitNode, commitDict: CommitDict): CommitNode | undefined => {
6-
return commitDict.get(baseCommitNode.commit.parents[FIRST_PARENT_INDEX]);
4+
export const getParentCommits = (baseCommitNode: CommitNode, commitDict: CommitDict): CommitNode[] => {
5+
return baseCommitNode.commit.parents
6+
.slice(1)
7+
.map((parentId) => commitDict.get(parentId))
8+
.filter((commit): commit is CommitNode => !!commit);
79
};
810

911
/** Finds the index of a specific commit node in a stem. */
@@ -19,7 +21,7 @@ export const findSquashEndIndex = (stem: Stem, startIndex: number): number => {
1921
let endIndex = stem.nodes.length - 1;
2022

2123
for (let i = startIndex + 1; i < stem.nodes.length; i++) {
22-
if (stem.nodes[i].mergedIntoStem) {
24+
if (stem.nodes[i].mergedIntoBaseStem) {
2325
endIndex = i - 1;
2426
break;
2527
}

0 commit comments

Comments
 (0)