Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1449 +/- ##
==========================================
+ Coverage 90.74% 90.77% +0.02%
==========================================
Files 82 82
Lines 16776 16787 +11
==========================================
+ Hits 15224 15238 +14
+ Misses 1552 1549 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
📦 Cargo Bloat ComparisonBinary size change: +0.00% (22.5 MiB → 22.5 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
Owner
|
Thanks! |
Contributor
Author
|
Thanks for the super quick review and approval! |
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.
Problem
Sometimes I want to run checks on a set of changes including my staged changes but not my unstaged changes. In pre-commit I do this by running:
but in prek I get an error like:
Evaluation
This fails because I am passing in a ref to a tree instead of a ref to a commit. When passing in a commit/branch everything works as expected.
This happens because the
get_changed_filesuses...instead of...A...Bmeans "get all the differences in the A branch and the B branch when compared to their merge-base",A..Bmeans "get all the differences between A and B". Importantly...requires commits because it compares to the merge base,..on the other hand compares any two references regardless of whether those references are commits or trees.Solution
Try to use
...and fall back to..This change feels safe because:
get_changed_filesis only used in the case where-to-refand--from-refare usedTesting
I've added a new test that only passes with this code change and validated that no existing tests break because of this change.