Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-p4 submit fails with patch does not apply

When I do the following:

$ git-p4 submit

I wind up with the following error trace:

error: patch failed: foo/bar/blah.h:1
error: foo/bar/blah.h: patch does not apply
Unfortunately applying the change failed!
What do you want to do?
[s]kip this patch / [a]pply the patch forcibly and with .rej files / [w]rite the patch to a file (patch.txt) 

How can I recover from this situation and make a successful submission?

FWIW, our P4 server is configured to use keyword expansion (filetype = text+k) and there is an expanded keyword at line 3 of the problem file. I made a change at line 1.

I've tried removing the delta at line 1, but the error persists when I retry the git-p4 submit.

like image 895
escouten Avatar asked Jan 28 '12 04:01

escouten


2 Answers

Figured it out just after posting this question.

The trick was going in behind P4's back and stripping out the keyword expansion.

chmod +w foo/bar/blah.h
edit foo/bar/blah.h #change $File: //depot/foo/bar/blah.h$ to $File$
chmod -w foo/bar/blah.h
git-p4 submit

This worked.

like image 119
escouten Avatar answered Oct 25 '22 18:10

escouten


This bit me as well. The other option is to change the file type through the GUI tool or the command line so that it's no longer a text+k or text+ko file type (so expansion doesn't happen). If you do that, it will commit OK.

like image 29
Ted Naleid Avatar answered Oct 25 '22 16:10

Ted Naleid