@@ -4,6 +4,7 @@ import debug from 'debug'
44
55import { execGit } from './execGit.js'
66import { readFile , unlink , writeFile } from './file.js'
7+ import { getDiffCommand } from './getDiffCommand.js'
78import {
89 GitError ,
910 RestoreOriginalStateError ,
@@ -65,12 +66,13 @@ const handleError = (error, ctx, symbol) => {
6566}
6667
6768export class GitWorkflow {
68- constructor ( { allowEmpty, gitConfigDir, gitDir, matchedFileChunks } ) {
69+ constructor ( { allowEmpty, gitConfigDir, gitDir, matchedFileChunks, diff , diffFilter } ) {
6970 this . execGit = ( args , options = { } ) => execGit ( args , { ...options , cwd : gitDir } )
7071 this . deletedFiles = [ ]
7172 this . gitConfigDir = gitConfigDir
7273 this . gitDir = gitDir
73- this . unstagedDiff = null
74+ this . diff = diff
75+ this . diffFilter = diffFilter
7476 this . allowEmpty = allowEmpty
7577 this . matchedFileChunks = matchedFileChunks
7678
@@ -262,7 +264,7 @@ export class GitWorkflow {
262264
263265 debugLog ( 'Done adding task modifications to index!' )
264266
265- const stagedFilesAfterAdd = await this . execGit ( [ ' diff' , '--name-only' , '--cached' ] )
267+ const stagedFilesAfterAdd = await this . execGit ( getDiffCommand ( this . diff , this . diffFilter ) )
266268 if ( ! stagedFilesAfterAdd && ! this . allowEmpty ) {
267269 // Tasks reverted all staged changes and the commit would be empty
268270 // Throw error to stop commit unless `--allow-empty` was used
0 commit comments