SHA256
1
0
forked from pool/quilt
quilt/quilt-patches-fix-heuristic-for-unapplied-patches-with-timestamps.patch

81 lines
2.3 KiB
Diff
Raw Normal View History

From: Jean Delvare <jdelvare@suse.de>
Date: Wed, 9 Apr 2014 10:17:09 +0200
Subject: patches: Fix heuristic for unapplied patches with timestamps
Patch-mainline: yes
Git-commit: 6c8254913549bea07fe62124324a68af773188f8
References: bnc#872719
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
@@ -74,7 +74,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