-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use git attributes to determine generated and vendored status for language stats and diffs #16773
Conversation
Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #16773 +/- ##
==========================================
+ Coverage 45.15% 45.19% +0.04%
==========================================
Files 765 766 +1
Lines 86300 86574 +274
==========================================
+ Hits 38968 39131 +163
- Misses 41023 41113 +90
- Partials 6309 6330 +21
Continue to review full report at Codecov.
|
Gave it a quick try:
Also, I think we need a button to load such hidden diffs, is that in #16829? |
.gitignore is being detected as vendored by enry. did you add yarn.lock to the .gitattributes or just expect that enry would detect it? If so that's another enry issue. Doesn't list yarn.lock as a generated type. For files which are not too big but are vendored just click the chevron at the left and the file will be displayed. Files which are too big need another PR - that's an orthogonal issue. |
Hmm, I think it matches linguist in that regard, but I think we are missing something because I'm generally able to view .gitignore changes in GitHub diffs.
Ah, I remember this is because linguist does not consider yarn.lock to be generated but does so for package-lock.json. Here is some discussion about it, I generally disagree with them, both files serve the same purpose and are definitely generated, it's just that yarn.lock is slightly more readable. I guess I'd need to bring it up on enry.
Ah, I guess I was expecting a button like in the GitHub UI, but I guess we can still add that. |
If you click the I added the Enry IsVendor() determination because it felt like it would be a helpful addition and extension. (BTW adding .gitignore to .gitattributes as linguist-vendored false would prevent it from being listed as vendored.) Looking more closely at github's behaviour it appears that it only collapses generated by default. I can stop collapsing the things marked vendored if that would be better. <- DONE |
Signed-off-by: Andrew Thornton <[email protected]>
Signed-off-by: Andrew Thornton <[email protected]>
The CI Failure is not due to this PR but due to a problem related to #1441 |
@silverwind would you like to re-review? |
Does that mean that the diff is already precomputed even if the file is most likely never seen? By the way, apart from the But, to be fair, I am not exactly sure whether that fits inside the scope of this branch. |
It doesn't fit within the scope of this PR, no. That would seriously and unnecessarily complicate I need the ideas in #16829 and some the extension work blocked by that for lazy loading to become possible - but I'm blocked til both of these PRs are merged. |
Signed-off-by: Andrew Thornton <[email protected]>
Replaces #16262
Replaces #16250
Replaces #14833
This PR first implements a
git check-attr
pipe reader - usinggit check-attr --stdin -z --cached
- taking account of the change in the output format in git 1.8.5 and creates a helper function to read a tree into a temporary index file for that pipe reader.It then wires this in to the language stats helper and into the git diff generation.
Files which are marked generated will be folded by default.
Fixes #14786
Fixes #12653