FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Remove `Index#addAll` hack by johnhaley81 · Pull Request #875 · nodegit/nodegit · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .js  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
25 changes: 1 addition & 24 deletions lib/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL