From cec3cc57827755faed13f01dc96801a5a238d1b6 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Thu, 18 Dec 2025 12:52:30 +0000 Subject: [PATCH] Trim git version output --- lib/init-action.js | 2 +- src/git-utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/init-action.js b/lib/init-action.js index d1962bdb9..1143c6e7a 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -91564,7 +91564,7 @@ async function getGitVersionOrThrow() { ["--version"], "Failed to get git version." ); - const match = stdout.match(/^git version ((\d+\.\d+\.\d+).*)$/); + const match = stdout.trim().match(/^git version ((\d+\.\d+\.\d+).*)$/); if (match?.[1] && match?.[2]) { return new GitVersionInfo(match[2], match[1]); } diff --git a/src/git-utils.ts b/src/git-utils.ts index c2be2ec65..7902f845f 100644 --- a/src/git-utils.ts +++ b/src/git-utils.ts @@ -52,7 +52,7 @@ export async function getGitVersionOrThrow(): Promise { ); // Git version output can vary: "git version 2.40.0" or "git version 2.40.0.windows.1" // We capture just the major.minor.patch portion to ensure semver compatibility. - const match = stdout.match(/^git version ((\d+\.\d+\.\d+).*)$/); + const match = stdout.trim().match(/^git version ((\d+\.\d+\.\d+).*)$/); if (match?.[1] && match?.[2]) { return new GitVersionInfo(match[2], match[1]); }