fix: suppress git-svn noise that causes confusing errors on affected systems (#404)
Systems with a buggy git-svn Perl module (notably Arch Linux) emit "Duplicate specification" warnings on every git invocation. Filter these from error messages and suppress git-svn loading via GIT_SVN_ID. Also update repository URLs from stale glittercowboy/gsd-pi to gsd-build/gsd-2.
This commit is contained in:
parent
a896737df2
commit
9eb5a00f4f
4 changed files with 37 additions and 8 deletions
|
|
@ -5,11 +5,11 @@
|
|||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/glittercowboy/gsd-pi.git"
|
||||
"url": "https://github.com/gsd-build/gsd-2.git"
|
||||
},
|
||||
"homepage": "https://github.com/glittercowboy/gsd-pi#readme",
|
||||
"homepage": "https://github.com/gsd-build/gsd-2#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/glittercowboy/gsd-pi/issues"
|
||||
"url": "https://github.com/gsd-build/gsd-2/issues"
|
||||
},
|
||||
"type": "module",
|
||||
"workspaces": [
|
||||
|
|
|
|||
|
|
@ -205,13 +205,27 @@ export function writeIntegrationBranch(basePath: string, milestoneId: string, br
|
|||
|
||||
// ─── Git Helper ────────────────────────────────────────────────────────────
|
||||
|
||||
/** Env overlay that suppresses all interactive git credential prompts. */
|
||||
/** Env overlay that suppresses interactive git credential prompts and git-svn noise. */
|
||||
const GIT_NO_PROMPT_ENV = {
|
||||
...process.env,
|
||||
GIT_TERMINAL_PROMPT: "0",
|
||||
GIT_ASKPASS: "",
|
||||
GIT_SVN_ID: "",
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip git-svn noise from error messages.
|
||||
* Some systems (notably Arch Linux) have a buggy git-svn Perl module that
|
||||
* emits warnings on every git invocation, confusing users. See #404.
|
||||
*/
|
||||
function filterGitSvnNoise(message: string): string {
|
||||
return message
|
||||
.replace(/Duplicate specification "[^"]*" for option "[^"]*"\n?/g, "")
|
||||
.replace(/Unable to determine upstream SVN information from .*\n?/g, "")
|
||||
.replace(/Perhaps the repository is empty\. at .*git-svn.*\n?/g, "")
|
||||
.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a git command in the given directory.
|
||||
* Returns trimmed stdout. Throws on non-zero exit unless allowFailure is set.
|
||||
|
|
@ -229,7 +243,7 @@ export function runGit(basePath: string, args: string[], options: { allowFailure
|
|||
} catch (error) {
|
||||
if (options.allowFailure) return "";
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
throw new Error(`git ${args.join(" ")} failed in ${basePath}: ${message}`);
|
||||
throw new Error(`git ${args.join(" ")} failed in ${basePath}: ${filterGitSvnNoise(message)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,11 +7,12 @@
|
|||
|
||||
import { execSync } from "node:child_process";
|
||||
|
||||
/** Env overlay that suppresses all interactive git credential prompts. */
|
||||
/** Env overlay that suppresses interactive git credential prompts and git-svn noise. */
|
||||
const GIT_NO_PROMPT_ENV = {
|
||||
...process.env,
|
||||
GIT_TERMINAL_PROMPT: "0",
|
||||
GIT_ASKPASS: "",
|
||||
GIT_SVN_ID: "",
|
||||
};
|
||||
|
||||
let nativeModule: {
|
||||
|
|
|
|||
|
|
@ -46,13 +46,27 @@ export interface WorktreeDiffSummary {
|
|||
|
||||
// ─── Git Helpers ───────────────────────────────────────────────────────────
|
||||
|
||||
/** Env overlay that suppresses all interactive git credential prompts. */
|
||||
/** Env overlay that suppresses interactive git credential prompts and git-svn noise. */
|
||||
const GIT_NO_PROMPT_ENV = {
|
||||
...process.env,
|
||||
GIT_TERMINAL_PROMPT: "0",
|
||||
GIT_ASKPASS: "",
|
||||
GIT_SVN_ID: "",
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip git-svn noise from error messages.
|
||||
* Some systems have a buggy git-svn Perl module that emits warnings
|
||||
* on every git invocation. See #404.
|
||||
*/
|
||||
function filterGitSvnNoise(message: string): string {
|
||||
return message
|
||||
.replace(/Duplicate specification "[^"]*" for option "[^"]*"\n?/g, "")
|
||||
.replace(/Unable to determine upstream SVN information from .*\n?/g, "")
|
||||
.replace(/Perhaps the repository is empty\. at .*git-svn.*\n?/g, "")
|
||||
.trim();
|
||||
}
|
||||
|
||||
function runGit(cwd: string, args: string[], opts: { allowFailure?: boolean } = {}): string {
|
||||
try {
|
||||
return execSync(`git ${args.join(" ")}`, {
|
||||
|
|
@ -64,7 +78,7 @@ function runGit(cwd: string, args: string[], opts: { allowFailure?: boolean } =
|
|||
} catch (error) {
|
||||
if (opts.allowFailure) return "";
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
throw new Error(`git ${args.join(" ")} failed in ${cwd}: ${message}`);
|
||||
throw new Error(`git ${args.join(" ")} failed in ${cwd}: ${filterGitSvnNoise(message)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue