fix(coding-agent): resolved duplicate -c in coding-agent git commands
- Added SHORT_LIVED_GIT_CONFIG constants and withShortLivedGitConfig helper for short-lived overrides. - Updated runCommand to route git args through short-lived config normalization and avoid duplicate -c entries. - Added scripts/release git() helper and replaced raw release git invocations with config-safe calls. - Added git-process-config tests asserting status and stage spawn git with disabled core.fsmonitor/untrackedCache.
This commit is contained in:
+13
-9
@@ -15,12 +15,16 @@ const changelogGlob = new Glob("packages/*/CHANGELOG.md");
|
||||
const packageJsonGlob = new Glob("packages/*/package.json");
|
||||
const cargoTomlGlob = new Glob("crates/*/Cargo.toml");
|
||||
|
||||
function git(args: readonly string[]) {
|
||||
return $`git -c core.fsmonitor=false -c core.untrackedCache=false ${args}`;
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// Shared functions
|
||||
// =============================================================================
|
||||
|
||||
async function watchCI(): Promise<boolean> {
|
||||
const commitSha = (await $`git rev-parse HEAD`.text()).trim();
|
||||
const commitSha = (await git(["rev-parse", "HEAD"]).text()).trim();
|
||||
console.log(` Commit: ${commitSha.slice(0, 8)}`);
|
||||
|
||||
while (true) {
|
||||
@@ -185,14 +189,14 @@ async function cmdRelease(version: string): Promise<void> {
|
||||
// 1. Pre-flight checks
|
||||
console.log("Pre-flight checks...");
|
||||
|
||||
const branch = await $`git branch --show-current`.text();
|
||||
const branch = await git(["branch", "--show-current"]).text();
|
||||
if (branch.trim() !== "main") {
|
||||
console.error(`Error: Must be on main branch (currently on '${branch.trim()}')`);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(" On main branch");
|
||||
|
||||
const status = await $`git status --porcelain`.text();
|
||||
const status = await git(["status", "--porcelain"]).text();
|
||||
if (status.trim()) {
|
||||
console.error("Error: Uncommitted changes detected. Commit or stash first.");
|
||||
console.error(status);
|
||||
@@ -200,7 +204,7 @@ async function cmdRelease(version: string): Promise<void> {
|
||||
}
|
||||
console.log(" Working directory clean");
|
||||
|
||||
const latestTag = (await $`git describe --tags --abbrev=0`.text()).trim();
|
||||
const latestTag = (await git(["describe", "--tags", "--abbrev=0"]).text()).trim();
|
||||
if (compareVersions(version, latestTag) <= 0) {
|
||||
console.error(`Error: Version ${version} must be greater than latest tag ${latestTag}`);
|
||||
process.exit(1);
|
||||
@@ -274,15 +278,15 @@ async function cmdRelease(version: string): Promise<void> {
|
||||
|
||||
// 7. Commit and tag
|
||||
console.log("Committing and tagging...");
|
||||
await $`git add .`;
|
||||
await $`git commit -m ${`chore: bump version to ${version}`}`;
|
||||
await $`git tag ${`v${version}`}`;
|
||||
await git(["add", "."]);
|
||||
await git(["commit", "-m", `chore: bump version to ${version}`]);
|
||||
await git(["tag", `v${version}`]);
|
||||
console.log();
|
||||
|
||||
// 8. Push
|
||||
console.log("Pushing to remote...");
|
||||
await $`git push origin main`;
|
||||
await $`git push origin ${`v${version}`}`;
|
||||
await git(["push", "origin", "main"]);
|
||||
await git(["push", "origin", `v${version}`]);
|
||||
console.log();
|
||||
|
||||
// 9. Watch CI
|
||||
|
||||
Reference in New Issue
Block a user