Please no, let's fix patch instead.
Am 25.02.2014 14:24 schrieb "Jean Delvare" <[email protected]>:

> GNU patch is unable to deal with patch headers without timestamps if
> a file name includes a space. Quilt currently generates such patches
> if $QUILT_NO_DIFF_TIMESTAMPS is defined.
>
> In order to work around this limitation and always generate patches
> that GNU patch will be able to apply, add a tab and a dash after the
> file name in the patch header if $QUILT_NO_DIFF_TIMESTAMPS is set and
> the file name contains a space.
>
> Originally I tried adding just a tab, and GNU patch was fine with
> that, however the tailing tab was removed by "quilt refresh
> --strip-trailing-whitespace" which many users have as a default
> option. So I added a dash after the tab to protect it. I suppose it
> could have been any other character, but that one worked. If you think
> something else should be used instead, just let me know.
> ---
>  quilt/scripts/patchfns.in    |    8 ++++++++
>  test/space-in-filenames.test |   41
> ++++++++++++++++++++++++++++++-----------
>  2 files changed, 38 insertions(+), 11 deletions(-)
>
> --- quilt.orig/test/space-in-filenames.test     2014-02-24
> 23:13:28.466215202 +0100
> +++ quilt/test/space-in-filenames.test  2014-02-24 23:34:30.627834687 +0100
> @@ -44,13 +44,13 @@ $ quilt diff -p ab
>  > Index: b/a: b [c]
>  > ===================================================================
>  > --- /dev/null
> -> +++ b/a: b [c]
> +> +++ b/a: b [c]       -
>  > @@ -0,0 +1 @@
>  > +new line
>  > Index: b/foo bar
>  > ===================================================================
> -> --- a/foo bar
> -> +++ b/foo bar
> +> --- a/foo bar        -
> +> +++ b/foo bar        -
>  > @@ -1 +1 @@
>  > -foo
>  > +bar
> @@ -61,13 +61,13 @@ $ cat patches/test.diff
>  > Index: b/a: b [c]
>  > ===================================================================
>  > --- /dev/null
> -> +++ b/a: b [c]
> +> +++ b/a: b [c]       -
>  > @@ -0,0 +1 @@
>  > +new line
>  > Index: b/foo bar
>  > ===================================================================
> -> --- a/foo bar
> -> +++ b/foo bar
> +> --- a/foo bar        -
> +> +++ b/foo bar        -
>  > @@ -1 +1 @@
>  > -foo
>  > +bar
> @@ -78,13 +78,13 @@ $ cat patches/test.diff
>  > Index: b/a: b [c]
>  > ===================================================================
>  > --- /dev/null
> -> +++ b/a: b [c]
> +> +++ b/a: b [c]       -
>  > @@ -0,0 +1 @@
>  > +new line
>  > Index: b/foo bar
>  > ===================================================================
> -> --- a/foo bar
> -> +++ b/foo bar
> +> --- a/foo bar        -
> +> +++ b/foo bar        -
>  > @@ -1 +1 @@
>  > -foo
>  > +bar
> @@ -96,15 +96,34 @@ $ quilt grep new
>  $ quilt grep " "
>  > a: b [c]:new line
>
> +$ quilt pop -q
> +> Removing patch patches/test.diff
> +> No patches applied
> +
> +$ quilt patches foo
> +$ quilt patches "foo bar"
> +> patches/test.diff
> +$ quilt patches bar
> +$ quilt patches "foo bar baz"
> +$ quilt patches 'a: b [c]'
> +> patches/test.diff
> +$ quilt patches a
> +$ quilt patches b
> +$ quilt patches 'a: b c'
> +$ quilt patches "foo bar" 'a: b [c]'
> +> patches/test.diff
> +
> +$ quilt push -q
> +> Applying patch patches/test.diff
> +> Now at patch patches/test.diff
> +
>  $ quilt remove "a: b [c]"
>  > File a: b [c] removed from patch patches/test.diff
>
>  $ quilt files
> -> foo
>  > foo bar
>
>  $ quilt remove "foo bar"
>  > File foo bar removed from patch patches/test.diff
>
>  $ quilt files
> -> foo
> --- quilt.orig/quilt/scripts/patchfns.in        2014-02-24
> 23:11:58.876431248 +0100
> +++ quilt/quilt/scripts/patchfns.in     2014-02-24 23:38:02.564189493
> +0100
> @@ -731,6 +731,14 @@ diff_file()
>                 || new_date=$'\t'"1970-01-01 00:00:00.000000000 +0000"
>         fi
>
> +       # Workaround for GNU patch which can't cope with no timestamps and
> +       # spaces in file names at the same time
> +       if [ -n "$QUILT_NO_DIFF_TIMESTAMPS" ]
> +       then
> +               [[ $old_hdr == *\ * ]] && old_date=$'\t'-
> +               [[ $new_hdr == *\ * ]] && new_date=$'\t'-
> +       fi
> +
>         diff $QUILT_DIFF_OPTS \
>              --label "$old_hdr$old_date" --label "$new_hdr$new_date" \
>              "$old_file" "$new_file" \
>
>
> --
> Jean Delvare
> Suse L3 Support
>
> _______________________________________________
> Quilt-dev mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/quilt-dev
>
_______________________________________________
Quilt-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to