# [PATCH] submodule: add verbose mode for add/update

2 messages from 2014-03-12 to 2014-03-12. Participants: Orgad Shaneh, Eric Sunshine.
Thread: https://gitlist.dev/t/36133

## Orgad Shaneh, 2014-03-12 06:38

Subject: [PATCH] submodule: add verbose mode for add/update
Message-ID: <CAGHpTBJ29oyuNojiAtsd73wau4Xsz2zuxxg04mFG0TdekeSRxA@mail.gmail.com>
URL: https://gitlist.dev/e/CAGHpTBJ29oyuNojiAtsd73wau4Xsz2zuxxg04mFG0TdekeSRxA%40mail.gmail.com

```
Executes checkout without -q
---
 git-submodule.sh | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index a33f68d..5c4e057 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -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>...]"
@@ -319,12 +319,16 @@ module_clone()
  rel=$(echo $a | sed -e 's|[^/][^/]*|..|g')
  (
  clear_local_git_env
+ if test -z "$verbose"
+ then
+ subquiet=-q
+ fi
  cd "$sm_path" &&
  GIT_WORK_TREE=. git config core.worktree "$rel/$b" &&
  # ash fails to wordsplit ${local_branch:+-B "$local_branch"...}
  case "$local_branch" in
- '') git checkout -f -q ${start_point:+"$start_point"} ;;
- ?*) git checkout -f -q -B "$local_branch" ${start_point:+"$start_point"} ;;
+ '') git checkout -f $subquiet ${start_point:+"$start_point"} ;;
+ ?*) git checkout -f $subquiet -B "$local_branch"
${start_point:+"$start_point"} ;;
  esac
  ) || die "$(eval_gettext "Unable to setup cloned submodule '\$sm_path'")"
 }
@@ -380,6 +384,9 @@ cmd_add()
  --depth=*)
  depth=$1
  ;;
+ -v|--verbose)
+ verbose=1
+ ;;
  --)
  shift
  break
@@ -786,6 +793,9 @@ cmd_update()
  --depth=*)
  depth=$1
  ;;
+ -v|--verbose)
+ verbose=1
+ ;;
  --)
  shift
  break
@@ -913,7 +923,11 @@ Maybe you want to use 'update --init'?")"
  must_die_on_failure=
  case "$update_module" in
  checkout)
- 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 '\$displaypath'")"
  say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out
'\$sha1'")"
  ;;
-- 
1.9.0.msysgit.0

```

## Eric Sunshine, 2014-03-12 08:35

Subject: Re: [PATCH] submodule: add verbose mode for add/update
Message-ID: <5FD334C9-9AD9-40AE-ADFB-B96B8E2D8F66@sunshineco.com>
URL: https://gitlist.dev/e/5FD334C9-9AD9-40AE-ADFB-B96B8E2D8F66%40sunshineco.com
In-Reply-To: <CAGHpTBJ29oyuNojiAtsd73wau4Xsz2zuxxg04mFG0TdekeSRxA@mail.gmail.com>

```
On Mar 12, 2014, at 2:38 AM, Orgad Shaneh <orgads@gmail.com> wrote:
> Executes checkout without -q
> —

Missing sign-off. See Documentation/SubmittingPatches.

Your patch is badly whitespace-damaged, as if it was pasted into your email client. “git send-email” can avoid this problem.

As I’m not a submodule user, I won’t review the content of the patch other than to say that such a change should be accompanied by documentation update (Documentation/git-submodule.txt) and additional tests.

> git-submodule.sh | 24 +++++++++++++++++++-----
> 1 file changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/git-submodule.sh b/git-submodule.sh
> index a33f68d..5c4e057 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -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>...]"
> @@ -319,12 +319,16 @@ module_clone()
> rel=$(echo $a | sed -e 's|[^/][^/]*|..|g')
> (
> clear_local_git_env
> + if test -z "$verbose"
> + then
> + subquiet=-q
> + fi
> cd "$sm_path" &&
> GIT_WORK_TREE=. git config core.worktree "$rel/$b" &&
> # ash fails to wordsplit ${local_branch:+-B "$local_branch"...}
> case "$local_branch" in
> - '') git checkout -f -q ${start_point:+"$start_point"} ;;
> - ?*) git checkout -f -q -B "$local_branch" ${start_point:+"$start_point"} ;;
> + '') git checkout -f $subquiet ${start_point:+"$start_point"} ;;
> + ?*) git checkout -f $subquiet -B "$local_branch"
> ${start_point:+"$start_point"} ;;
> esac
> ) || die "$(eval_gettext "Unable to setup cloned submodule '\$sm_path'")"
> }
> @@ -380,6 +384,9 @@ cmd_add()
> --depth=*)
> depth=$1
> ;;
> + -v|--verbose)
> + verbose=1
> + ;;
> --)
> shift
> break
> @@ -786,6 +793,9 @@ cmd_update()
> --depth=*)
> depth=$1
> ;;
> + -v|--verbose)
> + verbose=1
> + ;;
> --)
> shift
> break
> @@ -913,7 +923,11 @@ Maybe you want to use 'update --init'?")"
> must_die_on_failure=
> case "$update_module" in
> checkout)
> - 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 '\$displaypath'")"
> say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out
> '\$sha1'")"
> ;;
> -- 
> 1.9.0.msysgit.0

```
