summaryrefslogtreecommitdiffstats
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorRoy Eldar <royeldar0@gmail.com>2024-12-11 07:32:30 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-11 12:46:47 +0100
commit006f546bc30bd42de6ba569ab70ec80441f54430 (patch)
treeb1fbe9a95349dec4f14f42bc95b7de613e74a40b /git-submodule.sh
parentgit-submodule.sh: improve parsing of short options (diff)
downloadgit-006f546bc30bd42de6ba569ab70ec80441f54430.tar.xz
git-006f546bc30bd42de6ba569ab70ec80441f54430.zip
git-submodule.sh: get rid of isnumber
It's entirely unnecessary to check whether the argument given to an option (i.e. --summary-limit) is valid in the shell wrapper, since it's already done when parsing the various options in git-submodule--helper. Remove this check from the script; this both improves consistency throughout the script, and the error message shown to the user in case some invalid non-numeric argument was passed to "--summary-limit" is more informative as well. Signed-off-by: Roy Eldar <royeldar0@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh11
1 files changed, 2 insertions, 9 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index fd54cb8fa6..3adaa8d9a3 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -53,11 +53,6 @@ jobs=
recommend_shallow=
filter=
-isnumber()
-{
- n=$(($1 + 0)) 2>/dev/null && test "$n" = "$1"
-}
-
#
# Add a new submodule to the working tree, .gitmodules and the index
#
@@ -524,17 +519,15 @@ cmd_summary() {
for_status="$1"
;;
-n|--summary-limit)
+ case "$2" in '') usage ;; esac
summary_limit="$2"
- isnumber "$summary_limit" || usage
shift
;;
-n*)
summary_limit="${1#-n}"
- isnumber "$summary_limit" || usage
;;
--summary-limit=*)
summary_limit="${1#--summary-limit=}"
- isnumber "$summary_limit" || usage
;;
--)
shift
@@ -554,7 +547,7 @@ cmd_summary() {
${files:+--files} \
${cached:+--cached} \
${for_status:+--for-status} \
- ${summary_limit:+-n $summary_limit} \
+ ${summary_limit:+-n "$summary_limit"} \
-- \
"$@"
}