staged-git-files
Advanced tools
+28
| function oct2Decimal(oct) { | ||
| oct = parseInt(oct); | ||
| var i = 0, | ||
| bit, | ||
| sum = 0; | ||
| do { | ||
| bit = oct % 10; | ||
| sum += bit * Math.pow(8, i++); | ||
| } while ( (oct = ~~(oct / 10)) !== 0 ) | ||
| return sum; | ||
| } | ||
| function decode(string) { | ||
| string = string.trim(); | ||
| return string | ||
| .replace(/^\"(.+)\"$/, '$1') | ||
| // x >= 128 && x <= 255 | ||
| .replace(/(\\\d{3})+/g, function (_) { | ||
| var octArray = _.split('\\').slice(1); | ||
| var decArray = octArray.map(function(oct) { | ||
| return oct2Decimal(oct); | ||
| }); | ||
| return new Buffer(decArray).toString('utf8'); | ||
| }); | ||
| } | ||
| module.exports = decode; |
+4
-0
| # Change Log | ||
| ## 1.1.1 | ||
| - Fix bug where chinese files names were returned as unicode ids [#15](https://github.com/mcwhittemore/staged-git-files/pull/15) by [imcuttle](https://github.com/imcuttle) | ||
| ## 1.1.0 | ||
@@ -4,0 +8,0 @@ |
+1
-1
@@ -15,3 +15,3 @@ var spawn = require("child_process").spawn; | ||
| } else { | ||
| var command = "git diff-index --cached --name-status"; | ||
| var command = "git -c core.quotepath=false diff-index --cached --name-status"; | ||
@@ -18,0 +18,0 @@ if (filter.indexOf('R') !== -1) { |
+1
-1
| { | ||
| "name": "staged-git-files", | ||
| "version": "1.1.0", | ||
| "version": "1.1.1", | ||
| "devDependencies": { | ||
@@ -5,0 +5,0 @@ "should": "~2.0.1", |
+1
-1
@@ -39,3 +39,3 @@ # Staged Git Files | ||
| ```sh | ||
| $ staged-git-files | ||
| $ sgf | ||
| Added package.json | ||
@@ -42,0 +42,0 @@ Modified readme.md |
+21
-0
@@ -216,2 +216,23 @@ | ||
| it("the staged filename contains chinese", function(done) { | ||
| addAndCommitFile(function(err, data) { | ||
| if (err) { | ||
| done(err); | ||
| } else { | ||
| var newFileName = '你好世界'; | ||
| moveFile({ | ||
| oldFileName: data.filename, | ||
| newFileName: newFileName | ||
| }, function(err) { | ||
| var sgf = newSGF(); | ||
| sgf(asyncCatch(done, function(results) { | ||
| results.length.should.equal(1); | ||
| results[0].filename.should.equal(newFileName); | ||
| results[0].status.should.equal("Renamed"); | ||
| })); | ||
| }); | ||
| } | ||
| }); | ||
| }); | ||
| after(function(done) { | ||
@@ -218,0 +239,0 @@ cleanUp(done); |
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
22689
7.81%10
11.11%544
8.8%6
20%