@oakgreencc/graft 0.2.16 → 0.2.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/git-hooks.mjs +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oakgreencc/graft",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"description": "Let an agent work a GitHub project without the local git CLI's write path: Verified commits created by a GitHub App, the repo's git hooks run at the right moments, CODEOWNERS as the manifest of what needs a human, and a scoped maintainer mode for when one says yes.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
package/src/git-hooks.mjs
CHANGED
|
@@ -112,7 +112,9 @@ export function hookRunner({ git, root, config, skip = false, report = () => {},
|
|
|
112
112
|
stdio: [input === undefined ? 'ignore' : 'pipe', 2, 2],
|
|
113
113
|
})
|
|
114
114
|
ran.push(name)
|
|
115
|
-
|
|
115
|
+
// A hook that exits without reading its stdin (pre-push's ref lines) makes the write fail with EPIPE. That is
|
|
116
|
+
// not a failure to run: as git does, judge the hook by its exit status.
|
|
117
|
+
if (res.error && !(epipe(res.error) && res.status !== null))
|
|
116
118
|
throw new PublishError(`refusing to publish: the \`${name}\` hook could not run: ${res.error.message}`)
|
|
117
119
|
if (res.status !== 0)
|
|
118
120
|
throw new PublishError(
|
|
@@ -230,6 +232,9 @@ export function previewCommit({ git, tree, parents, message }) {
|
|
|
230
232
|
}).trim()
|
|
231
233
|
}
|
|
232
234
|
|
|
235
|
+
/** @param {Error} err */
|
|
236
|
+
const epipe = (err) => /** @type {NodeJS.ErrnoException} */ (err).code === 'EPIPE'
|
|
237
|
+
|
|
233
238
|
function defaultSpawn(file, args, opts) {
|
|
234
239
|
return spawnSync(file, args, { ...opts, encoding: 'utf8' })
|
|
235
240
|
}
|