-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Deal with clean filters somehow #480
Comments
TIL about git smudging and cleaning. If smudge/clean commands all work via stdin/stdout, we could simply apply the filters before diffing? Would add quite a lot of complexity and probably slow things down, but not against doing this at some point. |
Yeah, they use stdin/out (not sure if they even get to know the filename they're working on). The problem (at least how I understand it) is how to display the diff in the editor; even with a simple filter such as |
Don't we just need to adapt the output of |
I'm not really familiar with From what I've noticed, |
We can do this.
I don't really know which one makes more sense, I've never used these filters. Both versions of the diff input are available as string variables in the plugin so we can filter either one in whatever way we want. The question is will the outputs be usable? If a filter is just changing single words in a file, then it would work. If they are removing/adding lines of text, then the signs will be wrong. Maybe if the line count changes we go with your option 2? |
If you (or anyone) wants to prototype anything, the diff happens here: gitsigns.nvim/teal/gitsigns/manager.tl Line 321 in 06aefb1
We just need to augment |
Hi, I was just experimenting with the filter functionality in Git and came across this issue with gitsigns.nvim. I wanted to add that using the smudged index file would not work in all cases, as smudge and clean are not necessarily complementary to each other. A good example would be to have a formatter in clean and nothing for smudge. The Git documentation actually shows this in an example. Under the image they use indent for cleaning, while smudge is just cat, which does nothing. |
Is your feature request related to a problem? Please describe.
If you edit a file that is covered by a
filter.*.clean
rule, the diff detection does not work very well. I do realize this is not really possible to handle well since filters can do literally anything, but it does make a suboptimal editing experience.Describe the solution you'd like
A non-exhaustive list of possible implementations, roughly in order of complexity:
Describe alternatives you've considered
Discussed above.
Additional context
Nothing in particular.
The text was updated successfully, but these errors were encountered: