Package: git
Version: 1:2.1.1-1
Tags: upstream patch

Most git commands write progress info to stderr, but 'git submodule
foreach --recursive' writes its progress info "Entering '[submodule]'"
to stdout.  This makes git submodule foreach --recursive harder to
use than it should be in a pipeline.

How about something like this patch?

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
diff --git i/git-submodule.sh w/git-submodule.sh
index 9245abf..aabe567 100755
--- i/git-submodule.sh
+++ w/git-submodule.sh
@@ -154,7 +154,7 @@ module_list()
        eval "set $(git rev-parse --sq --prefix "$wt_prefix" -- "$@")"
        (
                git ls-files -z --error-unmatch --stage -- "$@" ||
-               echo "unmatched pathspec exists"
+               echo >&2 "unmatched pathspec exists"
        ) |
        @@PERL@@ -e '
        my %unmerged = ();
@@ -469,7 +469,7 @@ Use -f if you really want to add it." >&2
                                echo >&2 "$(eval_gettext "use the '--force' 
option. If the local git directory is not the correct repo")"
                                die "$(eval_gettext "or you are unsure what 
this means choose another name with the '--name' option.")"
                        else
-                               echo "$(eval_gettext "Reactivating local git 
directory for submodule '\$sm_name'.")"
+                               say >&2 "$(eval_gettext "Reactivating local git 
directory for submodule '\$sm_name'.")"
                        fi
                fi
                module_clone "$sm_path" "$sm_name" "$realrepo" "$reference" 
"$depth" || exit
@@ -539,7 +539,7 @@ cmd_foreach()
                if test -e "$sm_path"/.git
                then
                        displaypath=$(relative_path "$sm_path")
-                       say "$(eval_gettext "Entering '\$prefix\$displaypath'")"
+                       say >&2 "$(eval_gettext "Entering 
'\$prefix\$displaypath'")"
                        name=$(module_name "$sm_path")
                        (
                                prefix="$prefix$sm_path/"
@@ -616,7 +616,7 @@ cmd_init()
                        git config submodule."$name".url "$url" ||
                        die "$(eval_gettext "Failed to register url for 
submodule path '\$displaypath'")"
 
-                       say "$(eval_gettext "Submodule '\$name' (\$url) 
registered for path '\$displaypath'")"
+                       say >&2 "$(eval_gettext "Submodule '\$name' (\$url) 
registered for path '\$displaypath'")"
                fi
 
                # Copy "update" setting when it is not set yet
@@ -698,8 +698,8 @@ cmd_deinit()
                                die "$(eval_gettext "Submodule work tree 
'\$displaypath' contains local modifications; use '-f' to discard them")"
                        fi
                        rm -rf "$sm_path" &&
-                       say "$(eval_gettext "Cleared directory 
'\$displaypath'")" ||
-                       say "$(eval_gettext "Could not remove submodule work 
tree '\$displaypath'")"
+                       say >&2 "$(eval_gettext "Cleared directory 
'\$displaypath'")" ||
+                       say >&2 "$(eval_gettext "Could not remove submodule 
work tree '\$displaypath'")"
                fi
 
                mkdir "$sm_path" || say "$(eval_gettext "Could not create empty 
submodule directory '\$displaypath'")"
@@ -711,7 +711,7 @@ cmd_deinit()
                        # the user later decides to init this submodule again
                        url=$(git config submodule."$name".url)
                        git config --remove-section submodule."$name" 
2>/dev/null &&
-                       say "$(eval_gettext "Submodule '\$name' (\$url) 
unregistered for path '\$displaypath'")"
+                       say >&2 "$(eval_gettext "Submodule '\$name' (\$url) 
unregistered for path '\$displaypath'")"
                fi
        done
 }
@@ -818,7 +818,7 @@ cmd_update()
 
                if test "$update_module" = "none"
                then
-                       echo "Skipping submodule '$displaypath'"
+                       echo >&2 "Skipping submodule '$displaypath'"
                        continue
                fi
 
@@ -827,7 +827,7 @@ cmd_update()
                        # Only mention uninitialized submodules when its
                        # path have been specified
                        test "$#" != "0" &&
-                       say "$(eval_gettext "Submodule path '\$displaypath' not 
initialized
+                       say >&2 "$(eval_gettext "Submodule path '\$displaypath' 
not initialized
 Maybe you want to use 'update --init'?")"
                        continue
                fi
@@ -914,7 +914,7 @@ Maybe you want to use 'update --init'?")"
 
                        if (clear_local_git_env; cd "$sm_path" && $command 
"$sha1")
                        then
-                               say "$say_msg"
+                               say >&2 "$say_msg"
                        elif test -n "$must_die_on_failure"
                        then
                                die_with_status 2 "$die_msg"
@@ -1161,7 +1161,7 @@ cmd_summary() {
                then
                        # Don't give error msg for modification whose dst is 
not submodule
                        # i.e. deleted or changed to blob
-                       test $mod_dst = 160000 && echo "$errmsg"
+                       test $mod_dst = 160000 && echo >&2 "$errmsg"
                else
                        if test $mod_src = 160000 && test $mod_dst = 160000
                        then
@@ -1328,7 +1328,7 @@ cmd_sync()
                if git config "submodule.$name.url" >/dev/null 2>/dev/null
                then
                        displaypath=$(relative_path "$prefix$sm_path")
-                       say "$(eval_gettext "Synchronizing submodule url for 
'\$displaypath'")"
+                       say >&2 "$(eval_gettext "Synchronizing submodule url 
for '\$displaypath'")"
                        git config submodule."$name".url "$super_config_url"
 
                        if test -e "$sm_path"/.git


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to