mirror of
https://github.com/github/codeql-action.git
synced 2026-04-26 16:58:47 +00:00
Trim git version output
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ export async function getGitVersionOrThrow(): Promise<GitVersionInfo> {
|
||||
);
|
||||
// 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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user