Function print_patch currently doesn't print a newline character at
the end of the patch name. Because of this, callers which need the
newline character much wrap print_patch with an echo. This hurts
performance and isn't too elegant either.

So let print_patch print a trailing newline character. If the caller
doesn't need it, it will typically be stripped by bash anyway (tailing
whitespace is stripped on variable expansion.) And if the caller does
need it, it avoids the extra call to echo.
---
 quilt/mail.in             |    2 +-
 quilt/next.in             |    2 +-
 quilt/previous.in         |    2 +-
 quilt/scripts/patchfns.in |    2 +-
 quilt/top.in              |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

--- quilt.orig/quilt/scripts/patchfns.in        2014-03-02 20:32:03.559260796 
+0100
+++ quilt/quilt/scripts/patchfns.in     2014-03-02 21:35:24.373631982 +0100
@@ -950,7 +950,7 @@ version_check()
 
 print_patch()
 {
-       echo -n "${QUILT_PATCHES_PREFIX:+$SUBDIR_DOWN$QUILT_PATCHES/}$1"
+       echo "${QUILT_PATCHES_PREFIX:+$SUBDIR_DOWN$QUILT_PATCHES/}$1"
 }
 
 # Generate a format suitable to print patch names with printf
--- quilt.orig/quilt/mail.in    2014-03-02 20:32:03.559260796 +0100
+++ quilt/quilt/mail.in 2014-03-02 21:39:38.380110407 +0100
@@ -466,7 +466,7 @@ dup_subjects=( $(
                }
                else subjects[$0] = patch }' \
        | while read patch; do
-               echo "$(print_patch "$patch")"
+               print_patch $patch
          done
        ) )
 if [ ${#dup_subjects[@]} -ne 0 ]
--- quilt.orig/quilt/next.in    2014-03-02 20:32:03.559260796 +0100
+++ quilt/quilt/next.in 2014-03-02 21:35:24.374632004 +0100
@@ -61,7 +61,7 @@ next=$(find_unapplied_patch "$1") || exi
 
 if [ -n "$next" ]
 then
-       echo "$(print_patch $next)"
+       print_patch $next
 else
        exit 2
 fi
--- quilt.orig/quilt/previous.in        2014-03-02 20:32:03.559260796 +0100
+++ quilt/quilt/previous.in     2014-03-02 21:35:24.374632004 +0100
@@ -62,7 +62,7 @@ patch=$(find_patch_in_series "$1") || ex
 previous=$(applied_before "$patch" | tail -n 1)
 if [ -n "$previous" ]
 then
-       echo "$(print_patch $previous)"
+       print_patch $previous
 else
        exit 2
 fi
--- quilt.orig/quilt/top.in     2014-03-02 20:32:03.559260796 +0100
+++ quilt/quilt/top.in  2014-03-02 21:35:24.374632004 +0100
@@ -58,7 +58,7 @@ then
 fi
 
 top=$(find_top_patch) || exit 2
-echo "$(print_patch "$top")"
+print_patch $top
 
 ### Local Variables:
 ### mode: shell-script

-- 
Jean Delvare
SUSE L3 Support


_______________________________________________
Quilt-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/quilt-dev

Reply via email to