Skip to content

Commit 7cea47f

Browse files
committed
fix: switch to simpler git commit message body command
1 parent a4aba68 commit 7cea47f

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

bin/commit-message-install.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if (args.file) {
1515
const message = fs.readFileSync(args.file, 'utf8')
1616
start = Promise.resolve(message)
1717
} else {
18-
start = getMessage().then(x => x.body)
18+
start = getMessage()
1919
}
2020
start.then(getJsonBlock).then(json => {
2121
if (!json) {

bin/commit-message-run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if (args.file) {
3131
const message = fs.readFileSync(args.file, 'utf8')
3232
start = Promise.resolve(message)
3333
} else {
34-
start = getMessage().then(x => x.body)
34+
start = getMessage()
3535
}
3636
start.then(getJsonBlock).then(json => {
3737
if (!json) {

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
"check-more-types": "2.24.0",
104104
"debug": "3.1.0",
105105
"execa": "0.8.0",
106-
"ggit": "2.4.0",
107106
"lazy-ass": "1.6.0",
108107
"minimist": "1.2.0"
109108
}

src/commit-message-install-spec.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,9 @@ const snapshot = require('snap-shot-it')
99

1010
describe('commit-message-install', () => {
1111
context('gets last commit message', () => {
12-
const isMessage = is.schema({
13-
email: is.unemptyString,
14-
subject: is.unemptyString,
15-
body: is.maybe.unemptyString
16-
})
17-
it('returns an object', () => {
12+
it('returns just the body of the commit message', () => {
1813
return getMessage().then(x => {
19-
la(isMessage(x), 'invalid message format', x)
14+
la(is.maybe.unemptyString(x), 'invalid message format', x)
2015
})
2116
})
2217
})

src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict'
22

3-
const ggit = require('ggit')
43
const debug = require('debug')('commit-message-install')
54
const la = require('lazy-ass')
65
const is = require('check-more-types')
@@ -11,7 +10,10 @@ const chalk = require('chalk')
1110
const prop = name => object => object[name]
1211

1312
function getMessage () {
14-
return ggit.lastCommitId().then(ggit.commitMessage)
13+
debug('getting last git commit message body')
14+
return execa
15+
.shell('git show -s --pretty=%b', { stdio: 'inherit' })
16+
.then(prop('stdout'))
1517
}
1618

1719
// parses given commit message text (body)

0 commit comments

Comments
 (0)