Skip to content

Commit 0c73e01

Browse files
author
John Haley
committed
Remove Index#addAll hack
Now that libgit2/libgit2#2687 has landed we don't need our hack to speed up `Index#addAll` anymore. This fixes nodegit#751
1 parent 17209fc commit 0c73e01

1 file changed

Lines changed: 1 addition & 23 deletions

File tree

lib/index.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
var NodeGit = require("../");
22

33
var Index = NodeGit.Index;
4-
var Status = NodeGit.Status;
54
var Pathspec = NodeGit.Pathspec;
65

76
/**
@@ -21,28 +20,7 @@ Index.prototype.entries = function() {
2120

2221
var addAll = Index.prototype.addAll;
2322
Index.prototype.addAll = function(pathspec, flags, matchedCallback) {
24-
// This status path code is here to speedup addall, which currently is
25-
// excessively slow due to adding every single unignored file to the index
26-
// even if it has no changes. Remove this when it's fixed in libgit2
27-
// https://github.com/libgit2/libgit2/issues/2687
28-
var paths = [];
29-
var repo = this.owner();
30-
var statusCB = function(path) {
31-
paths.push(path);
32-
};
33-
var idx = this;
34-
var ps = Pathspec.create(pathspec || "*");
35-
36-
return Status.foreach(repo, statusCB)
37-
.then(function() {
38-
return paths;
39-
})
40-
.then(function(paths) {
41-
paths = paths.filter(function(path) {
42-
return !!(ps.matchesPath(0, path));
43-
});
44-
return addAll.call(idx, paths, flags, matchedCallback, null);
45-
});
23+
return addAll.call(this, pathspec || "*", flags, matchedCallback, null);
4624
};
4725

4826
var removeAll = Index.prototype.removeAll;

0 commit comments

Comments
 (0)