Skip to contentSkip to conversation

submodule summary: support --summary-limit=<n>

PATCH New René Scharfe 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 submodule summary: support --summary-limit=<n>

In addition to "--summary-limit <n>" support the form "--summary-limit=<n>", for consistency with other parameters and commands.

---
 git-submodule.sh | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
git-submodule.sh +11 -6
index 204bc78..275c664 100755
@@ -267,6 +267,11 @@ module_clone()
 	(clear_local_git_env; cd "$sm_path" && GIT_WORK_TREE=. git config core.worktree "$rel/$b")
 }
 
+isnumber()
+{
+	n=$(($1 + 0)) 2>/dev/null && test "$n" = "$1"
+}
+
 #
 # Add a new submodule to the working tree, .gitmodules and the index
 #
@@ -889,14 +894,14 @@ cmd_summary() {
 			for_status="$1"
 			;;
 		-n|--summary-limit)
-			if summary_limit=$(($2 + 0)) 2>/dev/null && test "$summary_limit" = "$2"
-			then
-				:
-			else
-				usage
-			fi
+			summary_limit="$2"
+			isnumber "$summary_limit" || usage
 			shift
 			;;
+		--summary-limit=*)
+			summary_limit="${1#--summary-limit=}"
+			isnumber "$summary_limit" || usage
+			;;
 		--)
 			shift
 			break
Signature · 1 line
1.8.2