{"thread":{"id":"33465","subject":"[PATCH] submodule: add verbose mode for add/update","startedAt":"2013-04-10T20:10:10Z","lastAt":"2013-04-10T20:10:10Z","messageCount":1,"participants":["Orgad Shaneh"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"213828","messageId":"1365624610-11163-1-git-send-email-orgads@gmail.com","threadId":"33465","inReplyTo":null,"subject":"[PATCH] submodule: add verbose mode for add/update","fromName":"Orgad Shaneh","fromEmail":"orgads@gmail.com","sentAt":"2013-04-10T20:10:10Z","receivedAt":"2013-04-10T20:10:10Z","isPatch":true,"sender":{"key":"orgads@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1246544?v=4"},"body":"When 'git submodule add/update' is run there is no output during\ncheckout. This can take a significant amount of time and it would\nbe nice if user could enable some feedback to see what's going on.\n\nAdd the -v/--verbose option to both add and update which suppresses\nthe -q normally given to checkout so the user sees progress output\nfrom the checkout command.\n\nSigned-off-by: Orgad Shaneh <orgads@gmail.com>\n---\n Documentation/git-submodule.txt |   10 ++++++++--\n git-submodule.sh                |   24 +++++++++++++++++++-----\n 2 files changed, 27 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt\nindex 74d5bdc..6abfd5d 100644\n--- a/Documentation/git-submodule.txt\n+++ b/Documentation/git-submodule.txt\n@@ -10,13 +10,13 @@ SYNOPSIS\n --------\n [verse]\n 'git submodule' [--quiet] add [-b <branch>] [-f|--force] [--name <name>]\n-\t      [--reference <repository>] [--] <repository> [<path>]\n+\t      [--reference <repository>] [-v|--verbose] [--] <repository> [<path>]\n 'git submodule' [--quiet] status [--cached] [--recursive] [--] [<path>...]\n 'git submodule' [--quiet] init [--] [<path>...]\n 'git submodule' [--quiet] deinit [-f|--force] [--] <path>...\n 'git submodule' [--quiet] update [--init] [--remote] [-N|--no-fetch]\n \t      [-f|--force] [--rebase] [--reference <repository>]\n-\t      [--merge] [--recursive] [--] [<path>...]\n+\t      [--merge] [--recursive] [-v|--verbose] [--] [<path>...]\n 'git submodule' [--quiet] summary [--cached|--files] [(-n|--summary-limit) <n>]\n \t      [commit] [--] [<path>...]\n 'git submodule' [--quiet] foreach [--recursive] <command>\n@@ -324,6 +324,12 @@ for linkgit:git-clone[1]'s `--reference` and `--shared` options carefully.\n \tonly in the submodules of the current repo, but also\n \tin any nested submodules inside those submodules (and so on).\n \n+-v::\n+--verbose::\n+\tThis option makes the checkout operation more verbose.\n+\tBy default, a quiet checkout is performed. Specifying --verbose\n+\tprovides progress information to the user.\n+\n <path>...::\n \tPaths to submodule(s). When specified this will restrict the command\n \tto only operate on the submodules found at the specified paths.\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 79bfaac..f7964ad 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -5,11 +5,11 @@\n # Copyright (c) 2007 Lars Hjemli\n \n dashless=$(basename \"$0\" | sed -e 's/-/ /')\n-USAGE=\"[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]\n+USAGE=\"[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [-v|--verbose] [--] <repository> [<path>]\n    or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]\n    or: $dashless [--quiet] init [--] [<path>...]\n    or: $dashless [--quiet] deinit [-f|--force] [--] <path>...\n-   or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]\n+   or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [-v|--verbose] [--] [<path>...]\n    or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]\n    or: $dashless [--quiet] foreach [--recursive] <command>\n    or: $dashless [--quiet] sync [--recursive] [--] [<path>...]\"\n@@ -309,6 +309,9 @@ cmd_add()\n \t\t\tcustom_name=$2\n \t\t\tshift\n \t\t\t;;\n+\t\t-v|--verbose)\n+\t\t\tVERBOSE=1\n+\t\t\t;;\n \t\t--)\n \t\t\tshift\n \t\t\tbreak\n@@ -408,11 +411,15 @@ Use -f if you really want to add it.\" >&2\n \t\tmodule_clone \"$sm_path\" \"$sm_name\" \"$realrepo\" \"$reference\" || exit\n \t\t(\n \t\t\tclear_local_git_env\n+\t\t\tif test -z \"$VERBOSE\"\n+\t\t\tthen\n+\t\t\t\tsubquiet=-q\n+\t\t\tfi\n \t\t\tcd \"$sm_path\" &&\n \t\t\t# ash fails to wordsplit ${branch:+-b \"$branch\"...}\n \t\t\tcase \"$branch\" in\n-\t\t\t'') git checkout -f -q ;;\n-\t\t\t?*) git checkout -f -q -B \"$branch\" \"origin/$branch\" ;;\n+\t\t\t'') git checkout -f $subquiet ;;\n+\t\t\t?*) git checkout -f $subquiet -B \"$branch\" \"origin/$branch\" ;;\n \t\t\tesac\n \t\t) || die \"$(eval_gettext \"Unable to checkout submodule '\\$sm_path'\")\"\n \tfi\n@@ -676,6 +683,9 @@ cmd_update()\n \t\t--checkout)\n \t\t\tupdate=\"checkout\"\n \t\t\t;;\n+\t\t-v|--verbose)\n+\t\t\tVERBOSE=1\n+\t\t\t;;\n \t\t--)\n \t\t\tshift\n \t\t\tbreak\n@@ -799,7 +809,11 @@ Maybe you want to use 'update --init'?\")\"\n \t\t\t\tmust_die_on_failure=yes\n \t\t\t\t;;\n \t\t\t*)\n-\t\t\t\tcommand=\"git checkout $subforce -q\"\n+\t\t\t\tif test -z \"$VERBOSE\"\n+\t\t\t\tthen\n+\t\t\t\t\tsubquiet=-q\n+\t\t\t\tfi\n+\t\t\t\tcommand=\"git checkout $subforce $subquiet\"\n \t\t\t\tdie_msg=\"$(eval_gettext \"Unable to checkout '\\$sha1' in submodule path '\\$prefix\\$sm_path'\")\"\n \t\t\t\tsay_msg=\"$(eval_gettext \"Submodule path '\\$prefix\\$sm_path': checked out '\\$sha1'\")\"\n \t\t\t\t;;\n-- \n1.7.10.4\n"}]}