Skip to content

Commit e3b1173

Browse files
committed
Merge branch 'rs/submodule-summary-limit'
"submodule summary --summary-limit" option did not support "--option=value" form. * rs/submodule-summary-limit: submodule summary: support --summary-limit=<n>
2 parents d3ea582 + 862ae6c commit e3b1173

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

git-submodule.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,11 @@ module_clone()
267267
(clear_local_git_env; cd "$sm_path" && GIT_WORK_TREE=. git config core.worktree "$rel/$b")
268268
}
269269

270+
isnumber()
271+
{
272+
n=$(($1 + 0)) 2>/dev/null && test "$n" = "$1"
273+
}
274+
270275
#
271276
# Add a new submodule to the working tree, .gitmodules and the index
272277
#
@@ -889,14 +894,14 @@ cmd_summary() {
889894
for_status="$1"
890895
;;
891896
-n|--summary-limit)
892-
if summary_limit=$(($2 + 0)) 2>/dev/null && test "$summary_limit" = "$2"
893-
then
894-
:
895-
else
896-
usage
897-
fi
897+
summary_limit="$2"
898+
isnumber "$summary_limit" || usage
898899
shift
899900
;;
901+
--summary-limit=*)
902+
summary_limit="${1#--summary-limit=}"
903+
isnumber "$summary_limit" || usage
904+
;;
900905
--)
901906
shift
902907
break

0 commit comments

Comments
 (0)