Re: [PATCH 06/15] submodule init: redirect stdout to stderr
From: Junio C Hamano <hidden>
Date: 2016-06-16 02:19:05
Stefan Beller [off-list ref] writes:
Reroute the output of stdout to stderr as it is just informative messages, not to be consumed by machines. We want to init submodules from the helper for `submodule update` in a later patch and the stdout output of said helper is consumed by the parts of `submodule update` which are still written in shell. So we have to be careful which messages are on stdout. Signed-off-by: Stefan Beller <redacted> ---
I do not mind if this step is split out and queued as a separate follow-up to sb/submodule-init. The grouping and labelling is a bigger and more important change that deserves attention without distraction than this single step, and making as many such things graduate and allowing us to forget about them is better ;-)
quoted hunk
builtin/submodule--helper.c | 3 ++- t/t7406-submodule-update.sh | 24 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-)diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 23d7224..7b9a4d7 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c@@ -362,7 +362,8 @@ static void init_submodule(const char *path, const char *prefix, int quiet) die(_("Failed to register url for submodule path '%s'"), displaypath); if (!quiet) - printf(_("Submodule '%s' (%s) registered for path '%s'\n"), + fprintf(stderr, + _("Submodule '%s' (%s) registered for path '%s'\n"), sub->name, url, displaypath); }diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh index fd741f5..5f27879 100755 --- a/t/t7406-submodule-update.sh +++ b/t/t7406-submodule-update.sh@@ -108,24 +108,36 @@ pwd=$(pwd) cat <<EOF >expect Submodule path '../super': checked out '$supersha1' -Submodule 'merging' ($pwd/merging) registered for path '../super/merging' -Submodule 'none' ($pwd/none) registered for path '../super/none' -Submodule 'rebasing' ($pwd/rebasing) registered for path '../super/rebasing' -Submodule 'submodule' ($pwd/submodule) registered for path '../super/submodule' Submodule path '../super/merging': checked out '$mergingsha1' Submodule path '../super/none': checked out '$nonesha1' Submodule path '../super/rebasing': checked out '$rebasingsha1' Submodule path '../super/submodule': checked out '$submodulesha1' EOF +cat <<EOF >expect2 +Submodule 'merging' ($pwd/merging) registered for path '../super/merging' +Submodule 'none' ($pwd/none) registered for path '../super/none' +Submodule 'rebasing' ($pwd/rebasing) registered for path '../super/rebasing' +Submodule 'submodule' ($pwd/submodule) registered for path '../super/submodule' +Cloning into '$pwd/recursivesuper/super/merging'... +done. +Cloning into '$pwd/recursivesuper/super/none'... +done. +Cloning into '$pwd/recursivesuper/super/rebasing'... +done. +Cloning into '$pwd/recursivesuper/super/submodule'... +done. +EOF + test_expect_success 'submodule update --init --recursive from subdirectory' ' git -C recursivesuper/super reset --hard HEAD^ && (cd recursivesuper && mkdir tmp && cd tmp && - git submodule update --init --recursive ../super >../../actual + git submodule update --init --recursive ../super >../../actual 2>../../actual2 ) && - test_cmp expect actual + test_cmp expect actual && + test_cmp expect2 actual2 ' apos="'";