staged-git-files
Advanced tools
+4
-0
| # Change Log | ||
| ## 1.3.0 | ||
| - Adds [--relative](https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---relativeltpathgt) support to allow the listing of files in the current directoy. [#21](https://github.com/mcwhittemore/staged-git-files/pull/21) by [mgrsskls](https://github.com/mgrsskls). | ||
| ## 1.2.0 | ||
@@ -4,0 +8,0 @@ |
+17
-7
@@ -5,6 +5,13 @@ var spawn = require("child_process").spawn; | ||
| var sgf = function (filter, callback) { | ||
| if (typeof filter === 'function') { | ||
| callback = filter; | ||
| filter = undefined; | ||
| var sgf = function (options = {}, callback) { | ||
| const typeOfOptions = typeof options; | ||
| let filter; | ||
| if (typeOfOptions === 'function') { | ||
| callback = options; | ||
| filter = undefined; | ||
| } else if (typeOfOptions === 'string') { | ||
| filter = options; | ||
| } else { | ||
| filter = options.filter; | ||
| } | ||
@@ -18,6 +25,6 @@ | ||
| resolve(head); | ||
| }); | ||
| }, options); | ||
| }); | ||
| } else { | ||
| _sgf(filter, callback); | ||
| _sgf(filter, callback, options); | ||
| } | ||
@@ -27,3 +34,3 @@ }; | ||
| function _sgf (filter, callback) { | ||
| function _sgf (filter, callback, options) { | ||
| if (typeof filter === 'undefined') | ||
@@ -38,2 +45,5 @@ filter = 'ACDMRTUXB'; | ||
| if (options.relative) { | ||
| command += " --relative"; | ||
| } | ||
| if (filter.indexOf('R') !== -1) { | ||
@@ -40,0 +50,0 @@ command += " -M"; |
+1
-1
| { | ||
| "name": "staged-git-files", | ||
| "version": "1.2.0", | ||
| "version": "1.3.0", | ||
| "devDependencies": { | ||
@@ -5,0 +5,0 @@ "should": "~2.0.1", |
+3
-2
@@ -53,3 +53,5 @@ # Staged Git Files | ||
| * filter: string of git status codes. No spaces | ||
| * options: | ||
| * filter: string of git status codes. No spaces | ||
| * relative: boolean, tells [diff to run in relative mode](https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---relativeltpathgt) | ||
| * callback: | ||
@@ -67,3 +69,2 @@ * err: the error | ||
| main(); | ||
| ``` | ||
@@ -70,0 +71,0 @@ |
+27
-0
@@ -238,2 +238,29 @@ | ||
| describe("if the first param is an object", function() { | ||
| describe("and a filter is set", function() { | ||
| it("I should return a promise and resolve the status of staged files", function(done) { | ||
| addAndCommitFile(function(err, data) { | ||
| if (err) { | ||
| done(err); | ||
| } else { | ||
| var newFileName = randomFileName([8, 3]); | ||
| moveFile({ | ||
| oldFileName: data.filename, | ||
| newFileName: newFileName | ||
| }, function(err) { | ||
| var sgf = newSGF(); | ||
| sgf({ filter: 'A', relative: true }).then(function(results) { | ||
| results.length.should.equal(1); | ||
| results[0].filename.should.equal(newFileName); | ||
| results[0].status.should.equal("Added"); | ||
| done(); | ||
| }).catch(done); | ||
| }); | ||
| } | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
| it("readFile will aysnc read a file and return its content", function(done) { | ||
@@ -240,0 +267,0 @@ addFile(function(err, data) { |
| version: 2 # use CircleCI 2.0 | ||
| jobs: | ||
| build: | ||
| docker: | ||
| - image: circleci/node:7.10 | ||
| steps: # a collection of executable commands | ||
| - checkout # special step to check out source code to working directory | ||
| - run: | ||
| name: install-npm-wee | ||
| command: npm install | ||
| - run: # run tests | ||
| name: test | ||
| command: npm test |
-12
| sudo: false | ||
| language: node_js | ||
| node_js: | ||
| - '4' | ||
| - '5' | ||
| - '6' | ||
| - '7' | ||
| - '8' | ||
| - '9' | ||
| - '10' |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
26948
6.09%632
5.69%113
0.89%8
-20%9
12.5%