Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 03496d8

Browse filesBrowse files
committed
Merge pull request nodegit#847 from pevers/master
Fixed example walk-history-for-file.js
2 parents f7f9c87 + db1fc68 commit 03496d8
Copy full SHA for 03496d8

File tree

Expand file treeCollapse file tree

1 file changed

+13
-19
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-19
lines changed
Open diff view settings
Collapse file

‎examples/walk-history-for-file.js‎

Copy file name to clipboardExpand all lines: examples/walk-history-for-file.js
+13-19Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,19 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
1717
history.on("commit", function(commit) {
1818
return commit.getDiff()
1919
.then(function(diffList) {
20-
var addCommit = diffList.reduce(function(prevVal, diff) {
21-
var result =
22-
prevVal ||
23-
diff.patches().reduce(function(prevValDiff, patch) {
24-
25-
var result =
26-
prevValDiff ||
27-
!!~patch.oldFile().path().indexOf("descriptor.json") ||
28-
!!~patch.newFile().path().indexOf("descriptor.json");
29-
30-
return result;
31-
}, false);
32-
33-
return result;
34-
}, false);
35-
36-
if (addCommit) {
37-
commits.push(commit);
38-
}
20+
diffList.map(function(diff) {
21+
diff.patches().then(function(patches) {
22+
patches.map(function(patch) {
23+
var result =
24+
!!~patch.oldFile().path().indexOf("descriptor.json") ||
25+
!!~patch.newFile().path().indexOf("descriptor.json");
26+
27+
if(result && !~commits.indexOf(commit)) {
28+
commits.push(commit);
29+
}
30+
});
31+
});
32+
});
3933
});
4034
});
4135

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.