3

Cygwin で git-p4 を使用しようとしています。ワークフローの「クローン」と「リベース」の部分は正しく機能しているように見えますが、「送信」できません。行末の規則と関係があるのではないかと思います。この git-p4 の問題とそのリンクされたアイテムを見てきましたが、行末と空白の構成の操作は今のところ成功していません。私の構成で注目すべき項目:

(1) パスが正しく機能するように、bash シェル関数のトリックを使用しています。

$ type p4
p4 is a function
p4 () 
{ 
    P4=`which p4`;
    PWD=$(cygpath -wa .) "${P4}" "$@"
}

(2)gitの値のすべての設定を試しましたautocrlf-結果は(true、false、input)に関係なく失敗です。現在、デポと比較するときに最も理にかなっている「false」を試みています。

(3) p4 clientspec の lineend 値も試しました。現在、「unix」、Cygwin および OSX で実行されている P4 サンドボックス サーバーの b/c を試みています。

テストは簡単です。リポジトリには 1 つのファイル foo1 が含まれています。デポのバージョンは次のようになります (を使用した出力od -c):

0000000   f   o   o   1  \n  \n
0000006

ローカルで git コミットされたバージョンは次のようになります。

0000000   f   o   o   1       i   s       t   h   e       o   n   e   !
0000020  \n  \n
0000022

applyCommit()git-p4のメソッドに診断出力を追加しました。--verbose を使用してサブミットを実行すると、次のようになります。

 $ git p4 submit --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 ce414288d1b5d52dbad20c1a29f1875cfff7c281
 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/foo/...']
 Perforce checkout for depot path //depot/foo/ located at c:\git\foo\
 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.detectRenames']
 Reading pipe: ['git', 'config', 'git-p4.detectCopies']
 Reading pipe: ['git', 'config', '--bool', 'git-p4.detectCopiesHarder']
 Reading pipe: ['git', 'show', '-s', '--format=format:%h %s', '2303176ae8c575313616ae2c4a35358258742598']
 Applying 2303176 updating foo1
 Opening pipe: p4 -G users
 Reading pipe: ['git', 'log', '--max-count=1', '--format=%ae', '2303176ae8c575313616ae2c4a35358258742598']
 Reading pipe: git diff-tree -r  "2303176ae8c575313616ae2c4a35358258742598^" "2303176ae8c575313616ae2c4a35358258742598"
 //depot/foo/foo1#1 - opened for edit
 Sanity: git diff-tree --full-index -p "2303176ae8c575313616ae2c4a35358258742598" | git apply --verbose --check -
 Checking patch foo1...
 error: while searching for:
 foo1


 error: patch failed: foo1:1
 error: foo1: patch does not apply
 Unfortunately applying the change failed!
 Reading pipe: ['git', 'config', '--bool', 'git-p4.attemptRCSCleanup']
 //depot/foo/foo1#1 - was edit, reverted

「Sanity:」診断行に注意してください。これは、メソッドtryPatchCmd内で失敗する の値です。applyCommit()bash コマンド ラインでステートメントの最初の部分を実行すると、次のように表示されます。

 2303176ae8c575313616ae2c4a35358258742598
 diff --git a/foo1 b/foo1
 index 630baf44b0874b3319c2814399f0b03106912183..4c23e4512b3347ec31068e464b64cbd99851cc9a 100644
 --- a/foo1
 +++ b/foo1
 @@ -1,2 +1,2 @@
 -foo1
 +foo1 is the one!

これをコマンドの 2 番目の部分にパイプしても、エラーは発生しません。os.system()Pythonスクリプトを使用して実行するとコマンドが失敗するのに、それ以外の場合は成功する理由について当惑しています。考え?

4

1 に答える 1