Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
var NodeGit = require("../");

var Index = NodeGit.Index;
var Status = NodeGit.Status;
var Pathspec = NodeGit.Pathspec;

/**
* Return an array of the entries in this index.
Expand All @@ -21,28 +19,7 @@ Index.prototype.entries = function() {

var addAll = Index.prototype.addAll;
Index.prototype.addAll = function(pathspec, flags, matchedCallback) {
// This status path code is here to speedup addall, which currently is
// excessively slow due to adding every single unignored file to the index
// even if it has no changes. Remove this when it's fixed in libgit2
// https://github.com/libgit2/libgit2/issues/2687
var paths = [];
var repo = this.owner();
var statusCB = function(path) {
paths.push(path);
};
var idx = this;
var ps = Pathspec.create(pathspec || "*");

return Status.foreach(repo, statusCB)
.then(function() {
return paths;
})
.then(function(paths) {
paths = paths.filter(function(path) {
return !!(ps.matchesPath(0, path));
});
return addAll.call(idx, paths, flags, matchedCallback, null);
});
return addAll.call(this, pathspec || "*", flags, matchedCallback, null);
};

var removeAll = Index.prototype.removeAll;
Expand Down