git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 06/10] submodule deinit: send messages to stderr

From
Junio C Hamano <gitster@pobox.com>
Date
May 2, 2016, 23:28 UTC
Message-ID
<xmqqpot4ox9d.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1461976845-18228-7-git-send-email-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 9 quoted lines
> 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>
> ---
Sounds sensible.
Show 112 quoted lines
>  git-submodule.sh           |  8 ++++----
>  t/t7400-submodule-basic.sh | 20 ++++++++++----------
>  2 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/git-submodule.sh b/git-submodule.sh
> index f4d500e..3f67f4e 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -452,11 +452,11 @@ 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'")"
> +		mkdir "$sm_path" || say >&2 "$(eval_gettext "Could not create empty submodule directory '\$displaypath'")"
>  
>  		# Remove the .git/config entries (unless the user already did it)
>  		if test -n "$(git config --get-regexp submodule."$name\.")"
> @@ -465,7 +465,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
>  }
> diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
> index a6231f1..53644da 100755
> --- a/t/t7400-submodule-basic.sh
> +++ b/t/t7400-submodule-basic.sh
> @@ -935,7 +935,7 @@ test_expect_success 'submodule deinit from subdirectory' '
>  	mkdir -p sub &&
>  	(
>  		cd sub &&
> -		git submodule deinit ../init >../output
> +		git submodule deinit ../init 2>../output
>  	) &&
>  	grep "\\.\\./init" output &&
>  	test -z "$(git config --get-regexp "submodule\.example\.")" &&
> @@ -948,7 +948,7 @@ test_expect_success 'submodule deinit . deinits all initialized submodules' '
>  	git submodule update --init &&
>  	git config submodule.example.foo bar &&
>  	git config submodule.example2.frotz nitfol &&
> -	git submodule deinit . >actual &&
> +	git submodule deinit . 2>actual &&
>  	test -z "$(git config --get-regexp "submodule\.example\.")" &&
>  	test -z "$(git config --get-regexp "submodule\.example2\.")" &&
>  	test_i18ngrep "Cleared directory .init" actual &&
> @@ -959,7 +959,7 @@ test_expect_success 'submodule deinit . deinits all initialized submodules' '
>  test_expect_success 'submodule deinit deinits a submodule when its work tree is missing or empty' '
>  	git submodule update --init &&
>  	rm -rf init example2/* example2/.git &&
> -	git submodule deinit init example2 >actual &&
> +	git submodule deinit init example2 2>actual &&
>  	test -z "$(git config --get-regexp "submodule\.example\.")" &&
>  	test -z "$(git config --get-regexp "submodule\.example2\.")" &&
>  	test_i18ngrep ! "Cleared directory .init" actual &&
> @@ -973,7 +973,7 @@ test_expect_success 'submodule deinit fails when the submodule contains modifica
>  	test_must_fail git submodule deinit init &&
>  	test -n "$(git config --get-regexp "submodule\.example\.")" &&
>  	test -f example2/.git &&
> -	git submodule deinit -f init >actual &&
> +	git submodule deinit -f init 2>actual &&
>  	test -z "$(git config --get-regexp "submodule\.example\.")" &&
>  	test_i18ngrep "Cleared directory .init" actual &&
>  	rmdir init
> @@ -985,7 +985,7 @@ test_expect_success 'submodule deinit fails when the submodule contains untracke
>  	test_must_fail git submodule deinit init &&
>  	test -n "$(git config --get-regexp "submodule\.example\.")" &&
>  	test -f example2/.git &&
> -	git submodule deinit -f init >actual &&
> +	git submodule deinit -f init 2>actual &&
>  	test -z "$(git config --get-regexp "submodule\.example\.")" &&
>  	test_i18ngrep "Cleared directory .init" actual &&
>  	rmdir init
> @@ -1000,7 +1000,7 @@ test_expect_success 'submodule deinit fails when the submodule HEAD does not mat
>  	test_must_fail git submodule deinit init &&
>  	test -n "$(git config --get-regexp "submodule\.example\.")" &&
>  	test -f example2/.git &&
> -	git submodule deinit -f init >actual &&
> +	git submodule deinit -f init 2>actual &&
>  	test -z "$(git config --get-regexp "submodule\.example\.")" &&
>  	test_i18ngrep "Cleared directory .init" actual &&
>  	rmdir init
> @@ -1008,17 +1008,17 @@ test_expect_success 'submodule deinit fails when the submodule HEAD does not mat
>  
>  test_expect_success 'submodule deinit is silent when used on an uninitialized submodule' '
>  	git submodule update --init &&
> -	git submodule deinit init >actual &&
> +	git submodule deinit init 2>actual &&
>  	test_i18ngrep "Submodule .example. (.*) unregistered for path .init" actual &&
>  	test_i18ngrep "Cleared directory .init" actual &&
> -	git submodule deinit init >actual &&
> +	git submodule deinit init 2>actual &&
>  	test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
>  	test_i18ngrep "Cleared directory .init" actual &&
> -	git submodule deinit . >actual &&
> +	git submodule deinit . 2>actual &&
>  	test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
>  	test_i18ngrep "Submodule .example2. (.*) unregistered for path .example2" actual &&
>  	test_i18ngrep "Cleared directory .init" actual &&
> -	git submodule deinit . >actual &&
> +	git submodule deinit . 2>actual &&
>  	test_i18ngrep ! "Submodule .example. (.*) unregistered for path .init" actual &&
>  	test_i18ngrep ! "Submodule .example2. (.*) unregistered for path .example2" actual &&
>  	test_i18ngrep "Cleared directory .init" actual &&
Previous: Stefan BellerNext: Stefan Beller
Message 13 of 20 in “submodule output patches”
  1. 00/10 submodule output patchesStefan Beller, Apr 30, 2016
  2. 01/10 submodule deinit test: fix broken && chain in subshellStefan Beller, Apr 30, 2016
  3. 02/10 submodule deinit: lose requirement for giving '.'Stefan Beller, Apr 30, 2016
  4. 03/10 submodule init: redirect stdout to stderrStefan Beller, Apr 30, 2016
  5. 04/10 shell helpers usage: always send help to stderrStefan Beller, Apr 30, 2016
  6. Junio C HamanoMay 2, 2016
  7. Stefan BellerMay 2, 2016
  8. Junio C HamanoMay 3, 2016
  9. Junio C HamanoMay 3, 2016
  10. 05/10 submodule add: send messages to stderrStefan Beller, Apr 30, 2016
  11. Junio C HamanoMay 2, 2016
  12. 06/10 submodule deinit: send messages to stderrStefan Beller, Apr 30, 2016
  13. Junio C HamanoMay 2, 2016
  14. 07/10 submodule foreach: send messages to stderrStefan Beller, Apr 30, 2016
  15. 08/10 submodule update: send messages to stderrStefan Beller, Apr 30, 2016
  16. 09/10 submodule sync: send messages to stderrStefan Beller, Apr 30, 2016
  17. 10/10 submodule deinit: complain when given a file instead of a submoduleStefan Beller, Apr 30, 2016
  18. Per CederqvistMay 2, 2016
  19. Stefan BellerMay 2, 2016
  20. Stefan BellerMay 2, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.