summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2014-04-09 10:17:09 +0200
committerJean Delvare <jdelvare@suse.de>2014-04-09 10:17:09 +0200
commit6c8254913549bea07fe62124324a68af773188f8 (patch)
tree7329484839a7c60adbb5a00a5557b6206ceda776
parentbe4fe458af06bc00094bb0b5ba1db33b209860dd (diff)
downloadquilt-6c8254913549bea07fe62124324a68af773188f8.tar.gz
patches: Fix heuristic for unapplied patches with timestamps
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.
-rw-r--r--quilt/patches.in2
-rw-r--r--test/timestamps.test46
2 files changed, 47 insertions, 1 deletions
diff --git a/quilt/patches.in b/quilt/patches.in
index 6a245c0..1007ca7 100644
--- 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(/^[^\/]*\//, "")
diff --git a/test/timestamps.test b/test/timestamps.test
new file mode 100644
index 0000000..f25c0f2
--- /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