git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Jens.Lehmann@web.de,
	Stefan Beller <sbeller@google.com>
Subject: [PATCH 08/10] submodule update: send messages to stderr
Date: Fri, 29 Apr 2016 17:40:43 -0700	[thread overview]
Message-ID: <1461976845-18228-9-git-send-email-sbeller@google.com> (raw)
In-Reply-To: <1461976845-18228-1-git-send-email-sbeller@google.com>

Reroute the output of stdout to stderr as it is just informative
messages, not to be consumed by machines.

This should not regress any scripts that try to parse the
current output, as the output is already internationalized
and therefore unstable.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 git-submodule.sh            |  2 +-
 t/t7406-submodule-update.sh | 23 ++++++++++-------------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/git-submodule.sh b/git-submodule.sh
index 80270db..c86c2e5 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -679,7 +679,7 @@ cmd_update()
 
 			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"
diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
index 5f27879..1f8faa8 100755
--- a/t/t7406-submodule-update.sh
+++ b/t/t7406-submodule-update.sh
@@ -106,15 +106,8 @@ rebasingsha1=$(git -C super/rebasing rev-parse HEAD)
 submodulesha1=$(git -C super/submodule rev-parse HEAD)
 pwd=$(pwd)
 
-cat <<EOF >expect
-Submodule path '../super': checked out '$supersha1'
-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 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'
@@ -127,6 +120,10 @@ Cloning into '$pwd/recursivesuper/super/rebasing'...
 done.
 Cloning into '$pwd/recursivesuper/super/submodule'...
 done.
+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
 
 test_expect_success 'submodule update --init --recursive from subdirectory' '
@@ -136,7 +133,7 @@ test_expect_success 'submodule update --init --recursive from subdirectory' '
 	 cd tmp &&
 	 git submodule update --init --recursive ../super >../../actual 2>../../actual2
 	) &&
-	test_cmp expect actual &&
+	test_must_be_empty actual &&
 	test_cmp expect2 actual2
 '
 
@@ -156,8 +153,8 @@ test_expect_success 'submodule update does not fetch already present commits' '
 	(cd super &&
 	  git submodule update > ../actual 2> ../actual.err
 	) &&
-	test_i18ncmp expected actual &&
-	! test -s actual.err
+	test_must_be_empty actual &&
+	test_i18ncmp expected actual.err
 '
 
 test_expect_success 'submodule update should fail due to local changes' '
@@ -790,7 +787,7 @@ test_expect_success 'submodule update places git-dir in superprojects git-dir re
 	rm -rf super_update_r2 &&
 	git clone super_update_r super_update_r2 &&
 	(cd super_update_r2 &&
-	 git submodule update --init --recursive >actual &&
+	 git submodule update --init --recursive 2>actual &&
 	 test_i18ngrep "Submodule path .submodule/subsubmodule.: checked out" actual &&
 	 (cd submodule/subsubmodule &&
 	  git log > ../../expected
@@ -858,7 +855,7 @@ test_expect_success 'submodule update --recursive drops module name before recur
 	 (cd deeper/submodule/subsubmodule &&
 	  git checkout HEAD^
 	 ) &&
-	 git submodule update --recursive deeper/submodule >actual &&
+	 git submodule update --recursive deeper/submodule 2>actual &&
 	 test_i18ngrep "Submodule path .deeper/submodule/subsubmodule.: checked out" actual
 	)
 '
-- 
2.8.0.32.g71f8beb.dirty

  parent reply	other threads:[~2016-04-30  0:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-30  0:40 [PATCH 00/10] submodule output patches Stefan Beller
2016-04-30  0:40 ` [PATCH 01/10] submodule deinit test: fix broken && chain in subshell Stefan Beller
2016-04-30  0:40 ` [PATCH 02/10] submodule deinit: lose requirement for giving '.' Stefan Beller
2016-04-30  0:40 ` [PATCH 03/10] submodule init: redirect stdout to stderr Stefan Beller
2016-04-30  0:40 ` [PATCH 04/10] shell helpers usage: always send help " Stefan Beller
2016-05-02 23:28   ` Junio C Hamano
2016-05-02 23:44     ` Stefan Beller
2016-05-03  0:45       ` Junio C Hamano
2016-05-03  1:17         ` Junio C Hamano
2016-04-30  0:40 ` [PATCH 05/10] submodule add: send messages " Stefan Beller
2016-05-02 23:26   ` Junio C Hamano
2016-04-30  0:40 ` [PATCH 06/10] submodule deinit: " Stefan Beller
2016-05-02 23:28   ` Junio C Hamano
2016-04-30  0:40 ` [PATCH 07/10] submodule foreach: " Stefan Beller
2016-04-30  0:40 ` Stefan Beller [this message]
2016-04-30  0:40 ` [PATCH 09/10] submodule sync: " Stefan Beller
2016-04-30  0:40 ` [PATCH 10/10] submodule deinit: complain when given a file instead of a submodule Stefan Beller
2016-05-02  8:26   ` Per Cederqvist
2016-05-02 16:21     ` Stefan Beller
2016-05-02 17:00       ` Stefan Beller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461976845-18228-9-git-send-email-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).