Skip to content

Commit

Permalink
Fix usage without modified files of git hook
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Jul 11, 2020
1 parent 7769781 commit ea0642d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions isort/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def git_hook(strict: bool = False, modify: bool = False) -> int:
# Get list of files modified and staged
diff_cmd = ["git", "diff-index", "--cached", "--name-only", "--diff-filter=ACMRTUXB", "HEAD"]
files_modified = get_lines(diff_cmd)
if not files_modified:
return 0

errors = 0
config = Config(settings_path=os.path.dirname(os.path.abspath(files_modified[0])))
Expand Down

0 comments on commit ea0642d

Please sign in to comment.