Skip to content

Commit ad043c9

Browse files
fix(make_pyi): also diff staged changes when scanning for pyi updates (#6544)
* 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. * Apply suggestion from @greptile-apps[bot] Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
1 parent 6288dfe commit ad043c9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

scripts/make_pyi.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ def _get_changed_files() -> list[Path] | None:
7979
changed_files = _git_changed_files([f"{last_run_commit_sha}..HEAD"])
8080
# get all unstaged changes
8181
changed_files.extend(_git_changed_files())
82+
# also pick up staged-but-uncommitted changes — pre-commit aligns the
83+
# worktree with the index, so without this they'd be invisible to the
84+
# diffs above and the corresponding .pyi files would not be regenerated.
85+
changed_files.extend(_git_changed_files(["--cached"]))
86+
changed_files = list(dict.fromkeys(changed_files))
8287
if _relative_to_pwd(GENERATOR_FILE) not in changed_files:
8388
return changed_files
8489
logger.info("make_pyi.py has changed, checking diff now")

0 commit comments

Comments
 (0)