From 40a1472cc54c52c27f493236e792e9ce7dd9f4f9 Mon Sep 17 00:00:00 2001 From: Farhan Ali Raza Date: Thu, 21 May 2026 00:53:15 +0500 Subject: [PATCH 1/2] fix(make_pyi): also diff staged changes when scanning for pyi updates pre-commit aligns the worktree with the index, so staged-but-uncommitted edits don't appear in the unstaged diff and their .pyi files were never regenerated. --- scripts/make_pyi.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/make_pyi.py b/scripts/make_pyi.py index fc905a15036..abdac1f6e77 100644 --- a/scripts/make_pyi.py +++ b/scripts/make_pyi.py @@ -79,6 +79,10 @@ def _get_changed_files() -> list[Path] | None: changed_files = _git_changed_files([f"{last_run_commit_sha}..HEAD"]) # get all unstaged changes changed_files.extend(_git_changed_files()) + # also pick up staged-but-uncommitted changes — pre-commit aligns the + # worktree with the index, so without this they'd be invisible to the + # diffs above and the corresponding .pyi files would not be regenerated. + changed_files.extend(_git_changed_files(["--cached"])) if _relative_to_pwd(GENERATOR_FILE) not in changed_files: return changed_files logger.info("make_pyi.py has changed, checking diff now") From 394516940c86675153b647397f17c644d20a3e02 Mon Sep 17 00:00:00 2001 From: Farhan Ali Raza <62690310+FarhanAliRaza@users.noreply.github.com> Date: Thu, 21 May 2026 01:00:22 +0500 Subject: [PATCH 2/2] Apply suggestion from @greptile-apps[bot] Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- scripts/make_pyi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/make_pyi.py b/scripts/make_pyi.py index abdac1f6e77..280f2c62ca1 100644 --- a/scripts/make_pyi.py +++ b/scripts/make_pyi.py @@ -83,6 +83,7 @@ def _get_changed_files() -> list[Path] | None: # worktree with the index, so without this they'd be invisible to the # diffs above and the corresponding .pyi files would not be regenerated. changed_files.extend(_git_changed_files(["--cached"])) + changed_files = list(dict.fromkeys(changed_files)) if _relative_to_pwd(GENERATOR_FILE) not in changed_files: return changed_files logger.info("make_pyi.py has changed, checking diff now")