@coveo/semantic-monorepo-tools
Version:
A library of helper functions to do SemVer2 compliant releases from Conventional Commits in monorepos
22 lines (20 loc) • 528 B
text/typescript
import spawn from "../utils/spawn.js";
import gitLogger from "./utils/gitLogger.js";
export default async function (
remote: string,
completeRef: string,
commitSha1: string,
force = false,
) {
const refPair = `${commitSha1}:${completeRef}`;
if (refPair.startsWith("--") || remote.startsWith("--")) {
throw new Error(
`invalid param:${[remote, completeRef, commitSha1].join(",")}`,
);
}
await spawn(
"git",
["fetch", remote, refPair].concat(force ? ["--force"] : []),
gitLogger,
);
}