Skip to content

Commit d113a1e

Browse files
Moret84zenobit
authored andcommitted
fix(git.ts): add relative flag to git diff command (di-sukharev#37)
The relative flag has been added to the git diff command in the getStagedFiles function. This flag makes the output of the command relative to the current working directory, which makes it easier to work with the file paths and enables executing opencommit from anywhere in the repository, not just from the root.
1 parent baa6a9a commit d113a1e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils/git.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export const getStagedFiles = async (): Promise<string[]> => {
2929
const { stdout: files } = await execa('git', [
3030
'diff',
3131
'--name-only',
32-
'--cached'
32+
'--cached',
33+
'--relative'
3334
]);
3435

3536
if (!files) return [];

0 commit comments

Comments
 (0)