diff --git a/lib/init-action.js b/lib/init-action.js index e267eaab2..37656350c 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -88362,7 +88362,7 @@ async function listFiles(workingDirectory) { ["ls-files"], "Unable to list tracked files." ); - return stdout.split(os2.EOL); + return stdout.split(os2.EOL).filter((line) => line.trim().length > 0); } async function getGeneratedFiles(workingDirectory) { const files = await listFiles(workingDirectory); @@ -88376,8 +88376,8 @@ async function getGeneratedFiles(workingDirectory) { const regex = /^([^:]+): linguist-generated: true$/; for (const result of stdout.split(os2.EOL)) { const match = result.match(regex); - if (match) { - generatedFiles.push(match[1]); + if (match && match[1].trim().length > 0) { + generatedFiles.push(match[1].trim()); } } return generatedFiles; diff --git a/src/git-utils.ts b/src/git-utils.ts index 002f6f056..6b792ea54 100644 --- a/src/git-utils.ts +++ b/src/git-utils.ts @@ -411,7 +411,7 @@ export async function listFiles(workingDirectory: string): Promise { ["ls-files"], "Unable to list tracked files.", ); - return stdout.split(os.EOL); + return stdout.split(os.EOL).filter((line) => line.trim().length > 0); } /** @@ -434,8 +434,8 @@ export async function getGeneratedFiles( const regex = /^([^:]+): linguist-generated: true$/; for (const result of stdout.split(os.EOL)) { const match = result.match(regex); - if (match) { - generatedFiles.push(match[1]); + if (match && match[1].trim().length > 0) { + generatedFiles.push(match[1].trim()); } }