commitplease
Advanced tools
Comparing version 2.7.8 to 2.7.9
13
index.js
@@ -120,3 +120,16 @@ var fs = require('fs') | ||
if (error) { | ||
if (/Not a git repository/.test(error.message)) { | ||
console.log(error.message) | ||
process.exit(0) | ||
} | ||
if (/does not have any commits yet/.test(error.message)) { | ||
console.log(error.message) | ||
process.exit(0) | ||
} | ||
console.error(error) | ||
process.exit(1) | ||
@@ -123,0 +136,0 @@ } |
{ | ||
"name": "commitplease", | ||
"version": "2.7.8", | ||
"version": "2.7.9", | ||
"description": "Validates strings as commit messages", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,3 +18,14 @@ #!/usr/bin/env node | ||
// Date.now() - mtime.getTime() is milliseconds, convert to seconds | ||
if ((Date.now() - mtime.getTime()) / 1000 < oldMessageSeconds) { | ||
var fresh = (Date.now() - mtime.getTime()) / 1000 < oldMessageSeconds | ||
// There are many scenarios that trigger the prepare-commit-msg hook | ||
// These scenarios pass different console parameters, see here: | ||
// https://www.kernel.org/pub/software/scm/git/docs/githooks.html | ||
// | ||
// A plain `git commit` is the only scenario that passes 3 entries | ||
// For all other scenarios (like `git commit -m`, squash or merge) | ||
// just delete oldMessagePath, do not actually suggest it to user | ||
var plain = process.argv === 3 | ||
if (plain && fresh) { | ||
fs.writeFileSync(process.argv[2], fs.readFileSync(oldMessagePath)) | ||
@@ -21,0 +32,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50762
1347