Skip to contentSkip to conversation

submodule: add verbose mode for add/update

PATCH In review Orgad Shaneh 2 participants 3 messages Jun 15, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 submodule: add verbose mode for add/update

Executes checkout without -q

---
 git-submodule.sh |   24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
git-submodule.sh +19 -5
index 79bfaac..f7964ad 100755
@@ -5,11 +5,11 @@
 # Copyright (c) 2007 Lars Hjemli
 
 dashless=$(basename "$0" | sed -e 's/-/ /')
-USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
+USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [-v|--verbose] [--] <repository> [<path>]
    or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
    or: $dashless [--quiet] init [--] [<path>...]
    or: $dashless [--quiet] deinit [-f|--force] [--] <path>...
-   or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
+   or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [-v|--verbose] [--] [<path>...]
    or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
    or: $dashless [--quiet] foreach [--recursive] <command>
    or: $dashless [--quiet] sync [--recursive] [--] [<path>...]"
@@ -309,6 +309,9 @@ cmd_add()
 			custom_name=$2
 			shift
 			;;
+		-v|--verbose)
+			VERBOSE=1
+			;;
 		--)
 			shift
 			break
@@ -408,11 +411,15 @@ Use -f if you really want to add it." >&2
 		module_clone "$sm_path" "$sm_name" "$realrepo" "$reference" || exit
 		(
 			clear_local_git_env
+			if test -z "$VERBOSE"
+			then
+				subquiet=-q
+			fi
 			cd "$sm_path" &&
 			# ash fails to wordsplit ${branch:+-b "$branch"...}
 			case "$branch" in
-			'') git checkout -f -q ;;
-			?*) git checkout -f -q -B "$branch" "origin/$branch" ;;
+			'') git checkout -f $subquiet ;;
+			?*) git checkout -f $subquiet -B "$branch" "origin/$branch" ;;
 			esac
 		) || die "$(eval_gettext "Unable to checkout submodule '\$sm_path'")"
 	fi
@@ -676,6 +683,9 @@ cmd_update()
 		--checkout)
 			update="checkout"
 			;;
+		-v|--verbose)
+			VERBOSE=1
+			;;
 		--)
 			shift
 			break
@@ -799,7 +809,11 @@ Maybe you want to use 'update --init'?")"
 				must_die_on_failure=yes
 				;;
 			*)
-				command="git checkout $subforce -q"
+				if test -z "$VERBOSE"
+				then
+					subquiet=-q
+				fi
+				command="git checkout $subforce $subquiet"
 				die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$prefix\$sm_path'")"
 				say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': checked out '\$sha1'")"
 				;;
Signature · 1 line
1.7.10.4
#1 lore raw

Am 10.04.2013 20:24, schrieb Orgad Shaneh:

Quoted 1 line

Executes checkout without -q

Nice, looks like you picked the proposal I made last September:
http://permalink.gmane.org/gmane.comp.version-control.git/204747

The change is looking good, but you still need to document the new option in Documentation/git-submodule.txt too please.

And the commit message is still too short, as I said in that other thread:

Quoted 2 lines · Jens Lehmann

Before the "Signed-off-by" is the place where you should have explained why this would be a worthwhile change ;-)

And you answered to that with something that would really make sense as first part of the commit message, because you explain *why* you do that change:

Am 05.09.2012 13:42, schrieb Orgad and Raizel Shaneh:

Quoted 3 lines

When I run 'git submodule update' I don't expect to be in the dark until the submodule/s finishes checkout, this sometimes can take a significant amount of time and feedback is expected.

Another paragraph after that should explain *how* you do it.

So what about the following as commit message:
--------------------------------------------------------------
When 'git submodule add/update' is run there is no output during checkout. This can take a significant amount of time and it would be nice if user could enable some feedback to see what's going on.

Add the -v/--verbose option to both add and update which suppresses the -q normally given to checkout so the user sees progress output from the checkout command.

<Your Signed-off-by goes here>
--------------------------------------------------------------

I'm looking forward to your next iteration.

Quoted 74 lines
---
 git-submodule.sh |   24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)
