summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2012-02-01 18:08:49 +0100
committerJean Delvare <jdelvare@suse.de>2012-02-01 18:08:49 +0100
commitee874a824c7aa7659f8f046f55b5c6c8ffb7065f (patch)
treeee77d458b49b923501cd7a480ec057104a65478f
parentd285258acd43a77d2b21b72834a1cc7a4ae63672 (diff)
downloadquilt-ee874a824c7aa7659f8f046f55b5c6c8ffb7065f.tar.gz
backup-files: Separate lists for empty and non-empty files
Create two separate lists for empty and non-empty files. This will allow dedicated handling of each set of files. Signed-off-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Raphael Hertzog <hertzog@debian.org>
-rw-r--r--quilt/scripts/backup-files.in36
1 files changed, 22 insertions, 14 deletions
diff --git a/quilt/scripts/backup-files.in b/quilt/scripts/backup-files.in
index 57686fe..72a4ad3 100644
--- a/quilt/scripts/backup-files.in
+++ b/quilt/scripts/backup-files.in
@@ -142,7 +142,7 @@ restore()
restore_all()
{
- local FILELIST
+ local EMPTY_FILES NONEMPTY_FILES
(cd "$OPT_PREFIX" && find . -type d -print0) \
| xargs -0 mkdir -p
@@ -151,27 +151,35 @@ restore_all()
fi
# Store the list of files to process
- FILELIST=$(gen_tempfile)
- trap "rm -f \"$FILELIST\"" EXIT
+ EMPTY_FILES=$(gen_tempfile)
+ NONEMPTY_FILES=$(gen_tempfile)
+ trap "rm -f \"$EMPTY_FILES\" \"$NONEMPTY_FILES\"" EXIT
cd "$OPT_PREFIX"
- find . -type f -print0 > "$FILELIST"
+ find . -type f -size 0 -print0 > "$EMPTY_FILES"
+ find . -type f -size +0 -print0 > "$NONEMPTY_FILES"
cd "$OLDPWD"
- if [ ! -s "$FILELIST" ]; then
- rm -f "$FILELIST"
- exit
+ if [ -s "$EMPTY_FILES" ]; then
+ xargs -0 rm -f < "$EMPTY_FILES"
+
+ while read -d $'\0' -r
+ do
+ restore_fast "${REPLY#./}"
+ done < "$EMPTY_FILES"
fi
- xargs -0 rm -f < "$FILELIST"
+ if [ -s "$NONEMPTY_FILES" ]; then
+ xargs -0 rm -f < "$NONEMPTY_FILES"
- while read -d $'\0' -r
- do
- restore_fast "${REPLY#./}"
- done < "$FILELIST"
+ while read -d $'\0' -r
+ do
+ restore_fast "${REPLY#./}"
+ done < "$NONEMPTY_FILES"
- if [ -n "$OPT_TOUCH" ]; then
- xargs -0 touch -c < "$FILELIST"
+ if [ -n "$OPT_TOUCH" ]; then
+ xargs -0 touch -c < "$NONEMPTY_FILES"
+ fi
fi
if [ -z "$OPT_KEEP_BACKUP" ]; then