quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [PATCH] patches: Fix heuristic for unapplied patches with ti


From: Jean Delvare
Subject: [Quilt-dev] [PATCH] patches: Fix heuristic for unapplied patches with timestamps
Date: Sun, 06 Apr 2014 11:53:36 +0200

The heuristic to find file names in unapplied patches fails miserably
on all patches with timestamps. We have to consider everything past
the last tab as the timestamp and strip it. The timestamp itself will
contain spaces so we can't split on that.

This fixes a regression introduced by commit 4df47975. It's hard to
believe this has been broken for over 4 years and nobody ever noticed.
---
 quilt/patches.in     |    2 +-
 test/timestamps.test |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)

--- a/quilt/patches.in
+++ b/quilt/patches.in
@@ -71,7 +71,7 @@ touched_by_patch()
        |  awk '
        /^(\+\+\+|---)[ \t]/ {
                sub(/^(\+\+\+|---)[ \t]/, "")
-               sub(/[ \t][^ \t]*$/, "")
+               sub(/\t[^\t]*$/, "")
                sub(/^\/dev\/null/, "")
                for (i=0; i<'$strip'; i++)
                        sub(/^[^\/]*\//, "")
--- /dev/null
+++ b/test/timestamps.test
@@ -0,0 +1,46 @@
+# Test how quilt behaves when patches include timestamps
+
+$ mkdir patches
+
+$ cat > patches/series
+< unified-create.patch
+< unified-update.patch
+< unified-delete.patch
+
+$ cat > patches/unified-create.patch
+< diff -ruN a/file b/file
+< --- a/file   1970-01-01 01:00:00.000000000 +0100
+< +++ b/file   2014-01-15 11:19:43.000000000 +0100
+< @@ -0,0 +1 @@
+< +new line
+
+$ cat > patches/unified-update.patch
+< diff -ruN a/file b/file
+< --- a/file   2014-01-15 11:19:43.000000000 +0100
+< +++ b/file   2014-01-15 11:20:17.000000000 +0100
+< @@ -1 +1 @@
+< -new line
+< +updated line
+
+$ cat > patches/unified-delete.patch
+< diff -ruN a/file b/file
+< --- a/file   2014-01-15 11:20:17.000000000 +0100
+< +++ b/file   1970-01-01 01:00:00.000000000 +0100
+< @@ -1 +0,0 @@
+< -updated line
+
+$ quilt patches file
+> patches/unified-create.patch
+> patches/unified-update.patch
+> patches/unified-delete.patch
+
+$ quilt push -qa
+> Applying patch patches/unified-create.patch
+> Applying patch patches/unified-update.patch
+> Applying patch patches/unified-delete.patch
+> Now at patch patches/unified-delete.patch
+
+$ quilt patches file
+> patches/unified-create.patch
+> patches/unified-update.patch
+> patches/unified-delete.patch

-- 
Jean Delvare
SUSE L3 Support




reply via email to

[Prev in Thread] Current Thread [Next in Thread]