diff --git a/src/repo.test.ts b/src/repo.test.ts index aad954d..517ad08 100644 --- a/src/repo.test.ts +++ b/src/repo.test.ts @@ -175,10 +175,7 @@ describe('repo', () => { .calledWith('git', ['diff', 'v1.0.0', 'HEAD', '--name-only'], { cwd: '/path/to/repo', }) - .mockResolvedValue([ - '/path/to/repo/file1', - '/path/to/repo/subdirectory/file1', - ]); + .mockResolvedValue(['file1', 'subdirectory/file1']); const hasChanges = await hasChangesInDirectorySinceGitTag( '/path/to/repo', @@ -194,7 +191,7 @@ describe('repo', () => { .calledWith('git', ['diff', 'v2.0.0', 'HEAD', '--name-only'], { cwd: '/path/to/repo', }) - .mockResolvedValue(['/path/to/repo/file1', '/path/to/repo/file2']); + .mockResolvedValue(['file1', 'file2']); const hasChanges = await hasChangesInDirectorySinceGitTag( '/path/to/repo', diff --git a/src/repo.ts b/src/repo.ts index a2488a3..2741101 100644 --- a/src/repo.ts +++ b/src/repo.ts @@ -1,3 +1,4 @@ +import path from 'path'; import { runCommand, getStdoutFromCommand, @@ -112,11 +113,14 @@ async function getFilesChangedSince( repositoryDirectoryPath: string, tagName: string, ): Promise { - return await getLinesFromGitCommandWithin(repositoryDirectoryPath, 'diff', [ - tagName, - 'HEAD', - '--name-only', - ]); + const partialFilePaths = await getLinesFromGitCommandWithin( + repositoryDirectoryPath, + 'diff', + [tagName, 'HEAD', '--name-only'], + ); + return partialFilePaths.map((partialFilePath) => + path.join(repositoryDirectoryPath, partialFilePath), + ); } /**