Skip to content

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

Open
@fmarier

Description

@fmarier

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions