diff --git a/.changeset/thirty-jobs-teach.md b/.changeset/thirty-jobs-teach.md new file mode 100644 index 000000000..554f40587 --- /dev/null +++ b/.changeset/thirty-jobs-teach.md @@ -0,0 +1,6 @@ +--- +"@changesets/git": patch +"@changesets/cli": patch +--- + +Avoid an infinite loop when git commands fail to execute when Changesets try to retrieve commits that added files. diff --git a/packages/git/src/index.ts b/packages/git/src/index.ts index c69841f27..bb632760c 100644 --- a/packages/git/src/index.ts +++ b/packages/git/src/index.ts @@ -178,7 +178,12 @@ export async function isRepoShallow({ cwd }: { cwd: string }) { } export async function deepenCloneBy({ by, cwd }: { by: number; cwd: string }) { - await exec("git", ["fetch", `--deepen=${by}`], { nodeOptions: { cwd } }); + const cmd = await exec("git", ["fetch", `--deepen=${by}`], { + nodeOptions: { cwd }, + }); + if (cmd.exitCode !== 0) { + throw new Error(cmd.stderr.toString()); + } } async function getRepoRoot({ cwd }: { cwd: string }) { const { stdout, exitCode, stderr } = await exec(