summaryrefslogtreecommitdiffstats
path: root/lib/backup-files.c
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2004-10-17 20:42:30 +0000
committerAndreas Gruenbacher <agruen@suse.de>2004-10-17 20:42:30 +0000
commit423903f9095b4e447b738715e460cb9319a44c2e (patch)
tree202804861a336d5b6794552193129d5ef308f460 /lib/backup-files.c
parent4664fd1972719706806eb94572beb92a64435f59 (diff)
downloadquilt-423903f9095b4e447b738715e460cb9319a44c2e.tar.gz
- When applying a patch with -q and without -f no (individual)
reject files are created, and the "patching file" comments are missing as well. In that case, we don't know wich files the "-- saving rejects to file /tmp/foo" comments belong to, and we can't fic them up. Remove them, instead. - Pop command: Touch files after they are restored so that tools like make don't get confused. - Update test cases. - Bump to version 0.37.
Diffstat (limited to 'lib/backup-files.c')
-rw-r--r--lib/backup-files.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/backup-files.c b/lib/backup-files.c
index fcbd2ff..03628d4 100644
--- a/lib/backup-files.c
+++ b/lib/backup-files.c
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <utime.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
@@ -44,7 +45,7 @@ enum { what_noop, what_backup, what_restore, what_remove };
const char *opt_prefix="", *opt_suffix="", *opt_file;
int opt_silent, opt_what=what_noop, opt_ignore_missing;
-int opt_nolinks, opt_walk_directory;
+int opt_nolinks, opt_touch;
#define LINE_LENGTH 1024
@@ -242,6 +243,8 @@ process_file(const char *file)
printf("Copying %s\n", file);
if (link_or_copy(file, &st, backup))
return 1;
+ if (opt_touch)
+ utime(backup, NULL);
if (opt_nolinks) {
if (ensure_nolinks(file))
return 1;
@@ -272,6 +275,8 @@ process_file(const char *file)
unlink(file);
if (link_or_copy(backup, &st, file))
return 1;
+ if (opt_touch)
+ utime(file, NULL);
if (opt_nolinks) {
if (ensure_nolinks(file))
return 1;
@@ -335,7 +340,7 @@ main(int argc, char *argv[])
progname = argv[0];
- while ((opt = getopt(argc, argv, "brxB:z:f:shFL")) != -1) {
+ while ((opt = getopt(argc, argv, "brxB:z:f:shFLt")) != -1) {
switch(opt) {
case 'b':
opt_what = what_backup;
@@ -373,6 +378,10 @@ main(int argc, char *argv[])
opt_nolinks = 1;
break;
+ case 't':
+ opt_touch = 1;
+ break;
+
case 'h':
default:
usage();