summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2015-02-25 09:00:23 +0100
committerJean Delvare <jdelvare@suse.de>2015-02-25 09:00:23 +0100
commit9d01bde5699d840b0c1aa71eea2af41bdd1201bd (patch)
tree56fa4c0fc935b0ee0ee38a5649878388911cabb4
parent53aaf3f477dd2d030766fab55d3b14386abe2afa (diff)
downloadquilt-9d01bde5699d840b0c1aa71eea2af41bdd1201bd.tar.gz
refresh: Always preserve modification time
In the general case, when doing a backup copy of a patch on refresh, the modification time of the file is preserved. We should do the same when the patch is a symbolic link.
-rw-r--r--quilt/refresh.in2
-rw-r--r--test/symlink.test3
2 files changed, 4 insertions, 1 deletions
diff --git a/quilt/refresh.in b/quilt/refresh.in
index b7c7e55..aa9a2ae 100644
--- a/quilt/refresh.in
+++ b/quilt/refresh.in
@@ -326,7 +326,7 @@ then
elif ( [ -z "$QUILT_BACKUP" -o ! -e "$patch_file" ] || \
if [ -L "$patch_file" ] ; \
then \
- cp "$patch_file" "$patch_file~"; \
+ cp -p "$patch_file" "$patch_file~"; \
else \
mv "$patch_file" "$patch_file~"; \
fi ) && \
diff --git a/test/symlink.test b/test/symlink.test
index 4610af6..51a81f2 100644
--- a/test/symlink.test
+++ b/test/symlink.test
@@ -28,6 +28,7 @@
# Test the refresh --backup
$ echo "foo changed 3" > foo
+ $ touch -r patches/test.diff test.timeref
$ quilt refresh --backup --no-index -p ab
> Refreshed patch patches/test.diff
@@ -52,6 +53,8 @@
> -foo
> +foo changed 2
+ $ [ patches/test.diff~ -nt test.timeref ] && echo "mtimes differ"
+
# Test the refresh when target is read-only
$ chmod -w test.diff
$ echo "foo changed 4" > foo