From 9d3369d7a659915bc2f4a91866f1df129db33378 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 11 Jul 2014 00:31:33 +0200 Subject: [PATCH] gitapply.sh: Make sure that all error output is redirected to stderr, sort commandline options. --- debian/tools/gitapply.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/debian/tools/gitapply.sh b/debian/tools/gitapply.sh index e89620e3..c822cc50 100755 --- a/debian/tools/gitapply.sh +++ b/debian/tools/gitapply.sh @@ -31,7 +31,7 @@ warning() usage() { echo "" - echo "Usage: ./gitapply [-v] [-d DIRECTORY]" + echo "Usage: ./gitapply [--nogit] [-v] [-d DIRECTORY]" echo "" echo "Reads patch data from stdin and applies the patch to the current" echo "directory or the directory given via commandline." @@ -46,6 +46,14 @@ while [[ $# > 0 ]]; do cmd="$1"; shift case "$cmd" in + --nogit) + nogit=1 + ;; + + -v) + verbose=1 + ;; + --directory=*) cd "${cmd#*=}" ;; @@ -57,14 +65,6 @@ while [[ $# > 0 ]]; do abort "Reverse applying patches not supported yet with this patch tool." ;; - -v) - verbose=1 - ;; - - --nogit) - nogit=1 - ;; - --help) usage exit 0 @@ -333,8 +333,8 @@ while IFS= read -r line; do sha="0000000000000000000000000000000000000000" fi if [ "$patch_oldsha1" != "$sha" ]; then - echo "$lineno: Expected $patch_oldsha1" - echo "$lineno: Got $sha" + echo "$lineno: Expected $patch_oldsha1" >&2 + echo "$lineno: Got $sha" >&2 abort "Unable to continue because of sha1 mismatch of original file." fi fi @@ -434,8 +434,8 @@ while IFS= read -r line; do # Check shasum if its not a patch creating a new file sha=$(echo -en "blob $(du -b "$patch_tmpfile" | cut -f1)\x00" | cat - "$patch_tmpfile" | sha1sum | cut -d' ' -f1) if [ "$patch_newsha1" != "$sha" ]; then - echo "$lineno: Expected $patch_newsha1" - echo "$lineno: Got $sha" + echo "$lineno: Expected $patch_newsha1" >&2 + echo "$lineno: Got $sha" >&2 abort "Unable to continue because of sha1 mismatch after applying the patch." fi