issue with applying a unified patch of zero line context concerning the first line of a file
Guillaume ORIOL <[email protected]> Wed, 28 Sep 2016 09:33:05 +0200
| Newsgroups | gmane.comp.gnu.utils.bugs |
|---|---|
| Message-ID | <CAARwrvKnUejtE-RfXVzx-rE_pO+Lo2J32-5eoB80zaTTX=HkFQ@mail.gmail.com> |
Hi, I get an unexpected result when applying a unified patch of zero line context concerning the first line of a file. Here is the way I reproduce it: $ echo -e "B\nC\n" >file.a $ echo -e "A\nB\nC\n" >file.b $ diff --unified=0 file.a file.b >file.patch $ patch --unified file.a file.patch patching file `file.a' Patch attempted to create file `file.a', which already exists. Hunk #1 FAILED at 1. 1 out of 1 hunk FAILED -- saving rejects to file.a.rej However, if I change the number of context lines to 1, I get no error. Here is the versions I use: $ diff --version diff - GNU diffutils version 2.7 $ patch --version patch 2.5 Copyright 1988 Larry Wall Copyright 1997 Free Software Foundation, Inc. [...] -- Guillaume Oriol