Skip to content

Commit 0e79acf

Browse files
committed
bin: allow file:/// urls to files containing commit messages
Semver: minor
1 parent c1c4c77 commit 0e79acf

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

bin/cmd.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ function loadPatch(uri, cb) {
5959
var h = http
6060
if (~uri.protocol.indexOf('https')) {
6161
h = https
62+
} else if(~uri.protocol.indexOf('file:')) {
63+
return fs.readFile(uri.pathname, (err, data) => {
64+
if(err) return cb(err);
65+
return cb(null, data.toString('utf-8'));
66+
});
6267
}
6368
uri.headers = {
6469
'user-agent': 'core-validate-commit'

bin/usage.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ core-validate-commit - Validate the commit message for a particular commit in no
2525
Passing a url to a specific sha on github:
2626

2727
$ core-validate-commit https://api.github.com/repos/nodejs/node/git/commits/9e9d499b8be8ffc6050db25129b042507d7b4b02
28+
29+
Passing a file containing a single commit message:
30+
31+
$ core-validate-commit file:///tmp/commitmsg.txt
32+

0 commit comments

Comments
 (0)