2013-04-11 17 views
6

私はgitとperforceの中間ブリッジとして実行していたrepoでgit p4 submitを実行しようとしました。複数の人がリモートとしてレポを使用しており、定期的にPERFORCEに返送されます。git p4 submitが失敗しました

私は再現できないような奇妙な振る舞いを持ついくつかの重複したperforceコミットを除いて、ほとんどうまく動いています。青いうちのある日、私はこのエラーを受けます。私はもはや、gitコミットを実行することはできません。

[email protected]:~/Source/code$ git p4 submit -M --export-labels 
Perforce checkout for depot path //depot/perforce/workspace/ located at /home/user/Source/git-p4-area/perforce/workspace/ 
Synchronizing p4 checkout... 
... - file(s) up-to-date. 
Applying ffa390f comments in config xml files 
//depot/perforce/workspace/sub/folder/structure/first.xml#3 - opened for edit 
//depot/perforce/workspace/sub/folder/structure/second.xml#3 - opened for edit 
//depot/perforce/workspace/sub/folder/structure/third.xml#3 - opened for edit 
//depot/perforce/workspace/sub/folder/structure/forth.xml#3 - opened for edit 
//depot/perforce/workspace/sub/folder/structure/fifth.xml#1 - opened for edit 
error: patch failed: sub/folder/structure/first.xml:1 
error: sub/folder/structure/first.xml: patch does not apply 
error: patch failed: sub/folder/structure/second.xml:1 
error: sub/folder/structure/second.xml: patch does not apply 
error: patch failed: sub/folder/structure/third.xml:1 
error: sub/folder/structure/third.xml: patch does not apply 
error: patch failed: sub/folder/structure/forth.xml:1 
error: sub/folder/structure/forth.xml: patch does not apply 
error: patch failed: sub/folder/structure/fifth.xml:1 
error: sub/folder/structure/fifth.xml: patch does not apply 
Unfortunately applying the change failed! 
//depot/perforce/workspace/sub/folder/structure/first.xml#1 - was edit, reverted 
//depot/perforce/workspace/sub/folder/structure/second.xml#3 - was edit, reverted 
//depot/perforce/workspace/sub/folder/structure/third.xml#3 - was edit, reverted 
//depot/perforce/workspace/sub/folder/structure/forth.xml#3 - was edit, reverted 
//depot/perforce/workspace/sub/folder/structure/fifth.xml#3 - was edit, reverted 
No commits applied. 

というエラーが多く、このエラーのようになります。

git-p4 submit fails with patch does not apply

私は任意のキーワード置換をやってないんだけど、私はそれが何ができるか分からない点が異なります。 --verboseを追加すると、あまり説明できないようです(私は手元にそのコマンド出力がありません)。

唯一の変更は、以下の内容の.gitattributesファイルを私がコミットした。このコミットする前にそのファイルをgitattributesながらしかし、それは(私は以来.gitattributesは、より詳細なファイル作りました)

* text eol=lf 

私はロールバックしようとしていることであることができなかったので、代わりに仕事をしたして作られたコミットこのリモートレポをこの問題のコミットの直前にコミットし、次にそのレポからこのリモートレポに再コミットして再送信します。同じ振る舞い。私は元に戻って、同じファイルに対して別の編集を行い、再圧縮して再送信しました。同じ振る舞い。そして、これらのファイルでのみ発生するようです。ロールバック以来、私は他のファイルを編集しようとしました。 dos2unixを実行して、問題のファイルに対してUNIXの行末を強制的に実行しようとしましたが、それも修正されませんでした。

ここでは何が起こっているのか、より良い説明ができますか?私が末尾にできるgitログファイルはありますか?いかなる援助も感謝します。

編集:.gitattributesファイルの有無にかかわらず、問題を再テストしました。差はありませんでした。現在私のグローバルcore.autocrlf設定が入力されています。しかし、.gitattributesファイルが欠落していて、違いがないように見えました。 --verboseがオンになっている問題のファイルのうちの1つだけで再テストしたときの見た目です。

