You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

staged-git-files

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

staged-git-files - npm Package Compare versions

Comparing version
1.2.0
to
1.3.0
+4
-0
CHANGELOG.md
# 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";

{
"name": "staged-git-files",
"version": "1.2.0",
"version": "1.3.0",
"devDependencies": {

@@ -5,0 +5,0 @@ "should": "~2.0.1",

@@ -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 @@

@@ -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
sudo: false
language: node_js
node_js:
- '4'
- '5'
- '6'
- '7'
- '8'
- '9'
- '10'