quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [PATCH] refresh: Accept refreshing empty patches


From: Jean Delvare
Subject: [Quilt-dev] [PATCH] refresh: Accept refreshing empty patches
Date: Mon, 10 Dec 2012 15:25:08 +0100

If told to refresh a patch and the patch is empty, still obey. The
user should know what he/she is doing. If the patch was non-empty
before, we must erase it, otherwise a subsequent pop will fail,
complaining that the patch should be refreshed.
---
 quilt/refresh.in  |    9 +++++++--
 test/refresh.test |   22 ++++++++++++++++++++++
 2 files changed, 29 insertions(+), 2 deletions(-)

--- /dev/null
+++ b/test/refresh.test
@@ -0,0 +1,22 @@
+       $ mkdir patches
+
+       $ echo a > a
+       $ echo b > b
+       $ diff -u a b > patches/patch
+       $ echo patch -p0 > patches/series
+       $ rm -f b
+       $ quilt push -q
+       > Applying patch patches/patch
+       > Now at patch patches/patch
+
+       $ echo a > a
+       $ quilt refresh
+       > Nothing in patch patches/patch
+       $ quilt pop
+       > Removing patch patches/patch
+       > Restoring a
+       >
+       > No patches applied
+       $ cat a
+       > a
+       $ cat patches/patch
--- a/quilt/refresh.in
+++ b/quilt/refresh.in
@@ -247,7 +247,7 @@ do
        fi
 done >> $tmp_patch
 
-if ! [ -s $tmp_patch ]
+if [ -n "$opt_fork" -a ! -s $tmp_patch ]
 then
        printf $"Nothing in patch %s\n" "$(print_patch "$patch")" >&2
        die 1
@@ -347,7 +347,12 @@ then
                        "$(print_patch "$old_patch")" \
                        "$(print_patch "$patch")"
        else
-               printf $"Refreshed patch %s\n" "$(print_patch "$patch")"
+               if [ -s $tmp_patch ]
+               then
+                       printf $"Refreshed patch %s\n" "$(print_patch "$patch")"
+               else
+                       printf $"Nothing in patch %s\n" "$(print_patch 
"$patch")"
+               fi
        fi
        touch "$QUILT_PC/$patch/.timestamp"
 else

-- 
Jean Delvare
Suse L3




reply via email to

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