Skip to content

Commit 0097872

Browse files
authored
Merge pull request git-school#78 from git-school/mkt-fix-marking-branchless-commits
Fix marking traversable commits at second parent after first parent
2 parents 4b5644a + 22c7595 commit 0097872

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

js/historyview.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -859,18 +859,13 @@ define(['d3'], function() {
859859
parent = this.getCommit(commit.parent);
860860
parent2 = this.getCommit(commit.parent2);
861861

862-
commit.branchless = false;
863-
864-
while (parent) {
865-
parent.branchless = false;
866-
parent = this.getCommit(parent.parent);
862+
function walkCommit (commit) {
863+
commit.branchless = false
864+
commit.parent && walkCommit.call(this, this.getCommit(commit.parent))
865+
commit.parent2 && walkCommit.call(this, this.getCommit(commit.parent2))
867866
}
868867

869-
// just in case this is a merge commit
870-
while (parent2) {
871-
parent2.branchless = false;
872-
parent2 = this.getCommit(parent2.parent);
873-
}
868+
walkCommit.call(this, commit)
874869
}
875870
}
876871

0 commit comments

Comments
 (0)