[PATCH v2 0/3] apply: handle traditional patches with space in filename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Sixt wrote:

> Why not just write an explicit test vector? The result of expand will be 
> constant, no?

Sorry for the long delay.  Here's a re-roll, meant to replace
jn/apply-filename-with-sp from pu.

Patch 1 fixes an edge case for git apply -p when traditional patches
have quotation marks in file names (so: an edge case of an edge).
But that is only a side-effect; the main purpose is to rearrange
code to prepare for patch 3.  Except for the commit message, it is
unchanged from the version in pu.

Patch 2 contains the funny-filenames tests.  Testing on Windows would
be welcome.  The test vectors are included in the patch to avoid a
source of non-determinism (for example, GNU diff could stop emiting
traditional patches some day).  The script used to generate them is
provided to make the test easy to change.

Patch 3 is basically as before, except that find_name_traditional()
calls find_name_common() directly now instead of redundantly checking
again for quotes at the beginning of filenames.  As before, the
purpose is to handle patches to files with whitespace in their
names, by trying to use the timestamp instead of arbitrary whitespace
as a name terminator (falling back to the old method if that fails).

Thanks for your help so far.  The code would be much worse without it.

Jonathan Nieder (3):
  apply: split quoted filename handling into new function
  tests: exercise "git apply" with weird filenames
  apply: handle traditional patches with space in filename

 builtin/apply.c                  |  251 ++++++++++++++++++++++++++++++++------
 t/t4120-apply-popt.sh            |   35 +++++-
 t/t4135-apply-weird-filenames.sh |   75 +++++++++++
 t/t4135/.gitignore               |    3 +
 t/t4135/add-plain.diff           |    5 +
 t/t4135/add-with backslash.diff  |    5 +
 t/t4135/add-with quote.diff      |    5 +
 t/t4135/add-with spaces.diff     |    5 +
 t/t4135/add-with tab.diff        |    5 +
 t/t4135/damaged.diff             |    5 +
 t/t4135/diff-plain.diff          |    5 +
 t/t4135/diff-with backslash.diff |    5 +
 t/t4135/diff-with quote.diff     |    5 +
 t/t4135/diff-with spaces.diff    |    5 +
 t/t4135/diff-with tab.diff       |    5 +
 t/t4135/git-plain.diff           |    7 +
 t/t4135/git-with backslash.diff  |    7 +
 t/t4135/git-with quote.diff      |    7 +
 t/t4135/git-with spaces.diff     |    7 +
 t/t4135/git-with tab.diff        |    7 +
 t/t4135/make-patches             |   45 +++++++
 21 files changed, 457 insertions(+), 42 deletions(-)
 create mode 100755 t/t4135-apply-weird-filenames.sh
 create mode 100644 t/t4135/.gitignore
 create mode 100644 t/t4135/add-plain.diff
 create mode 100644 t/t4135/add-with backslash.diff
 create mode 100644 t/t4135/add-with quote.diff
 create mode 100644 t/t4135/add-with spaces.diff
 create mode 100644 t/t4135/add-with tab.diff
 create mode 100644 t/t4135/damaged.diff
 create mode 100644 t/t4135/diff-plain.diff
 create mode 100644 t/t4135/diff-with backslash.diff
 create mode 100644 t/t4135/diff-with quote.diff
 create mode 100644 t/t4135/diff-with spaces.diff
 create mode 100644 t/t4135/diff-with tab.diff
 create mode 100644 t/t4135/git-plain.diff
 create mode 100644 t/t4135/git-with backslash.diff
 create mode 100644 t/t4135/git-with quote.diff
 create mode 100644 t/t4135/git-with spaces.diff
 create mode 100644 t/t4135/git-with tab.diff
 create mode 100755 t/t4135/make-patches

-- 
1.7.2.1.544.ga752d.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]