Skip to content
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

Merged
merged 3 commits into from Oct 20, 2020
Merged

Adding file extensions to gitattributes #10945

merged 3 commits into from Oct 20, 2020

Conversation

Rafi993
Copy link
Contributor

@Rafi993 Rafi993 commented Oct 20, 2020

What type of PR is this?

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

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?

  • yes
  • no, because they aren't needed
  • no, because I need help

Added to documentation?

  • docs.forem.com
  • readme
  • no documentation needed

@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Oct 20, 2020
@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 20, 2020
*.rb diff=ruby
*.rake diff=ruby
*.css diff=css
*.html diff=html
Copy link
Contributor

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?

Copy link
Contributor Author

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)

Copy link
Contributor

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.

Copy link
Contributor Author

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

@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Oct 20, 2020
Copy link
Contributor

@rhymes rhymes left a 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
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

Copy link
Contributor

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!

@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 20, 2020
@rhymes rhymes merged commit 95c33e9 into forem:master Oct 20, 2020
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Oct 20, 2020
@Rafi993
Copy link
Contributor Author

Rafi993 commented Oct 20, 2020

Thank you @rhymes and @citizen428

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding file extensions to gitattributes file for better diff
3 participants