Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/repo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down
14 changes: 9 additions & 5 deletions src/repo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'path';
import {
runCommand,
getStdoutFromCommand,
Expand Down Expand Up @@ -112,11 +113,14 @@ async function getFilesChangedSince(
repositoryDirectoryPath: string,
tagName: string,
): Promise<string[]> {
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),
);
}

/**
Expand Down