git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Matthieu Moy <Matthieu.Moy@imag.fr>
Cc: git@vger.kernel.org, j.sixt@viscovery.net,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [RFC/PATCH v2 2/3] submodule: introduce --[no-]display-comment-char
Date: Wed, 28 Aug 2013 23:07:00 +0200	[thread overview]
Message-ID: <521E6674.1010201@web.de> (raw)
In-Reply-To: <1377694024-24173-2-git-send-email-Matthieu.Moy@imag.fr>

Am 28.08.2013 14:47, schrieb Matthieu Moy:
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
> (--for-status was undocumented, so I didn't bother documenting this either)

That's fine, as both if these options will - hopefully - only be used
by wt-status.c internally.

But I'm not terribly happy about having the --for-status option in the
submodule script in the first place, as I believe it should rather be
handled by wt-status.c itself (reading the output of submodule summary
using the start_command()/finish_command() combo instead of the simple
run_command() currently used and prepending the comment char by using
status_printf() & friends for each line).

Having said that (and currently not having the time to do the above
myself), if we go along the route you are currently taking I'd prefer
to only add one other to-be-obsoleted-some-time-later option to the
submodule script. So what about only adding --no-display-comment-char
(and maybe call it --drop-status-comment-char or such to make meaning
and context a bit more obvious ;-)?

>  git-submodule.sh | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/git-submodule.sh b/git-submodule.sh
> index 2979197..ac0fdad 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -966,6 +966,7 @@ set_name_rev () {
>  cmd_summary() {
>  	summary_limit=-1
>  	for_status=
> +	display_comment_char=t
>  	diff_cmd=diff-index
>  
>  	# parse $args after "submodule ... summary".
> @@ -981,6 +982,12 @@ cmd_summary() {
>  		--for-status)
>  			for_status="$1"
>  			;;
> +		--display-comment-char)
> +			display_comment_char=t
> +			;;
> +		--no-display-comment-char)
> +			display_comment_char=
> +			;;
>  		-n|--summary-limit)
>  			summary_limit="$2"
>  			isnumber "$summary_limit" || usage
> @@ -1151,13 +1158,18 @@ cmd_summary() {
>  		echo
>  	done |
>  	if test -n "$for_status"; then
> +		if test -n "$display_comment_char"; then
> +			filter_cmd='git stripspace -c'
> +		else
> +			filter_cmd=cat
> +		fi
>  		if [ -n "$files" ]; then
> -			gettextln "Submodules changed but not updated:" | git stripspace -c
> +			gettextln "Submodules changed but not updated:" | $filter_cmd
>  		else
> -			gettextln "Submodule changes to be committed:" | git stripspace -c
> +			gettextln "Submodule changes to be committed:" | $filter_cmd
>  		fi
> -		printf "\n" | git stripspace -c
> -		git stripspace -c
> +		printf "\n" | $filter_cmd
> +		$filter_cmd
>  	else
>  		cat
>  	fi
> 

  reply	other threads:[~2013-08-28 21:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-28  8:32 [RFC/PATCH] status: introduce status.displayCommentChar to disable display of # Matthieu Moy
2013-08-28 11:03 ` Johannes Sixt
2013-08-28 12:43   ` Matthieu Moy
2013-08-28 12:47     ` [RFC/PATCH v2 1/3] builtin/stripspace.c: fix broken indentation Matthieu Moy
2013-08-28 12:47       ` [RFC/PATCH v2 2/3] submodule: introduce --[no-]display-comment-char Matthieu Moy
2013-08-28 21:07         ` Jens Lehmann [this message]
2013-08-29  7:04           ` Matthieu Moy
2013-08-28 12:47       ` [RFC/PATCH v2 3/3] status: introduce status.displayCommentChar to disable display of # Matthieu Moy
2013-08-28 20:05         ` Junio C Hamano
2013-08-28 20:10           ` Junio C Hamano
2013-08-28 20:18           ` Jeff King
2013-08-28 21:39             ` Junio C Hamano
2013-08-28 21:59               ` David Aguilar
2013-08-28 22:41                 ` Junio C Hamano
2013-08-29  6:58                 ` Matthieu Moy
2013-08-31  0:00             ` brian m. carlson
2013-08-28 20:59           ` Matthieu Moy
2013-08-28 21:53             ` Junio C Hamano
2013-08-28 21:50         ` Junio C Hamano
2013-08-28 23:13         ` Jonathan Nieder
2013-08-29  6:50           ` Matthieu Moy

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

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

  git send-email \
    --in-reply-to=521E6674.1010201@web.de \
    --to=jens.lehmann@web.de \
    --cc=Matthieu.Moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    /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.
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 NNTP newsgroup(s).