Skip to content

Commit 006f546

Browse files
Roy Eldargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e6c3e34 commit 006f546

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

git-submodule.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ jobs=
5353
recommend_shallow=
5454
filter=
5555

56-
isnumber()
57-
{
58-
n=$(($1 + 0)) 2>/dev/null && test "$n" = "$1"
59-
}
60-
6156
#
6257
# Add a new submodule to the working tree, .gitmodules and the index
6358
#
@@ -524,17 +519,15 @@ cmd_summary() {
524519
for_status="$1"
525520
;;
526521
-n|--summary-limit)
522+
case "$2" in '') usage ;; esac
527523
summary_limit="$2"
528-
isnumber "$summary_limit" || usage
529524
shift
530525
;;
531526
-n*)
532527
summary_limit="${1#-n}"
533-
isnumber "$summary_limit" || usage
534528
;;
535529
--summary-limit=*)
536530
summary_limit="${1#--summary-limit=}"
537-
isnumber "$summary_limit" || usage
538531
;;
539532
--)
540533
shift
@@ -554,7 +547,7 @@ cmd_summary() {
554547
${files:+--files} \
555548
${cached:+--cached} \
556549
${for_status:+--for-status} \
557-
${summary_limit:+-n $summary_limit} \
550+
${summary_limit:+-n "$summary_limit"} \
558551
-- \
559552
"$@"
560553
}

0 commit comments

Comments
 (0)