The Python Oracle

Git P4 under Cygwin: Submit fails with "Patch does not apply"

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puddle Jumping Looping

--

Chapters
00:00 Git P4 Under Cygwin: Submit Fails With &Quot;Patch Does Not Apply&Quot;
03:17 Accepted Answer Score 3
04:54 Thank you

--

Full question
https://stackoverflow.com/questions/3017...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #git #cygwin #gitp4

#avk47



ACCEPTED ANSWER

Score 3


I believe I've solved this. The problem was two-fold. First cardinal sin -- not reading the manual carefully. The documentation in the Submit section states:

Submitting changes from a Git repository back to the p4 repository requires a separate p4 client workspace. This should be specified using the P4CLIENT environment variable or the Git configuration variable git-p4.client. The p4 client must exist, but the client root will be created and populated if it does not already exist.

It took some time to get this through my head that this actually meant two physical working copies -- one for git, one for p4. The git-p4 script was choking on trying to perform git and p4 operations in the same folder, and such in-place operations don't play well with Perforce's checkout model. I discovered this by performing the same test workflow on a Mac, which errored [more clearly] with "cannot clobber writable file". By twiddling "clobber" in the p4 clientspec I was able to get the submit in both Mac and Cygwin to work, and that put me on the right trail.

There's a detailed walkthrough on setting up the dual workspace structure at this Perforce page.

Second: interestingly, I still appear to require --ignore-whitespace as part of the git apply logic in the Cygwin environment. That's a git-p4 hack I am willing to live with.