| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1182,9 +1182,6 @@ | |||
| 1182 | 1182 | "functions": { | |
| 1183 | 1183 | "git_pathspec_match_list_free": { | |
| 1184 | 1184 | "ignore": true | |
| 1185 | - }, | ||
| 1186 | - "git_pathspec_new": { | ||
| 1187 | - "ignore": true | ||
| 1188 | 1185 | } | |
| 1189 | 1186 | } | |
| 1190 | 1187 | }, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,6 +2,7 @@ var NodeGit = require("../"); | |||
| 2 | 2 | ||
| 3 | 3 | var Index = NodeGit.Index; | |
| 4 | 4 | var Status = NodeGit.Status; | |
| 5 | + var Pathspec = NodeGit.Pathspec; | ||
| 5 | 6 | var Promise = require("nodegit-promise"); | |
| 6 | 7 | /** | |
| 7 | 8 | * Return an array of the entries in this index. | |
@@ -25,15 +26,24 @@ Index.prototype.addAll = function(pathspec, flags, matchedCallback) { | |||
| 25 | 26 | // even if it has no changes. Remove this when it's fixed in libgit2 | |
| 26 | 27 | // https://github.com/libgit2/libgit2/issues/2687 | |
| 27 | 28 | var paths = []; | |
| 29 | + var repo = this.owner(); | ||
| 28 | 30 | var statusCB = function(path) { | |
| 29 | 31 | paths.push(path); | |
| 30 | 32 | }; | |
| 31 | - return Status.foreach(this.owner(), statusCB) | ||
| 33 | + var idx = this; | ||
| 34 | + return Pathspec.create(pathspec || "*") | ||
| 35 | + .then(function(ps) { | ||
| 36 | + pathspec = ps; | ||
| 37 | + return Status.foreach(repo, statusCB); | ||
| 38 | + }) | ||
| 32 | 39 | .then(function() { | |
| 33 | 40 | return Promise.resolve(paths); | |
| 34 | 41 | }) | |
| 35 | 42 | .then(function(paths) { | |
| 36 | - return addAll.call(this, pathspec || "*", flags, matchedCallback, null); | ||
| 43 | + paths = paths.filter(function(path) { | ||
| 44 | + return !!(pathspec.matchesPath(0, path)); | ||
| 45 | + }); | ||
| 46 | + return addAll.call(idx, paths, flags, matchedCallback, null); | ||
| 37 | 47 | }); | |
| 38 | 48 | }; | |
| 39 | 49 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments