[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cross-project-issues-dev] A reminder and question about how to configure Git clones of "simrel.builds"

This discussion is about building org.eclipse.simrel.build, but some of you may have relevant experience with other repositories or builds.

The other day the "gerrit/hudson" build of this repository failed with this message:

13:31:51       [exec] error: Your local changes to the following files would be overwritten by merge:
13:31:51       [exec]                  simrel.b3aggr
13:31:51       [exec]                  webtools.b3aggrcon
13:31:51       [exec] Please, commit your changes or stash them before you can merge.


Having seen this problem before, I knew the "local changes" were simply that those two files -- in the canonical repository -- had Windows line endings in them (CRLF) instead of Linux line endings (LF).

When those files had been checked out in an earlier build, they were changed to LF -- on the build machine. Hence, the next time a "git pull" was attempted (using Git, not JGit, if that matters) the result was the appearance of "change" and hence the error above.  

I have made an initial fix in the build scripts to avoid this in the future, but I was surprised I could find no way to configure "build repository" on Hudson upon cloning. (Other than with a bash script, of course).

Am I missing something? Is there a hidden field in Hudson or Gerrit somewhere that allows it to be "configured on clone" or similar?

The point is, when Hudson "clones the repository" it does not set "core.autocrlf" and I think the default (for Linux) is to change all line endings to LF.  It would be better to set core.autoCRLF to "input" so that Git leaves things alone when checking out things, but would convert to LFs when checking them in -- and of course we never check in changes from the build machine. Gerrit does, I guess, and again, no idea how to configure its settings.

So, that is my question. Are there ways to easily configure Hudson or Gerrit's "Git configuration"?

My reminder is that if you are working on Windows, you should set core.autocrlf to true or possibly 'input' -- it should be 'true' if you manipulate the files with anything other than pure Eclipse. I think EMF might even use the "native" CRLF when it formats files on Windows (Bug 325145) (although clients can fix that, and the b3 aggregator simply has not, yet).  If on Linux or Mac, the core.autocrlf should be set to 'input' or perhaps false. Some of the "advice in the field" is more specific: https://help.github.com/articles/dealing-with-line-endings/

I do not mean to start a long flaming discussion about "which is best" -- I know some have strong opinions about it -- but think we should follow what is recommend in that github article. We still need to close Bug 424041! so if anyone wants to re-discuss "best settings" then please comment there. I just enjoyed reading Ed Willink's final comment there: "I am confused about it so I never change the setting and everything works for me" :) But, my point is, make sure that what ever you commit to the repository has only the Linux LF's by the time it gets in the repository.

BTW, just yesterday, I did set "* text=auto" in the .gitattributes file. As far as I know, JGit still does not process ".gitattributes" files, but if any of you work directly with Git, you might see a change in your "local repo".