Jump to content

Recommended Posts

Posted

This has been an intermittent problem for me, and it's starting to get on my nerves. Can anyone tell me what I'm doing wrong?

faramir118@lappy /c/wowemu/mangos-src (main)
$ git checkout vmap_rewrite
error: You have local changes to 'contrib/vmap_extractor_v2/doc/The MoPaQ File Format.txt'; cannot switch branches.

faramir118@lappy /c/wowemu/mangos-src (main)
$ git status
# On branch main
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   contrib/vmap_extractor_v2/doc/The MoPaQ File Format.txt
#       modified:   contrib/vmap_extractor_v2/stormdll/StormDll.def
#       modified:   contrib/vmap_extractor_v2/stormlib/bzip2/dlltest.dsp
#       modified:   contrib/vmap_extractor_v2/stormlib/bzip2/libbz2.def
#       modified:   contrib/vmap_extractor_v2/stormlib/bzip2/libbz2.dsp
#       modified:   contrib/vmap_extractor_v2/stormlib/bzip2/makefile.msc
#
no changes added to commit (use "git add" and/or "git commit -a")

faramir118@lappy /c/wowemu/mangos-src (main)
$ git reset --hard
HEAD is now at 5ef2e49 [9986] Talent 51459 and ranks affect only melee auto-attacks.

faramir118@lappy /c/wowemu/mangos-src (main)
$ git status
# On branch main
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   contrib/vmap_extractor_v2/doc/The MoPaQ File Format.txt
#       modified:   contrib/vmap_extractor_v2/stormdll/StormDll.def
#       modified:   contrib/vmap_extractor_v2/stormlib/bzip2/dlltest.dsp
#       modified:   contrib/vmap_extractor_v2/stormlib/bzip2/libbz2.def
#       modified:   contrib/vmap_extractor_v2/stormlib/bzip2/libbz2.dsp
#       modified:   contrib/vmap_extractor_v2/stormlib/bzip2/makefile.msc
#
no changes added to commit (use "git add" and/or "git commit -a")

faramir118@lappy /c/wowemu/mangos-src (main)
$ git diff --ignore-space-at-eol

faramir118@lappy /c/wowemu/mangos-src (main)
$

I have tried autocrlf false, autocrlf true, and autcrlf input.

I have tried converting the line endings from CRLF (what they are in the working directory) to LF (which I assume they are in the index), but I get the same output from git status and git diff.

The only thing that works is to commit the 'changes'

Posted

The autocrlf feature is weird indeed, it sometimes works, sometimes not. So I chose to simply go around - any more advanced text editor for windows supports LF-ending files, so autocrlf=false and using "anything except notepad.exe" works for me.

Posted

I've been using notepad++ for years, and I've gotten in the habit of working with formatting characters on.

I see that after a fresh fetch, merge, and checkout on a brand new branch, CRLF characters are there

git diff says that every line of each of those files has changed

git diff --ignore-space-at-eol says there are no changes

I can do Edit > EOL Conversion > Unix Format, and they all change to LF, and then I save

git diff still says that every line of each of those files has changed

git diff --ignore-space-at-eol still says there are no changes

Ugh. I think I'll just save my code outside the repo somewhere, delete the repo, and start from scratch.

Now, should I use CRLF or just LF? I can set my editors to do either, just need to know.

Posted
I've been using notepad++ for years, and I've gotten in the habit of working with formatting characters on.

I see that after a fresh fetch, merge, and checkout on a brand new branch, CRLF characters are there

git diff says that every line of each of those files has changed

git diff --ignore-space-at-eol says there are no changes

I can do Edit > EOL Conversion > Unix Format, and they all change to LF, and then I save

git diff still says that every line of each of those files has changed

git diff --ignore-space-at-eol still says there are no changes

Ugh. I think I'll just save my code outside the repo somewhere, delete the repo, and start from scratch.

Now, should I use CRLF or just LF? I can set my editors to do either, just need to know.

Each time you change the autocrlf settings, you need to do a fresh checkout (either "checkout -f" or delete all files except .git/ and "reset --hard") to make the option _work_. If you checkout your working tree with autocrlf=true, it will have CRLFs there when you change it to =false. That might be the reason why they show up.

I use autocrlf=false and save my files using the "Unix format" (notepad++ settings) on windows - so far so good.

Posted

That's why I recommend to disable autocrlf whenever possible - it allows "windows people" to correct CRLF/LF errors in the repository itself - it isn't possible with autocrlf turned on.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use