quilt-dev
[Top][All Lists]
Advanced

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

Re: [Quilt-dev] Another shell re-write of backup-files.


From: Kaz Kylheku
Subject: Re: [Quilt-dev] Another shell re-write of backup-files.
Date: Fri, 18 Mar 2011 13:15:18 -0700
User-agent: Roundcube Webmail/0.4

On Fri, 18 Mar 2011 20:43:52 +0100, Jean Delvare <address@hidden>
wrote:
> On Friday 18 March 2011 06:32:18 pm Kaz Kylheku wrote:
>> Plus a few more fixes. It's behaving well for me now. I'm ready
>> for stress-testing with big patch stacks.
> 
> May I ask why you keep investing time in a task which I just told
> you I have _already_ accomplished?

Simply because it's not good to leave something 93% done
(compared to, say, 100% or 40%, which are both good exit points,
or even 99%). :)

This may also have to do with schooling. Just because
your classmate has done the homework assignment doesn't
mean you don't have to. :)

Before I started, I looked in the mailing list
and GIT, but I didn't find the new script, unfortunately.
This is something I need right away.

I just took an extra few minutes to put in the link-breaking ``noop''.

Breaking hard links is done easily using an in-place sed (sed -i): 

  find "$opt_prefix" -type f -links +1 | xargs sed -i -s ''

I'm happy with the way it works now, so I can leave it alone!

Index: quilt-hack/backup-files
===================================================================
--- quilt-hack.orig/backup-files
+++ quilt-hack/backup-files
@@ -16,9 +16,8 @@
 #   pass-through mode).
 # - Use tree-to-tree recursive cp to restore a backup (taking
everything
 #   in the backup, ignoring the file list).
-# - We don't use hard linking when restoring files, because then we
have
-#   to break the hard links anyway (quilt issues a noop -L operation).
-# - To touch restored files, we can do a copy without preserving
timestamps.
+# - To touch files after restoring, we can do a copy without
preserving
+#   timestamps, rather than hard linking.
 # - Added files (i.e. backups of nonexistent files) are represented as
a
 #   specially named file containing an explicit list, and not as
 #   zero-length files. This eases the implementation, and lets us back
@@ -221,9 +220,9 @@ R )
        fi
 
        if [ $opt_touch ] ; then
-               cp -dR --preserve=mode,ownership "$opt_prefix"/. .
+               cp -Rf --preserve=mode,ownership "$opt_prefix"/. .
        else
-               cp -a "$opt_prefix"/. .
+               cp -lRf "$opt_prefix"/. .
        fi
 
        find "$opt_prefix" -type f -size 0c \
@@ -237,8 +236,15 @@ R )
 D )
        rm -rf "$opt_prefix"
        ;;
-'' )
-  # noop
+'' ) # noop
+       if [ $opt_nolink ] ; then
+               if [ -z $all_backup_files ] ; then
+                       echo "Error: breaking individual links is not supported"
+                       exit 1
+               fi
+
+               find "$opt_prefix" . -type f -links +1 | xargs sed -i -s ''
+       fi
        ;;
 * )
        # multiple operations were specified together, like -b and -r.




reply via email to

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