[CentOS-devel] [PATCH] Minor logic error due to getopt restructure, $? != $# and not helpful anymore

Tue Jun 17 16:49:43 UTC 2014
Pat Riehecky <riehecky at fnal.gov>

From: Pat Riehecky <riehecky at fnal.gov>

---
 show_possible_srpms.sh |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/show_possible_srpms.sh b/show_possible_srpms.sh
index f8c5eac..3092172 100755
--- a/show_possible_srpms.sh
+++ b/show_possible_srpms.sh
@@ -19,6 +19,7 @@ usage() {
     echo ' -b: specify a branch to examine'               >&2
     echo "     defaults to repo's current branch"         >&2
     echo ''                                               >&2
+    echo "  $0"                                           >&2
     echo "  $0 -b c7"                                     >&2
     echo "  $0 -r -b c7"                                  >&2
     echo "  $0 -c -b remotes/origin/c7"                   >&2
@@ -43,14 +44,6 @@ filter () {
 }
 
 #####################################################################
-if [[ $? -ne 0 ]]; then
-    usage
-fi
-
-if [[ ! -d .git ]] || [[ ! -d SPECS ]]; then
-    echo 'You need to run this from inside a sources git repo'
-    exit 1
-fi
 
 RHELTAG=0
 QUIET=0
@@ -100,6 +93,11 @@ while [[ 0 -eq 0 ]]; do
     esac
 done
 
+if [[ ! -d .git ]] || [[ ! -d SPECS ]]; then
+    echo 'You need to run this from inside a sources git repo'
+    exit 1
+fi
+
 # commit message contains white space, set IFS to \n
 IFS='
 '
-- 
1.7.1