[email protected]:/code$ git p4 submit -M --export-labels --verbose 
Reading pipe: git name-rev HEAD 
Reading pipe: ['git', 'config', 'git-p4.allowSubmit'] 
Reading pipe: git rev-parse --symbolic --remotes 
Reading pipe: git rev-parse p4/master 
Reading pipe: git cat-file commit 0457c7589ea679dcc0c9114b34f8f30bc2ee08cf 
Reading pipe: git cat-file commit HEAD~0 
Reading pipe: git cat-file commit HEAD~1 
Reading pipe: ['git', 'config', 'git-p4.conflict'] 
Origin branch is remotes/p4/master 
Reading pipe: ['git', 'config', '--bool', 'git-p4.useclientspec'] 
Opening pipe: ['p4', '-G', 'where', '//depot/perforce/workspace/...'] 
Perforce checkout for depot path //depot/perforce/workspace/ located at /home/user/Source/git-p4-area/perforce/workspace/ 
Synchronizing p4 checkout... 
... - file(s) up-to-date. 
Opening pipe: p4 -G opened ... 
Reading pipe: ['git', 'rev-list', '--no-merges', 'remotes/p4/master..master'] 
Reading pipe: ['git', 'config', '--bool', 'git-p4.skipUserNameCheck'] 
Reading pipe: ['git', 'config', 'git-p4.detectCopies'] 
Reading pipe: ['git', 'config', '--bool', 'git-p4.detectCopiesHarder'] 
Reading pipe: ['git', 'show', '-s', '--format=format:%h %s', 'ef3b95f5fec193fe2612b28e2e3b5e7f8ba9419e'] 
Applying ef3b95f making test change 
Opening pipe: p4 -G users 
Reading pipe: ['git', 'log', '--max-count=1', '--format=%ae', 'ef3b95f5fec193fe2612b28e2e3b5e7f8ba9419e'] 
Reading pipe: git diff-tree -r -M "ef3b95f5fec193fe2612b28e2e3b5e7f8ba9419e^" "ef3b95f5fec193fe2612b28e2e3b5e7f8ba9419e" 
//depot/perforce/workspace/sub/folder/structure/first.xml#3 - opened for edit 
<stdin>:17: trailing whitespace. 
<!-- comment line 1 --> 
<stdin>:18: trailing whitespace. 
<!-- comment line 2 --> 
<stdin>:19: trailing whitespace. 
<!-- comment line 3 --> 
error: patch failed: sub/folder/structure/first.xml:1 
error: sub/folder/structure/first.xml: patch does not apply 
Unfortunately applying the change failed! 
Reading pipe: ['git', 'config', '--bool', 'git-p4.attemptRCSCleanup'] 
//depot/perforce/workspace/sub/folder/structure/first.xml#3 - was edit, reverted 
No commits applied. 
Reading pipe: ['git', 'config', '--bool', 'git-p4.exportLabels'] 
Opening pipe: ['p4', '-G', 'labels', '//depot/ipstor.maple/automation/...'] 
Reading pipe: ['git', 'tag'] 
Reading pipe: ['git', 'config', 'git-p4.labelExportRegexp'] 
+0

私は 'git diff-tree -r -M" ef3b95f5fec193fe2612b28e2e3b5e7f8ba9419e^"" ef3b95f5fec193fe2612b28e2e3b5e7f8ba9419e "と言って、手動でパッチを適用できるかどうかを確かめていますか? –

答えて

2

私はそれを理解しました。この問題は行末で発生します。私は別のファイルでこの問題を再テストしました。この場合、エラーはperforceワークスペースでチェックアウトされたファイルの行末がwin-style crlfであり、git repoのファイルの行末がUNIXスタイルlf。

この場合、私はPERFORCEでファイルをチェックアウトし、dos2unixを実行して提出してからgit p4 submitを実行しました。

これは実際の解決策ではありません。これは単なる回避策です。 gitのメーリングリストに電子メールを送り、修正を求めました。 http://marc.info/?l=git&m=136630231402536&w=2

2

私はgit config apply.ignorewhitespace changeを設定した後に投稿しました。私はgitのcore.whitespace設定はデフォルトごとに制限的であるため、エラーが発生したと思わ

The ones that are turned on by default are blank-at-eol, which looks for spaces at the end of a line; blank-at-eof, which notices blank lines at the end of a file; and space-before-tab, which looks for spaces before tabs at the beginning of a line.

http://git-scm.com/book/en/v2/Customizing-Git-Git-Configurationを参照)

apply.ignorewhitespace changeを設定するには、これらのエラーを修正するgit applyすることができます。 core.whitespaceの設定をあまり制限のないものに変更すると、問題が解決するはずですが、これを試していません。

+0

ありがとう、あなたのソリューションは私のために働いた! – beshanoe

関連する問題