2010-02-24 20 views
5

Io uso git (con git-svn) su linux e un collega usa svn su windows.git svn windows linux spazi bianchi

Così tante volte, git segnala problemi di spazio bianco. In effetti, non riesce a eseguire una cronologia lineare a causa di questi problemi e crea conflitti di unione.

Qual è il modo più semplice per configurare svn/git e git-svn su windows e linux in modo che ci siano ora problemi di spazio bianco?

seguito è riportato un conflitto di unione riportato, in una storia lineare su maestro:

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". 

come faccio a risolvere i problemi di spazio bianco?

risposta

11

correggere gli errori di spaziatura

Aggiungi questo per .gitconfig

[core] 
    whitespace=nowarn 

git rebase ora dovrebbe funzionare. (Si può opzionalmente aggiungere un po 'di fix,-indent-with-non-tab,trailing-space a quella di avere git correggere tutti gli spazi bianchi ad ogni commit. Se questo è una buona idea dipende dalle regole di progetto e di squadra.)

correggere gli errori di EOL

[core] 
    autocrlf = true 

nel tuo .gitconfig. Questo costringerà ogni file di testo a terminare la riga di Windows. svn per impostazione predefinita ignora le terminazioni di riga e se i tuoi editor di testo su Windows sono sani di mente puoi lasciarlo in questo modo. Altrimenti, aggiungi this file alla configurazione di svn (facoltativamente modificando native a CRLF) assicurando che le terminazioni di riga CRLF coerenti vengano eliminate.

Impostare autocrlf = input e modificare a LF per sempre terminazioni di linea linux in tutto.