From eae9aba66e932c4f3ba46d46db6a5cba4b9a9867 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 5 Aug 2020 10:52:52 +0200 Subject: [PATCH] tools/githelper: Add comment regarding unstaged changes --- tools/githelper.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/githelper.py b/tools/githelper.py index 8a2cdd7a209..c526db3d0e9 100644 --- a/tools/githelper.py +++ b/tools/githelper.py @@ -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])