diff options
-rw-r--r-- | quilt.changes | 6 | ||||
-rw-r--r-- | quilt/refresh.in | 26 |
2 files changed, 30 insertions, 2 deletions
diff --git a/quilt.changes b/quilt.changes index 4f92f80..bf13279 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Fri Apr 29 09:25:14 CEST 2005 - agruen@suse.de + +- Add trailing-whitespace check an --strip-trailing-whitespace + option to the refresh command. + +------------------------------------------------------------------- Wed Apr 20 00:02:39 CEST 2005 - agruen@suse.de - fork command help update (Jean Delvare <khali@linux-fr.org>). diff --git a/quilt/refresh.in b/quilt/refresh.in index 679465f..67ac9d9 100644 --- a/quilt/refresh.in +++ b/quilt/refresh.in @@ -19,7 +19,7 @@ fi usage() { - printf $"Usage: quilt refresh [-p n] [-f] [--no-timestamps] [--diffstat] [--sort] [--backup] [patch]\n" + printf $"Usage: quilt refresh [-p n] [-f] [--no-timestamps] [--diffstat] [--sort] [--backup] [--strip-trailing-whitespace] [patch]\n" if [ x$1 = x-h ] then @@ -56,6 +56,9 @@ patch. Create a backup copy of the old version of a patch as patch~. --sort Sort files by their name instead of preserving the original order. + +--strip-trailing-whitespace + Strip trailing whitespace at the end of lines of the generated patch. " exit 0 else @@ -72,7 +75,8 @@ die () exit $status } -options=`getopt -o p:uU:cC:fh --long no-timestamps,diffstat,backup,sort -- "$@"` +options=`getopt -o p:uU:cC:fh --long no-timestamps,diffstat,backup,sort \ + --long strip-trailing-whitespace -- "$@"` if [ $? -ne 0 ] then @@ -111,6 +115,9 @@ do --sort) opt_sort=1 shift ;; + --strip-trailing-whitespace) + opt_strip_whitespace=1 + shift ;; --) shift break ;; @@ -201,6 +208,21 @@ then die 1 fi +# Check for trailing whitespace +if grep -q '^+.*[ '$'\t'']$' $tmp_patch +then + if [ -n "$opt_strip_whitespace" ] + then + tmp=$(gen_tempfile) + sed -e '/^+/s/[ '$'\t'']*$//' $tmp_patch > $tmp + cat $tmp > $tmp_patch + rm -f $tmp + else + printf $"Warning: %s adds trailing whitespace\n" \ + "$(print_patch $patch)" + fi +fi + patch_file=$(patch_file_name $patch) trap "" SIGINT |