henkelis / sonospy

Sonospy is a UPnP control point and Windows Media proxy for the Sonos multi-room audio system.
GNU General Public License v3.0
113 stars 16 forks source link

The repo contains files with crlf but .gitattributes declares every file as text. #56

Closed michaelnt closed 13 years ago

michaelnt commented 13 years ago

It is possible to have the repo contain files with a mixture of line endings and set core.autocrlf false but I think the contents of .gitattributes breaks that by forcing the git client to change the line endings in your workspace.

http://help.github.com/line-endings/ http://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

$ echo "* text=auto" >>.gitattributes
$ rm .git/index     # Remove the index to force git to
$ git reset         # re-scan the working directory
$ git status        # Show files that will be normalized
$ git add -u
$ git add .gitattributes
$ git commit -m "Introduce end-of-line normalization"
ianmacd commented 13 years ago

'* text=auto' should change files on check-in, but not in your workspace. It's the equivalent of:

$ git config --global core.autocrlf input

but doesn't rely on the user to actually do it. Instead, the repo takes care of it.

To convert files when checking out, one would need:

$ git config --global core.autocrlf true

Which files do you see in the repo with CR/LF endings?

michaelnt commented 13 years ago
(py26)michaelt@esos:/tmp$ git clone https://github.com/henkelis/sonospy.git
Cloning into sonospy...
remote: Counting objects: 1436, done.
remote: Compressing objects: 100% (990/990), done.
remote: Total 1436 (delta 531), reused 1310 (delta 409)
Receiving objects: 100% (1436/1436), 2.46 MiB | 415 KiB/s, done.
Resolving deltas: 100% (531/531), done.
(py26)michaelt@esos:/tmp$ git config core.autocrlf
input
(py26)michaelt@esos:/tmp$ cd sonospy/
(py26)michaelt@esos:/tmp/sonospy$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   sonospy/brisa/upnp/soap.py
#   modified:   sonospy/brisa/upnp/soap_HTTP1.0.py
#   modified:   sonospy/napstersonos.py
#   modified:   sonospy/setconf.cmd
#   modified:   sonospy_p.cmd
#   modified:   sonospy_w.cmd
#   modified:   sonospy_web.cmd
#   modified:   sonospy_web.vbs
#   modified:   web2py/applications/admin/languages/es-es.py
#   modified:   web2py/applications/admin/languages/pl.py
#   modified:   web2py/applications/admin/languages/zh-cn.py
#   modified:   web2py/applications/admin/static/calendar.js
#   modified:   web2py/applications/admin/static/edit_area/autocompletion.js
#   modified:   web2py/applications/admin/static/edit_area/edit_area.css
#   modified:   web2py/applications/admin/static/edit_area/edit_area.js
#   modified:   web2py/applications/admin/static/edit_area/edit_area_compressor.php
#   modified:   web2py/applications/admin/static/edit_area/edit_area_functions.js
#   modified:   web2py/applications/admin/static/edit_area/edit_area_loader.js
#   modified:   web2py/applications/admin/static/edit_area/elements_functions.js
#   modified:   web2py/applications/admin/static/edit_area/highlight.js
#   modified:   web2py/applications/admin/static/edit_area/keyboard.js
#   modified:   web2py/applications/admin/static/edit_area/langs/bg.js
#   modified:   web2py/applications/admin/static/edit_area/langs/cs.js
#   modified:   web2py/applications/admin/static/edit_area/langs/de.js
#   modified:   web2py/applications/admin/static/edit_area/langs/dk.js
#   modified:   web2py/applications/admin/static/edit_area/langs/en.js
#   modified:   web2py/applications/admin/static/edit_area/langs/eo.js
#   modified:   web2py/applications/admin/static/edit_area/langs/es.js
#   modified:   web2py/applications/admin/static/edit_area/langs/fi.js
#   modified:   web2py/applications/admin/static/edit_area/langs/fr.js
#   modified:   web2py/applications/admin/static/edit_area/langs/it.js
#   modified:   web2py/applications/admin/static/edit_area/langs/ja.js
#   modified:   web2py/applications/admin/static/edit_area/langs/nl.js
#   modified:   web2py/applications/admin/static/edit_area/langs/pl.js
#   modified:   web2py/applications/admin/static/edit_area/langs/pt.js
#   modified:   web2py/applications/admin/static/edit_area/langs/ru.js
#   modified:   web2py/applications/admin/static/edit_area/langs/sk.js
#   modified:   web2py/applications/admin/static/edit_area/langs/zh.js
#   modified:   web2py/applications/admin/static/edit_area/license_apache.txt
#   modified:   web2py/applications/admin/static/edit_area/license_bsd.txt
#   modified:   web2py/applications/admin/static/edit_area/manage_area.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/charmap.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/css/charmap.css
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/jscripts/map.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/bg.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/cs.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/de.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/dk.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/en.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/eo.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/es.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/fr.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/hr.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/it.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/ja.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/mk.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/nl.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/pl.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/pt.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/ru.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/sk.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/langs/zh.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/charmap/popup.html
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/css/test.css
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/bg.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/cs.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/de.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/dk.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/en.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/eo.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/es.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/fr.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/hr.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/it.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/ja.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/mk.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/nl.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/pl.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/pt.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/ru.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/sk.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/langs/zh.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/test.js
#   modified:   web2py/applications/admin/static/edit_area/plugins/test/test2.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/basic.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/brainfuck.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/c.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/coldfusion.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/cpp.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/css.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/html.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/java.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/js.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/pas.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/perl.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/php.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/python.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/robotstxt.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/ruby.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/sql.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/tsql.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/vb.js
#   modified:   web2py/applications/admin/static/edit_area/reg_syntax/xml.js
#   modified:   web2py/applications/admin/static/edit_area/regexp.js
#   modified:   web2py/applications/admin/static/edit_area/resize_area.js
#   modified:   web2py/applications/admin/static/edit_area/search_replace.js
#   modified:   web2py/applications/admin/static/edit_area/template.html
#   modified:   web2py/applications/admin/static/jqueryMultiSelect.js
#   modified:   web2py/applications/admin/static/openwysiwyg/popups/about.html
#   modified:   web2py/applications/admin/static/openwysiwyg/popups/about_license.html
#   modified:   web2py/applications/admin/static/openwysiwyg/popups/create_table.html
#   modified:   web2py/applications/admin/static/openwysiwyg/popups/insert_hyperlink.html
#   modified:   web2py/applications/admin/static/openwysiwyg/popups/insert_image.html
#   modified:   web2py/applications/admin/static/openwysiwyg/popups/license.html
#   modified:   web2py/applications/admin/static/openwysiwyg/popups/preview.html
#   modified:   web2py/applications/admin/static/openwysiwyg/popups/select_color.html
#   modified:   web2py/applications/admin/static/openwysiwyg/scripts/wysiwyg-color.js
#   modified:   web2py/applications/admin/static/openwysiwyg/scripts/wysiwyg-popup.js
#   modified:   web2py/applications/admin/static/openwysiwyg/scripts/wysiwyg-settings.js
#   modified:   web2py/applications/admin/static/openwysiwyg/scripts/wysiwyg.js
#   modified:   web2py/applications/admin/static/openwysiwyg/styles/wysiwyg.css
#   modified:   web2py/applications/sonospy/languages/es-es.py
#   modified:   web2py/applications/sonospy/languages/hi-hi.py
#   modified:   web2py/applications/sonospy/languages/pl.py
#   modified:   web2py/applications/sonospy/languages/ru-ru.py
#   modified:   web2py/applications/sonospy/static/calendar.js
#   modified:   web2py/applications/sonospy/static/jquery-ui.js
#   modified:   web2py/epydoc.conf
#   modified:   web2py/epydoc.css
#   modified:   web2py/gluon/contrib/pyrtf/PropertySets.py
#   modified:   web2py/gluon/contrib/pyrtf/Styles.py
#   modified:   web2py/gluon/contrib/pyrtf/__init__.py
ianmacd commented 13 years ago

Those files predate the addition of the .gitattributes file and weren't normalised after adding it. My fault.

All the same, after a clean check-out, 'git status' tells me:

On branch master

nothing to commit (working directory clean)

What does 'git config --global --list' report at your end?

michaelnt commented 13 years ago

I was changing core.eol to try and fix this to no avail, i.e. get git to checkout the files without changing the line endings. core.eol is vaguely new I think.

git version 1.7.4.1
(py26)michaelt@esos:/data/Work/sonospy$ git config --global --list
user.name=Michael Thompson
user.email=michaelnt@gmail.com
core.autocrlf=input
core.eol=lf
ianmacd commented 13 years ago

I see the problem. You're looking at master, but I'm looking at unstable, where the problem no longer exists.

I've normalised the files in master now, but you almost certainly want to be working with unstable.