We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 232dbb1 commit db1fc68Copy full SHA for db1fc68
1 file changed
examples/walk-history-for-file.js
@@ -17,25 +17,19 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
17
history.on("commit", function(commit) {
18
return commit.getDiff()
19
.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
26
- prevValDiff ||
27
- !!~patch.oldFile().path().indexOf("descriptor.json") ||
28
- !!~patch.newFile().path().indexOf("descriptor.json");
29
30
- return result;
31
- }, false);
32
33
34
35
36
- if (addCommit) {
37
- commits.push(commit);
38
- }
+ diffList.map(function(diff) {
+ diff.patches().then(function(patches) {
+ patches.map(function(patch) {
+ var result =
+ !!~patch.oldFile().path().indexOf("descriptor.json") ||
+ !!~patch.newFile().path().indexOf("descriptor.json");
+
+ if(result && !~commits.indexOf(commit)) {
+ commits.push(commit);
+ }
+ });
39
});
40
41
0 commit comments