Edit on web interface adds carriage returns to file.
Closed
Edit on web interface adds carriage returns to file.
Created by: cirosantilli
This only happens on master, not on gitlab.com.
To reproduce:
- create a new repo
- create a file locally that ends in newline:
echo a
. Double check it has no carriage return:hd a
. - push to the new repo
- clone somewhere else:
hd a
says the file hasn't changed as expected. - go to the edit blob view on the web interface
- don't modify the file content: keep it as it.
- enter commit message
- commit. Surprise! Should not commit because no changes.
- clone again somewhere else. Suprise! The file has carriage returns.
Normally, this shouldn't make the commit since the file was not changed, but it does as carriage returns were added.
This is exposed at the following test: https://github.com/gitlabhq/gitlabhq/pull/7856/files#r18390519 which I added to an untested feature.
Does anyone reproduce? If yes, I consider this is a critical bug which affects repository integrity.
This may be https://github.com/gitlabhq/gitlabhq/issues/3982 v2
Created by: cirosantilli
Thanks for the tip @mr-vinn and @x3ro. I propose leaving this open until something is done about it.
The ideal solution would be to modify the per-repository configs with gitlab-shell since it is not generally a good idea to automatically modify the global config on the automated installation methods.
By Administrator on 2014-10-15T16:49:24 (imported from GitLab project)
Created by: mr-vinn
@cirosantilli The gitlab_git gem could also handle this via
Rugged::Repository#config
. I think it would be sufficient to enable autocrlf in the satellite repo, but I'd have to test that to be sure. I suppose theGitlab::Satellite::Satellite
class could interact with Rugged directly, but I think it would be better to go through the gem. I'll submit a PR to gitlab_git for a shortcut method, something like#enable_autocrlf
. Then it should be trivial to add that to the satellite constructor.By Administrator on 2014-10-17T05:36:51 (imported from GitLab project)