From 046731bcdc5750856bd99a246fe5a0e61a450beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Colladon?= Date: Thu, 7 Nov 2024 23:53:38 +0100 Subject: [PATCH] fix: path parameter issue --- src/adapter/GitAdapter.ts | 8 ++++---- src/utils/fsHelper.ts | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/adapter/GitAdapter.ts b/src/adapter/GitAdapter.ts index d8477b94..97b10a95 100644 --- a/src/adapter/GitAdapter.ts +++ b/src/adapter/GitAdapter.ts @@ -101,7 +101,7 @@ export default class GitAdapter { const bufferFiles: { path: string; content: Buffer }[] = [] for (const filePath of filesPath) { const fileContent = await this.getBufferContent({ - path, + path: filePath, oid: this.config.to, }) bufferFiles.push({ @@ -117,12 +117,12 @@ export default class GitAdapter { for (const changeType of [ADDITION, MODIFICATION, DELETION]) { const linesOfType = await this.getDiffForType(changeType) lines.push( - ...linesOfType.map(statLine => - treatPathSep(statLine).replace(NUM_STAT_REGEX, `${changeType}${TAB}`) + ...linesOfType.map(line => + line.replace(NUM_STAT_REGEX, `${changeType}${TAB}`) ) ) } - return lines + return lines.map(treatPathSep) } protected async getDiffForType(changeType: string): Promise { diff --git a/src/utils/fsHelper.ts b/src/utils/fsHelper.ts index b4bcd5b4..ece1cfa7 100644 --- a/src/utils/fsHelper.ts +++ b/src/utils/fsHelper.ts @@ -24,8 +24,7 @@ export const copyFiles = async (config: Config, src: string) => { } try { const gitAdapter = GitAdapter.getInstance(config) - const files = await gitAdapter.getFilesFrom(src) - for (const file of files) { + for await (const file of gitAdapter.getFilesFrom(src)) { // Use Buffer to output the file content // Let fs implementation detect the encoding ("utf8" or "binary") const dst = join(config.output, file.path)