quilt-dev
[Top][All Lists]
Advanced

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

[Quilt-dev] [PATCH 09/39] backup-files: Inline copy_file and link_or_cop


From: Jean Delvare
Subject: [Quilt-dev] [PATCH 09/39] backup-files: Inline copy_file and link_or_copy_file
Date: Sat, 19 Mar 2011 10:52:39 +0100
User-agent: quilt/0.48-17.1

Expand functions copy_file and link_or_copy_file at calling
locations, the code is so simple that it hardly deserves dedicated
functions.

Signed-off-by: Jean Delvare <address@hidden>
Reviewed-by: Raphael Hertzog <address@hidden>
---
 quilt/scripts/backup-files.in |   22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

--- a/quilt/scripts/backup-files.in
+++ b/quilt/scripts/backup-files.in
@@ -45,20 +45,6 @@ usage () {
 "
 }
 
-copy_file() {
-       local from="$1"
-       local to="$2"
-       cp -p "$from" "$to"
-}
-
-link_or_copy_file() {
-       local from="$1"
-       local to="$2"
-       if ! ln "$from" "$to" 2>/dev/null ; then
-               copy_file "$from" "$to"
-       fi
-}
-
 ensure_nolinks() {
        local filename="$1"
        local link_count dirname basename tmpname
@@ -90,9 +76,9 @@ process_file() {
                else
                        $ECHO "Copying $file"
                        if [ -n "$OPT_NOLINKS" -a "$(stat @STAT_HARDLINK@ 
"$file")" = "1" ]; then
-                               copy_file "$file" "$backup"
+                               cp -p "$file" "$backup"
                        else
-                               link_or_copy_file "$file" "$backup"
+                               ln "$file" "$backup" 2> /dev/null || cp -p 
"$file" "$backup"
                                if [ -n "$OPT_NOLINKS" ]; then
                                        ensure_nolinks "$file"
                                fi
@@ -122,9 +108,9 @@ process_file() {
                                rm "$file"
                        fi
                        if [ -n "$OPT_NOLINKS" -a "$(stat @STAT_HARDLINK@ 
"$backup")" != "1" ]; then
-                               copy_file "$backup" "$file"
+                               cp -p "$backup" "$file"
                        else
-                               link_or_copy_file "$backup" "$file"
+                               ln "$backup" "$file" 2> /dev/null || cp -p 
"$backup" "$file"
                                if [ -n "$OPT_NOLINKS" ]; then
                                        ensure_nolinks "$file"
                                fi




reply via email to

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