mysociety / mysociety/caps

Do we really need a .gitattributes file for special handling of line endings?

Open
#112 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

tech debt
Dominant language
HTML
Stars
12
Forks
2
Avg merge
13d 3h
Merged PRs (30d)
1

Description

We’ve had this .gitattributes file since day one – probably because this project grew out of boilerplate from previous mySociety django projects that involved Windows developers.

But the line ending stuff leads to odd surprises when you check in a new type of file. For example, here was me checking in a few jpg files earlier:

~/Work/mySociety/caps ⌘ git commit -am 'Fix broken team avatar images on interstitial modal'
warning: CRLF will be replaced by LF in caps/static/img/avatar-grace.jpg.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in caps/static/img/avatar-isaac.jpg.
The file will have its original line endings in your working directory
warning: CRLF will be replaced by LF in caps/static/img/avatar-zarino.jpg.
The file will have its original line endings in your working directory
[master 886d8c7] Fix broken team avatar images on interstitial modal
 2 files changed, 0 insertions(+), 0 deletions(-)
 rewrite caps/static/img/avatar-grace.jpg (95%)
 rewrite caps/static/img/avatar-isaac.jpg (82%)

It’s been suggested that maybe * text eol=lf isn’t the best way to achieve what we’re after. Or maybe we don’t need the file at all any more.

@ajparsons (as our resident Windows developer!) and @struan to discuss.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the repository’s .gitattributes file and review the reported warnings for caps/static/img/avatar-grace.jpg, caps/static/img/avatar-isaac.jpg, and caps/static/img/avatar-zarino.jpg. Reproduce the line-ending behavior with Git, then determine whether the current rules should be removed or revised and verify that new file types no longer produce unexpected handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
git
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.