python-patch icon indicating copy to clipboard operation
python-patch copied to clipboard

No error returned if patching is aborted due to existing .orig file

Open fmarier opened this issue 6 years ago • 0 comments

Given the following a.txt file:

1
2
3

and the following working.patch:

--- a.txt	2019-03-28 17:02:04.832004033 -0700
+++ b.txt	2019-03-28 17:02:34.999576803 -0700
@@ -1,4 +1,4 @@
-1
+0
 2
 3

Patching will fail if a.txt.orig already exists:

$ touch a.txt.orig
$ ./patch.py --debug working.patch && echo Success!
   DEBUG reading working.patch
   DEBUG crlf: 0  lf: 5  cr: 0	 - file: b.txt hunk: 1
   DEBUG -  1 hunks for a.txt
   DEBUG total files: 1  total hunks: 1
   DEBUG normalize filenames
   DEBUG     patch type = plain
   DEBUG     source = a.txt
   DEBUG     target = b.txt
   DEBUG processing 1/1:	 a.txt
   DEBUG  hunk no.1 for file a.txt  -- is ready to be patched
 WARNING can't backup original file to a.txt.orig - aborting
Success!

$ cat a.txt
1
2
3

but the program will exit successfully instead of returning an error.

fmarier avatar Apr 18 '19 00:04 fmarier