Skip to content

Commit

Permalink
fix: ignore deleted files when formatting (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
varl committed May 14, 2019
1 parent cdcb50a commit 4ebee0e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/git-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,20 @@ const stageFiles = (files, dir) => {
}

const stagedFiles = dir => {
const files = execSync('git diff --cached --name-only --relative', {
cwd: dir,
encoding: 'utf8',
}).trim()
const files = execSync(
'git diff --cached --name-only --relative --diff-filter=d',
{
cwd: dir,
encoding: 'utf8',
}
).trim()

if (!!files) {
const s = files.split('\n')
log.info(`Fetching staged files: ${s.length} file(s).`)
return s
}

log.info('No staged files found.')
return []
}
Expand Down

0 comments on commit 4ebee0e

Please sign in to comment.