Skip to content

Commit 1662362

Browse files
authored
chore: fix postinstall when using tarball (#60443)
The postinstall script was failing In the case when you download [a zip](https://codeload.github.com/vercel/next.js/zip/refs/heads/canary) of the repo. This PR fixes it so that `git config` can fail silently in that case when the repo is not using git. - Related to nodejs/citgm#1044 Closes NEXT-2036
1 parent 51bda32 commit 1662362

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"next-no-sourcemaps": "cross-env NEXT_TELEMETRY_DISABLED=1 node --trace-deprecation packages/next/dist/bin/next",
5252
"clean-trace-jaeger": "node scripts/rm.mjs test/integration/basic/.next && TRACE_TARGET=JAEGER pnpm next build test/integration/basic",
5353
"debug": "cross-env NEXT_TELEMETRY_DISABLED=1 node --inspect packages/next/dist/bin/next",
54-
"postinstall": "git config index.skipHash false && node scripts/install-native.mjs",
54+
"postinstall": "node scripts/git-configure.mjs && node scripts/install-native.mjs",
5555
"version": "pnpm install --no-frozen-lockfile && IS_PUBLISH=yes ./scripts/check-pre-compiled.sh && git add .",
5656
"prepare": "husky install",
5757
"sync-react": "node ./scripts/sync-react.js",

scripts/git-configure.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import execa from 'execa'
2+
3+
// See https://github.com/vercel/next.js/pull/47375
4+
const { stdout, stderr } = await execa(
5+
'git',
6+
['config', 'index.skipHash', 'false'],
7+
{
8+
reject: false,
9+
}
10+
)
11+
12+
console.log(stderr + stdout)

0 commit comments

Comments
 (0)