Skip to content

Commit

Permalink
tools/githelper: Add comment regarding unstaged changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Aug 5, 2020
1 parent ff15b5b commit eae9aba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/githelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ def get_changed_lines(
else:
changeset = from_ref if from_ref else "HEAD"

# We're using the pre-commit framework which stashes all unstaged changes
# before running the pre-commit hooks, so we don't need to add `--cached`
# here. Also, if we run 2 hooks that modify the files, the second hook
# should work on the diff that includes the unstaged changes made by the
# first hook, not the original diff.
cmd = ["git", "diff", "--patch", "--unified=0", changeset]
if include_files:
cmd.extend(["--", *include_files])
Expand Down

0 comments on commit eae9aba

Please sign in to comment.