refactor(lint): use git-changed for --changed detection - #340
Merged
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/changed.tsshipped its own copy of merge-base changed-file detection — default-branch discovery, porcelain parsing, rename arrows, existence filtering. That algorithm now lives ingit-changed(0.3.0, zero runtime deps) and is shared with pgpm's bundle-drift check, so this file is the.sqlfilter over it and nothing else: ~120 lines → ~55, nochild_process/fs/pathimports left.Public surface (
resolveChangedBase,changedFiles,changedSqlFiles,ChangedFilesResult) and the CLI are unchanged,--changedsemantics are unchanged, and the.sqlfilter is nowext: '.sql'inside the shared implementation rather than a.endsWith()afterwards.One deliberate behaviour change. When
$GITHUB_BASE_REFnames a branch that resolves to no ref at all — neitherorigin/developnordevelopexists, i.e. a single-branch or shallow fetch — this used to return the baredevelopanyway. Every later git call then rejected it and the gate silently degraded to working-tree changes, which in CI (where the branch's work is already committed) means it lints nothing and passes.git-changedonly returns refs that resolve, so the base falls through to the repository's default branch and the gate still checks something. The test for that case is updated with the reasoning; the other 73 are untouched and pass.74 tests green against the published
git-changed@0.3.0, and--changedverified end-to-end on a scratch repo (an untracked.sqlfile is still found — that's the-uallbehaviour this originally fixed).Needs a publish for downstreams to get it, but nothing here changes what
--changeddoes, so it can ride the next release rather than being pulled forward.Link to Devin session: https://app.devin.ai/sessions/e84444b40007481e9de0285d8b5340b6
Requested by: @pyramation