You Clumsy GIT

I recently ran into an issue when refactoring a project, in which the compiler was reporting an error that a method had insufficient arguments.  Using Ctrl + clicking to drill through the code clearly showed a parameterless overload.  Error insight also seemed to be off exactly one line.

Rearranging the methods within the unit didn’t change the outcome, but it showed that after a particular line there was an issue, because Ctrl + clicking on a local variable no longer jumped to it’s declaration, but one line above.

Using NotePad++ to show all control characters, there didn’t seem to be anything other than the normal <CR><LF> characters at the end of each line.  Once we performed a conversion to Mac/Unix format and back to Windows in NotePad++, the issue was resolved.  It appears that GIT must have changed an EOLN marker at some point and we simply didn’t notice it in Notepad++.

4 Responses to “You Clumsy GIT”

  1. Bill Meyer Says:

    I had a similar experience a couple of years ago, but without GIT, which I do not use. As I recall, the compiler was not confused by it, but ModelMaker Code Explorer stumbled over it. It turned out that a single character in the file had been changed to something–I do not now recall what–which left MMX befuddled, but was not significant to the compiler.

    I think we found it that time with a hex editor, but I may be wrong on that.

  2. Pawel Says:

    Yup, that’s controlled by autocrlf variable.

  3. Chuck Norris Says:

    Set the property “autocrlf” to False if you a planing to use the git on Windows machines only.
    This means that git doesn’t chance the cr/lf.
    In mixed enviroments Window, Linux & IOS you should set “autocrlf” to True.

    File gitconfig:
    symlinks = false
    autocrlf = false // <= ****

    see also:

  4. Kevin P. Says:

    Some info on how Git manages line endings and how you can normalize them in your repositories.

Leave a Reply