git-submodule.sh +19 -5
index 79bfaac..f7964ad 100755
@@ -5,11 +5,11 @@
 # Copyright (c) 2007 Lars Hjemli
 
 dashless=$(basename "$0" | sed -e 's/-/ /')
-USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
+USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [-v|--verbose] [--] <repository> [<path>]
    or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
    or: $dashless [--quiet] init [--] [<path>...]
    or: $dashless [--quiet] deinit [-f|--force] [--] <path>...
-   or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
+   or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [-v|--verbose] [--] [<path>...]
    or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
    or: $dashless [--quiet] foreach [--recursive] <command>
    or: $dashless [--quiet] sync [--recursive] [--] [<path>...]"
@@ -309,6 +309,9 @@ cmd_add()
 			custom_name=$2
 			shift
 			;;
+		-v|--verbose)
+			VERBOSE=1
+			;;
 		--)
 			shift
 			break
@@ -408,11 +411,15 @@ Use -f if you really want to add it." >&2
 		module_clone "$sm_path" "$sm_name" "$realrepo" "$reference" || exit
 		(
 			clear_local_git_env
+			if test -z "$VERBOSE"
+			then
+				subquiet=-q
+			fi
 			cd "$sm_path" &&
 			# ash fails to wordsplit ${branch:+-b "$branch"...}
 			case "$branch" in
-			'') git checkout -f -q ;;
-			?*) git checkout -f -q -B "$branch" "origin/$branch" ;;
+			'') git checkout -f $subquiet ;;
+			?*) git checkout -f $subquiet -B "$branch" "origin/$branch" ;;
 			esac
 		) || die "$(eval_gettext "Unable to checkout submodule '\$sm_path'")"
 	fi
@@ -676,6 +683,9 @@ cmd_update()
 		--checkout)
 			update="checkout"
 			;;
+		-v|--verbose)
+			VERBOSE=1
+			;;
 		--)
 			shift
 			break
@@ -799,7 +809,11 @@ Maybe you want to use 'update --init'?")"
 				must_die_on_failure=yes
 				;;
 			*)
-				command="git checkout $subforce -q"
+				if test -z "$VERBOSE"
+				then
+					subquiet=-q
+				fi
+				command="git checkout $subforce $subquiet"
 				die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$prefix\$sm_path'")"
 				say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': checked out '\$sha1'")"
 				;;

A message that is not in the archive (sent off-list or not yet received): CAGHpTBK6qGUcj=ioWCN2Y5bkhNg8t0ik0BNfXNLww0zjm+1xGQ@mail.gmail.com

#3 lore raw

PATCH 1/1 submodule: add verbose mode for add/update

Quoted 6 lines · Jens Lehmann

Am 10.04.2013 20:24, schrieb Orgad Shaneh:

Quoted 1 line

Executes checkout without -q

Nice, looks like you picked the proposal I made last September:
http://permalink.gmane.org/gmane.comp.version-control.git/204747

Took me a while, but I finally got to it :)

Quoted 27 lines

The change is looking good, but you still need to document the new option in Documentation/git-submodule.txt too please.

And the commit message is still too short, as I said in that other thread:

Quoted 2 lines · Jens Lehmann

Before the "Signed-off-by" is the place where you should have explained why this would be a worthwhile change ;-)

And you answered to that with something that would really make sense as first part of the commit message, because you explain *why* you do that change:

Am 05.09.2012 13:42, schrieb Orgad and Raizel Shaneh:

Quoted 3 lines

When I run 'git submodule update' I don't expect to be in the dark until the submodule/s finishes checkout, this sometimes can take a significant amount of time and feedback is expected.

Another paragraph after that should explain *how* you do it.

So what about the following as commit message:
--------------------------------------------------------------
When 'git submodule add/update' is run there is no output during checkout. This can take a significant amount of time and it would be nice if user could enable some feedback to see what's going on.

Quoted 8 lines

Add the -v/--verbose option to both add and update which suppresses the -q normally given to checkout so the user sees progress output from the checkout command.

<Your Signed-off-by goes here>
--------------------------------------------------------------

I'm looking forward to your next iteration.

Done quicker this time ;-)

Thanks a lot for your review (previous and current). It was very helpful!

- Orgad