[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] [PATCH 14/39] backup-files: Mass reindent
From: |
Jean Delvare |
Subject: |
[Quilt-dev] [PATCH 14/39] backup-files: Mass reindent |
Date: |
Sat, 19 Mar 2011 10:52:44 +0100 |
User-agent: |
quilt/0.48-17.1 |
Fix the code indentation. I made this a separate commit so that the
previous change is easier to review.
Signed-off-by: Jean Delvare <address@hidden>
---
quilt/scripts/backup-files.in | 111 +++++++++++++++++++++---------------------
1 file changed, 56 insertions(+), 55 deletions(-)
--- a/quilt/scripts/backup-files.in
+++ b/quilt/scripts/backup-files.in
@@ -61,28 +61,29 @@ backup() {
local file="$1"
local backup="${OPT_PREFIX}${file}"
- if [ -e "$backup" ]; then
- rm "$backup"
+ if [ -e "$backup" ]; then
+ rm "$backup"
+ else
+ mkdir -p "$(dirname "$backup")"
+ fi
+
+ if [ ! -e "$file" ]; then
+ $ECHO "New file $file"
+ touch "$backup"
+ else
+ $ECHO "Copying $file"
+ if [ -n "$OPT_NOLINKS" -a "$(stat @STAT_HARDLINK@ "$file")" =
"1" ]; then
+ cp -p "$file" "$backup"
else
- mkdir -p "$(dirname "$backup")"
+ ln "$file" "$backup" 2> /dev/null || cp -p "$file"
"$backup"
+ if [ -n "$OPT_NOLINKS" ]; then
+ ensure_nolinks "$file"
+ fi
fi
- if [ ! -e "$file" ]; then
- $ECHO "New file $file"
+ if [ -n "$OPT_TOUCH" ]; then
touch "$backup"
- else
- $ECHO "Copying $file"
- if [ -n "$OPT_NOLINKS" -a "$(stat @STAT_HARDLINK@
"$file")" = "1" ]; then
- cp -p "$file" "$backup"
- else
- ln "$file" "$backup" 2> /dev/null || cp -p
"$file" "$backup"
- if [ -n "$OPT_NOLINKS" ]; then
- ensure_nolinks "$file"
- fi
- fi
- if [ -n "$OPT_TOUCH" ]; then
- touch "$backup"
- fi
fi
+ fi
}
restore()
@@ -90,42 +91,42 @@ restore()
local file="$1"
local backup="${OPT_PREFIX}${file}"
- mkdir -p "$(dirname "$file")"
+ mkdir -p "$(dirname "$file")"
- if [ ! -e "$backup" ]; then
- return 1
+ if [ ! -e "$backup" ]; then
+ return 1
+ fi
+ if [ ! -s "$backup" ]; then
+ $ECHO "Removing $file"
+ if [ -e "$file" ]; then
+ rm "$file"
fi
- if [ ! -s "$backup" ]; then
- if [ -e "$file" ]; then
- rm "$file"
- fi
- $ECHO "Removing $file"
- if [ -z "$OPT_KEEP_BACKUP" ]; then
- rm "$backup"
- rmdir -p "${backup%/*}" 2> /dev/null || true
- fi
+ if [ -z "$OPT_KEEP_BACKUP" ]; then
+ rm "$backup"
+ rmdir -p "${backup%/*}" 2> /dev/null || true
+ fi
+ else
+ $ECHO "Restoring $file"
+ if [ -e "$file" ]; then
+ rm "$file"
+ fi
+ if [ -n "$OPT_NOLINKS" -a "$(stat @STAT_HARDLINK@ "$backup")"
!= "1" ]; then
+ cp -p "$backup" "$file"
else
- $ECHO "Restoring $file"
- if [ -e "$file" ]; then
- rm "$file"
- fi
- if [ -n "$OPT_NOLINKS" -a "$(stat @STAT_HARDLINK@
"$backup")" != "1" ]; then
- cp -p "$backup" "$file"
- else
- ln "$backup" "$file" 2> /dev/null || cp -p
"$backup" "$file"
- if [ -n "$OPT_NOLINKS" ]; then
- ensure_nolinks "$file"
- fi
+ ln "$backup" "$file" 2> /dev/null || cp -p "$backup"
"$file"
+ if [ -n "$OPT_NOLINKS" ]; then
+ ensure_nolinks "$file"
fi
+ fi
- if [ -z "$OPT_KEEP_BACKUP" ]; then
- rm "$backup"
- rmdir -p "${backup%/*}" 2> /dev/null || true
- fi
- if [ -n "$OPT_TOUCH" ]; then
- touch "$file"
- fi
+ if [ -z "$OPT_KEEP_BACKUP" ]; then
+ rm "$backup"
+ rmdir -p "${backup%/*}" 2> /dev/null || true
fi
+ if [ -n "$OPT_TOUCH" ]; then
+ touch "$file"
+ fi
+ fi
}
remove()
@@ -133,19 +134,19 @@ remove()
local file="$1"
local backup="${OPT_PREFIX}${file}"
- if [ -e "$backup" ]; then
- rm "$backup"
- fi
- rmdir -p "${backup%/*}" 2> /dev/null || true
+ if [ -e "$backup" ]; then
+ rm "$backup"
+ fi
+ rmdir -p "${backup%/*}" 2> /dev/null || true
}
noop()
{
local file="$1"
- if [ -e "$file" ] && [ -n "$OPT_NOLINKS" ]; then
- ensure_nolinks "$file"
- fi
+ if [ -e "$file" ] && [ -n "$OPT_NOLINKS" ]; then
+ ensure_nolinks "$file"
+ fi
}
- [Quilt-dev] [PATCH 00/39] Reimplement backup-files in bash, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 03/39] BSD compatibility: cp, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 02/39] BSD compatibility: stat, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 21/39] backup-files: Drop curly braces, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 07/39] backup-files: Skip test for file presence, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 18/39] backup-files: Make input methods mutually exclusive, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 25/39] backup-files: Separate function restore_all, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 26/39] backup-files: Quick exit when unlinking is not needed, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 13/39] backup-files: Split code to sparate functions, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 24/39] backup-files: Avoid negations, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 14/39] backup-files: Mass reindent,
Jean Delvare <=
- [Quilt-dev] [PATCH 01/39] Make backup-files a shell script, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 22/39] backup-files: Check if backup exists, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 12/39] backup-files: Simplify find loop, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 15/39] backup-files: Optimize restore, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 23/39] backup-files: Optimize noop, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 27/39] backup-files: Remember the list of files, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 17/39] backup-files: Drop variable filelist, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 09/39] backup-files: Inline copy_file and link_or_copy_file, Jean Delvare, 2011/03/19
- [Quilt-dev] [PATCH 19/39] backup-files: Use internal implementation of dirname, Jean Delvare, 2011/03/19