Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
For an explanation of what Git's core.*crlf setting, see http://help.github.com/dealing-with-lineendings/ or http://gitimmersion.com/lab_01.html or just man git-config
. As the appropriate settings are dependent on the user's OS, we should do some OS sniffing and provide customized recommendations based on that. Of course we should also link to a place with the full instructions and make clear that these instructions are OS-specific and based on unreliable sniffing.
For clarity, we're recommending core.autocrlf and core.safecrlf settings, and what gitimmersion recommends are safe & sane.
Comments
Comment #1
kndr+1
Thanks for clarification.
Place with the full instructions should be created. For example, on page for patch contributors http://drupal.org/node/707484 there is recommended .gitconfig but there is no suggestions about core.autocrlf and core.safecrlf, which are very important.
ref: http://gitimmersion.com/lab_01.html
Comment #2
dwwIs this for drupalorg or project_git_instructions?
Comment #3
kndrHm. Indeed. Project_git_instructions would be better place for this clarifications, I think. This thread was the only, I found about this bunch of settings in .gitconfig. Git's core.*crlf setting will be the most usefull for patch contributors, in my opinion.
Comment #4
dwwMoving there for now...
Comment #5
scor CreditAttribution: scor commentedAre these official guidelines yet? There is this comment at the bottom of the Patch workflows handbook page, but since it's a comment it's potentially confusing for users to know whether they should use these settings or not. I'm personally not using these settings and I've had no problems so far, but that's probably because I've never run across any project with CRLF line endings...
Comment #6
benjifisherThe Calendar project includes some files with CRLF line endings. This is because RFC 2445 (the ical specification) requires CRLF, so the template files (.tpl.php) that are used for ical feeds need CRLF. (There are also a lot of
print $foo . "\r\n";
lines.)Setting
core.autocrlf
to input (on Mac or Linux) causes major headaches. Patches produced with one setting do not apply when the other setting is used. (To my surprise, it is the setting when invokinggit apply
that matters.) If you insist on settingcore.autocrlf
to input, you may end up with an ical feed that fails to validate because of CRLF issues. See #1284170-11: All-day events missing or wrong in ical feed.Comment #7
benjifisherI think I have found a solution to the problems I described in #6. In projects that have to use some files with CRLF endings, add a .gitattributes file with a line like
This example tells git not to do any line-ending conversion on the template files. See #1302052: CRLF line endings cause problems with "git apply".
I would appreciate comments from people who know git better than I do.
Comment #8
kay_v CreditAttribution: kay_v commentedPage for complete set of recommended .gitcontrib settings: http://drupal.org/node/1542048
Interestingly, the crlf settings are significantly different from those recommended by gitimmersion (and quoted by @kndr)
Comment #9
kndrIn the meantime, I've changed the settings. I work for some time on the settings indicated on the page http://drupal.org/node/1542048. I confirm that core.autocrlf and core.safecrlf should be set to FALSE. Otherwise, there is a lot of problems that I experienced. In the Windows environment, you should simply use the appropriate settings in text editors. In my opinion there is no other way.
Comment #10
eliza411 CreditAttribution: eliza411 commentedI don't think there's been enough support issues generated by this to add complexity to the Version control tab, so I'm marking this as closed, won't fix. I think the regular documentation is coverage enough. If I'm mistaken, please point me to the other issues and re-open.