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
Adding file extensions to gitattributes #10945
Adding file extensions to gitattributes #10945
Conversation
| *.rb diff=ruby | ||
| *.rake diff=ruby | ||
| *.css diff=css | ||
| *.html diff=html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to add HTML diffs for ERb files too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought so too but isn't erb little different (since it can have ruby code inside it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but a lot of editors work quite ok if you set ERb's file type to HTML, so I guess it's worth at try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added *.erb diff=html now. Thank you @citizen428
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Rafi993, thanks for the change.
What about frontend files? JS, JSX and so on? Should we add those as well
.gitattributes
Outdated
| *.rake diff=ruby | ||
| *.css diff=css | ||
| *.html diff=html | ||
| *.erb diff=html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a missing newline at the end of the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Rafi993, thanks for the change.
What about frontend files? JS, JSX and so on? Should we add those as well
They don't seem to have support for js or ts https://github.com/git/git/blob/master/userdiff.c#L78 as mentioned in this thread https://gist.github.com/tekin/12500956bd56784728e490d8cef9cb81
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a missing newline at the end of the file
I'll add the newline now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They don't seem to have support for js or ts https://github.com/git/git/blob/master/userdiff.c#L78 as mentioned in this thread https://gist.github.com/tekin/12500956bd56784728e490d8cef9cb81
got it, thanks!
|
Thank you @rhymes and @citizen428 |
What type of PR is this?
Description
Adding file extensions to .gitattributes for better diff. It is mostly inspired from https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more
Related Tickets & Documents
Closes #10946
QA Instructions, Screenshots, Recordings
Try doing git diff using git cli before and after this commit on a ruby file
Added tests?
Added to documentation?