python - Git P4 under Cygwin: Submit fails with "Patch does not apply" -
i'm attempting use git-p4 under cygwin. "clone" , "rebase" parts of workflow appear working correctly, unable "submit". i'm guessing may have line-ending convention. i've looked @ this git-p4 issue , linked items, manipulations of line-ending , whitespace configuration far unsuccessful. items of note in configuration:
(1) i'm using bash shell function trick paths work correctly:
$ type p4 p4 function p4 () { p4=`which p4`; pwd=$(cygpath -wa .) "${p4}" "$@" }
(2) i've tried settings git's autocrlf
value -- result failure regardless of (true,false,input). attempting "false" makes sense when diff-ing against depot.
(3) i've played p4 clientspec's lineend values; attempting "unix", b/c of cygwin , p4 sandbox server running under osx.
the test simple. repo contains 1 file, foo1. depot version looks (output using od -c
):
0000000 f o o 1 \n \n 0000006
the locally-git-committed version looks like:
0000000 f o o 1 s t h e o n e ! 0000020 \n \n 0000022
i've added additional diagnostic output applycommit()
method in git-p4. in conjunction running submit using --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 remotes/p4/master reading pipe: ['git', 'config', '--bool', 'git-p4.useclientspec'] opening pipe: ['p4', '-g', 'where', '//depot/foo/...'] perforce checkout depot path //depot/foo/ located @ 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 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 not apply unfortunately applying change failed! reading pipe: ['git', 'config', '--bool', 'git-p4.attemptrcscleanup'] //depot/foo/foo1#1 - edit, reverted
note "sanity:" diagnostic line. value of trypatchcmd
fails within applycommit()
method. if execute first part of statement @ bash command line, see:
2303176ae8c575313616ae2c4a35358258742598 diff --git a/foo1 b/foo1 index 630baf44b0874b3319c2814399f0b03106912183..4c23e4512b3347ec31068e464b64cbd99851cc9a 100644 --- a/foo1 +++ b/foo1 @@ -1,2 +1,2 @@ -foo1 +foo1 one!
piping second part of command results in no error. perplexed why command fails when executed using os.system()
in python script succeeds otherwise. thoughts?
i believe i've solved this. problem two-fold. first cardinal sin -- not reading manual carefully. documentation in submit section states:
submitting changes git repository p4 repository requires separate p4 client workspace. should specified using p4client environment variable or git configuration variable git-p4.client. p4 client must exist, client root created , populated if not exist.
it took time through head meant two physical working copies -- 1 git, 1 p4. git-p4 script choking on trying perform git , p4 operations in same folder, , such in-place operations don't play perforce's checkout model. discovered performing same test workflow on mac, errored [more clearly] "cannot clobber writable file". twiddling "clobber" in p4 clientspec able submit in both mac , cygwin work, , put me on right trail.
there's detailed walkthrough on setting dual workspace structure @ this perforce page.
second: interestingly, still appear require --ignore-whitespace
part of git apply
logic in cygwin environment. that's git-p4
hack willing live with.
Comments
Post a Comment