From 0c73e01185295554a317f5a6fd873b6d19e3a6a7 Mon Sep 17 00:00:00 2001 From: John Haley Date: Wed, 20 Jan 2016 23:41:50 -0700 Subject: [PATCH 1/2] Remove `Index#addAll` hack Now that https://github.com/libgit2/libgit2/issues/2687 has landed we don't need our hack to speed up `Index#addAll` anymore. This fixes #751 --- lib/index.js | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/lib/index.js b/lib/index.js index a7f41571e..a9531e700 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,7 +1,6 @@ var NodeGit = require("../"); var Index = NodeGit.Index; -var Status = NodeGit.Status; var Pathspec = NodeGit.Pathspec; /** @@ -21,28 +20,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; From 5dd890962f19e3bfd379bc90900481b7f32ba879 Mon Sep 17 00:00:00 2001 From: John Haley Date: Wed, 20 Jan 2016 23:50:15 -0700 Subject: [PATCH 2/2] Fix linter --- lib/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index a9531e700..be905be60 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,7 +1,6 @@ var NodeGit = require("../"); var Index = NodeGit.Index; -var Pathspec = NodeGit.Pathspec; /** * Return an array of the entries in this index.