using diff/patch in windows, aka, "can't find file to patch at input line 4" -


i using cvs , win7. need copy changes trunk branch, thought use "diff -run" put changes file, , use "patch -i" apply them branch.

so saw this page, , this page. had cygwin diff, got gnu patch here. made 2 files

\test\mydir1\afile.txt \test\mydir2\afile.txt 

which have minor differences. type

cd test diff -run mydir1 mydir2 >test.patch patch --dry-run -i test.patch 

and result is

can't find file patch @ input line 4 perhaps should have used -p or --strip option? 

so tried

patch --dry-run --verbose -p1 -i test.patch 

and same error. tried lot of other things long time no success. why hard?

ok here 2 things needed know, not documented anywhere

  • diff output uses unix format, patch requires dos format
  • the default "strip" in patch not -p0 might expect. -p1.

this works...

diff -run mydir1 mydir2 | unix2dos > test.patch patch -p0 -i test.patch 

you must convert dos line endings, , must specify -p0. otherwise default -p1. hope else.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -