-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
[Bug]: Files without newline seem to fail at applying patch #487
Comments
Could you please fill out the "How to reproduce" prompt? I'm not able to reproduce this, I think whatever tool is backing the SortImportOrder linter you mentioned is required to produce the malformed patch file. |
@alexeagle did you try with a file without a newline? I was able to reproduce it locally with the linters already setup.
|
I tried bumping the version but latest (0.8.1) still has the bug bluekeyes/go-gitdiff#57 |
Okay I did some debugging with @vinnybod -- looks to be an issue where BSD diff will produce diffs with multiple This causes bugs in go-gitdiff and git itself (we sent an email to their mailing list). Switching to GNU diff fixes the problem but how can we get around this in rules_lint? Ideas 💡
|
I think we just need to resolve this TODO |
https://gitlab.arm.com/bazel/ape can give us a GNU diff binary, which I think is a reasonable way to wire this up. |
go-gitdiff which aspect CLI uses cannot support patches generated by BSD diff which is the default on MacOS (see tagged issue). I am investigating using ape but it requires Bazel 7.4.1 which may be a breaking change. Alternatively, this changes diff -> git with a few extra "hacks". Namely, we need to replace the labels to be the same file and resolve the symlinks otherwise `git diff` thinks the file was deleted. fixes aspect-build#487
What happened?
If we build it manually
That patch seems to be messed up if we apply it with
git apply
(notice lack of newline after
java.util.Set
)If we apply a newline at the end of our file; our patch file is slightly different
It is missing
\ No newline at end of file
in the patch.This patch when applied produces the correct results
Version
How to reproduce
I was able to reproduce it locally with the linters already setup.
I changed Bar.java
Any other information?
No response
The text was updated successfully, but these errors were encountered: