Skip to content

Commit cec3cc5

Browse files
committed
Trim git version output
1 parent 358a55e commit cec3cc5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/init-action.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/git-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export async function getGitVersionOrThrow(): Promise<GitVersionInfo> {
5252
);
5353
// Git version output can vary: "git version 2.40.0" or "git version 2.40.0.windows.1"
5454
// We capture just the major.minor.patch portion to ensure semver compatibility.
55-
const match = stdout.match(/^git version ((\d+\.\d+\.\d+).*)$/);
55+
const match = stdout.trim().match(/^git version ((\d+\.\d+\.\d+).*)$/);
5656
if (match?.[1] && match?.[2]) {
5757
return new GitVersionInfo(match[2], match[1]);
5858
}

0 commit comments

Comments
 (0)