2010-02-24 11 views
5

Używam git (z git-svn) na linuxie, a kolega używa svn w oknach.git svn windows linux whitespace problems

Tyle razy, git zgłasza problemy z białymi znakami. W rzeczywistości nie powoduje on liniowej historii z powodu tych problemów i powoduje konflikty scalania.

Jaki jest najprostszy sposób konfiguracji svn/git i git-svn w systemie Windows i Linux, aby pojawiły się teraz problemy z białymi znakami?

Poniżej przedstawiono zgłoszone seryjnej konflikt w historii liniowej na mistrza:

error: patch failed: frontend/templates/frontend/base.html:38 
error: frontend/templates/frontend/base.html: patch does not apply 
error: patch failed: frontend/templates/frontend/footer.html:1 
error: frontend/templates/frontend/footer.html: patch does not apply 
error: patch failed: frontend/templates/frontend/index.html:1 
error: frontend/templates/frontend/index.html: patch does not apply 
Using index info to reconstruct a base tree... 
<stdin>:15: trailing whitespace. 

<stdin>:20: trailing whitespace. 
      <a href="{% url frontend_index %}"> 
<stdin>:22: trailing whitespace. 
      </a> 
<stdin>:24: trailing whitespace. 
     <span class="companyname"> 
<stdin>:25: trailing whitespace. 
      <a href="{% url frontend_index %}"> 
warning: squelched 74 whitespace errors 
warning: 79 lines add whitespace errors. 
Falling back to patching base and 3-way merge... 
Auto-merging frontend/templates/frontend/base.html 
CONFLICT (content): Merge conflict in frontend/templates/frontend/base.html 
Auto-merging frontend/templates/frontend/index.html 
CONFLICT (content): Merge conflict in frontend/templates/frontend/index.html 
Failed to merge in the changes. 
Patch failed at 0001 template changes 

When you have resolved this problem run "git rebase --continue". 
If you would prefer to skip this patch, instead run "git rebase --skip". 
To restore the original branch and stop rebasing run "git rebase --abort". 

Jak mogę rozwiązać problemy whitespace?

Odpowiedz

11

naprawianie błędów odstępu

Dodaj to do .gitconfig

[core] 
    whitespace=nowarn 

git rebase powinien teraz działać. (Można ewentualnie dodać niektóre fix,-indent-with-non-tab,trailing-space do tego, aby mieć git naprawić wszystkie spacje na każdy popełnić. Niezależnie od tego, że jest to dobry pomysł, zależy od zasad projektu oraz zespołem.)

naprawianie błędów EOL

[core] 
    autocrlf = true 

w swoim .gitconfig. Zmusi to każdy plik tekstowy do zakończenia linii okna. svn domyślnie ignoruje zakończenia linii i jeśli edytory tekstu w oknach są w porządku, możesz zostawić je w ten sposób. W przeciwnym razie dodaj this file do konfiguracji svn (opcjonalnie zmieniając native na CRLF) zapewniając spójne zakończenia linii CRLF przez wyjście.

Ustaw autocrlf = input i zmień native na LF dla konsekwentnie zakończeń linii linuxowych.