public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail•com>
To: Elijah Newren via GitGitGadget <gitgitgadget@gmail•com>
Cc: git@vger•kernel.org, dstolee@microsoft•com,
	Elijah Newren <newren@gmail•com>
Subject: Re: [PATCH v2 2/2] git-prompt: include sparsity state as well
Date: Fri, 19 Jun 2020 18:15:28 +0200	[thread overview]
Message-ID: <20200619161528.GI2898@szeder.dev> (raw)
In-Reply-To: <17254b30a5bcbbe3e14dd47272dfcb4c867030dd.1592513398.git.gitgitgadget@gmail.com>

On Thu, Jun 18, 2020 at 08:49:58PM +0000, Elijah Newren via GitGitGadget wrote:
> From: Elijah Newren <newren@gmail•com>
> 
> The current git prompt includes a lot of possible state information from
> cherry-picks, merges, bisects, and various flavors of rebases.  Add
> sparsity as another state flavor (though one which can be present
> simultaneously with any of rebase/cherry-pick/merge/bisect).  This extra
> state is shown with an extra
>     |SPARSE
> substring before the other states, providing a prompt that looks like:
>     (branchname|SPARSE|REBASE 6/10)
> 
> The reason for showing the "|SPARSE" substring before other states is to
> emphasize those other states.  Sparsity is probably not going to change
> much within a repository, while temporary operations will.  So we want
> the state changes related to temporary operations to be listed last, to
> make them appear closer to where the user types and make them more
> likely to be noticed.

I understand why some users prefer to be reminded when they are in a
repository that uses sparse checkout.  However, perhaps not all users
want to be reminded, and I'm sure that not all users want to increase
the width of their prompt by 7 characters (e.g. in standard-width
terminals).

> Signed-off-by: Elijah Newren <newren@gmail•com>
> ---
>  contrib/completion/git-prompt.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
> index 014cd7c3cfc..3e7344a4014 100644
> --- a/contrib/completion/git-prompt.sh
> +++ b/contrib/completion/git-prompt.sh
> @@ -421,6 +421,11 @@ __git_ps1 ()
>  		return $exit
>  	fi
>  
> +	local sparse=""
> +	if [ "$(git config --bool core.sparseCheckout)" == "true" ]; then
> +	    sparse="|SPARSE"

Nit: indentation.

> +	fi
> +
>  	local r=""
>  	local b=""
>  	local step=""
> @@ -543,7 +548,7 @@ __git_ps1 ()
>  	fi
>  
>  	local f="$w$i$s$u"
> -	local gitstring="$c$b${f:+$z$f}$r$p"
> +	local gitstring="$c$b${f:+$z$f}${sparse}$r$p"
>  
>  	if [ $pcmode = yes ]; then
>  		if [ "${__git_printf_supports_v-}" != yes ]; then
> -- 
> gitgitgadget

  reply	other threads:[~2020-06-19 16:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 23:33 [PATCH 0/2] Sparse checkout status Elijah Newren via GitGitGadget
2020-06-16 23:33 ` [PATCH 1/2] [RFC] wt-status: show sparse checkout status as well Elijah Newren via GitGitGadget
2020-06-17 14:50   ` Derrick Stolee
2020-06-17 15:46     ` Elijah Newren
2020-06-16 23:33 ` [PATCH 2/2] [RFC] git-prompt: include sparsity state " Elijah Newren via GitGitGadget
2020-06-18 20:49 ` [PATCH v2 0/2] Sparse checkout status Elijah Newren via GitGitGadget
2020-06-18 20:49   ` [PATCH v2 1/2] wt-status: show sparse checkout status as well Elijah Newren via GitGitGadget
2020-06-18 20:49   ` [PATCH v2 2/2] git-prompt: include sparsity state " Elijah Newren via GitGitGadget
2020-06-19 16:15     ` SZEDER Gábor [this message]
2020-06-19 16:33       ` Junio C Hamano
2020-06-19 16:35         ` Junio C Hamano
2020-06-18 21:45   ` [PATCH v2 0/2] Sparse checkout status Junio C Hamano
2020-06-18 23:18     ` Elijah Newren
2020-06-21  1:34       ` Elijah Newren
2020-06-21  5:21   ` [PATCH v3 0/3] " Elijah Newren via GitGitGadget
2020-06-21  5:21     ` [PATCH v3 1/3] wt-status: show sparse checkout status as well Elijah Newren via GitGitGadget
2020-06-21  5:21     ` [PATCH v3 2/3] git-prompt: document how in-progress operations affect the prompt Elijah Newren via GitGitGadget
2020-06-21  5:21     ` [PATCH v3 3/3] git-prompt: include sparsity state as well Elijah Newren via GitGitGadget
2020-06-22 16:35       ` Junio C Hamano

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=20200619161528.GI2898@szeder.dev \
    --to=szeder.dev@gmail$(echo .)com \
    --cc=dstolee@microsoft$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitgitgadget@gmail$(echo .)com \
    --cc=newren@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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