summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2012-12-13 18:03:33 +0100
committerJean Delvare <jdelvare@suse.de>2012-12-13 18:03:33 +0100
commit49e8fa41c5dfd8d75fe253a0add70d4a6f90fc6e (patch)
tree768cb5f6c6d9918af74fd4ac73d4a9433aae1626
parent19eecdda60b7e7f9e7d7efacc631869e15cbd569 (diff)
downloadquilt-49e8fa41c5dfd8d75fe253a0add70d4a6f90fc6e.tar.gz
refresh: Accept refreshing empty patches
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.
-rw-r--r--quilt/refresh.in9
-rw-r--r--test/refresh.test22
2 files changed, 29 insertions, 2 deletions
diff --git a/quilt/refresh.in b/quilt/refresh.in
index 5245eeb..6c6b4d0 100644
--- 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
diff --git a/test/refresh.test b/test/refresh.test
new file mode 100644
index 0000000..7bfcaae
--- /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