| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,7 @@ | |||
| 1 | 1 | var NodeGit = require("../"); | |
| 2 | 2 | ||
| 3 | 3 | var Index = NodeGit.Index; | |
| 4 | - | ||
| 4 | + var Status = NodeGit.Status; | ||
| 5 | 5 | /** | |
| 6 | 6 | * Return an array of the entries in this index. | |
| 7 | 7 | * @return {Array<IndexEntry>} an array of IndexEntrys | |
@@ -19,7 +19,21 @@ Index.prototype.entries = function() { | |||
| 19 | 19 | ||
| 20 | 20 | var addAll = Index.prototype.addAll; | |
| 21 | 21 | Index.prototype.addAll = function(pathspec, flags, matchedCallback) { | |
| 22 | - return addAll.call(this, pathspec || "*", flags, matchedCallback, null); | ||
| 22 | + // This status path code is here to speedup addall, which currently is | ||
| 23 | + // excessively slow due to adding every single unignored file to the index | ||
| 24 | + // even if it has no changes. Remove this when it's fixed in libgit2 | ||
| 25 | + // https://github.com/libgit2/libgit2/issues/2687 | ||
| 26 | + var paths = []; | ||
| 27 | + var statusCB = function(path) { | ||
| 28 | + paths.push(path); | ||
| 29 | + }; | ||
| 30 | + return NodeGit.Status.foreach(repo, statusCB) | ||
| 31 | + .then(function() { | ||
| 32 | + return Promise.resolve(paths); | ||
| 33 | + }) | ||
| 34 | + .then(function(paths) { | ||
| 35 | + return addAll.call(this, pathspec || "*", flags, matchedCallback, null); | ||
| 36 | + }); | ||
| 23 | 37 | }; | |
| 24 | 38 | ||
| 25 | 39 | var removeAll = Index.prototype.removeAll; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments