git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Scott Kyle <scott@appden.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] completion: Add PS1 configuration for submodules
Date: Tue, 7 Dec 2010 10:40:57 +0100	[thread overview]
Message-ID: <20101207094057.GA6176@neumann> (raw)
In-Reply-To: <1291677763-55385-1-git-send-email-scott@appden.com>

Hi Scott,


On Mon, Dec 06, 2010 at 03:22:43PM -0800, Scott Kyle wrote:
> For those who often work on repositories with submodules, the dirty
> indicator for unstaged changes will almost always show because development
> is simultaneously happening on those submodules. The config option
> diff.ignoreSubmodules is not appropriate for this use because it has larger
> implications.
> 
> Signed-off-by: Scott Kyle <scott@appden.com>
> ---
>  contrib/completion/git-completion.bash |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 604fa79..539bcb1 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -37,7 +37,9 @@
>  #       value, unstaged (*) and staged (+) changes will be shown next
>  #       to the branch name.  You can configure this per-repository
>  #       with the bash.showDirtyState variable, which defaults to true
> -#       once GIT_PS1_SHOWDIRTYSTATE is enabled.
> +#       once GIT_PS1_SHOWDIRTYSTATE is enabled.  You can also set
> +#       GIT_PS1_IGNORESUBMODULES to a value that git diff understands
> +#       to adjust the behavior of the dirty state indicator.

git diff "understands" a lot of things, therefore I'd like to be a bit
more specific here by mentioning the --ignore-submodules= option:

+#       once GIT_PS1_SHOWDIRTYSTATE is enabled.  You can also set
+#       GIT_PS1_IGNORESUBMODULES to a value that git diff
+#       --ignore-submodules= understands to adjust the behavior of the
+#       dirty state indicator.

But it might be just me being unfamiliar with submodules.  Otherwise
it looks good and reasonable to me.

>  #
>  #       You can also see if currently something is stashed, by setting
>  #       GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
> @@ -286,7 +288,8 @@ __git_ps1 ()
>  		elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then
>  			if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then
>  				if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then
> -					git diff --no-ext-diff --quiet --exit-code || w="*"
> +					local ignore_submodules=${GIT_PS1_IGNORESUBMODULES+"--ignore-submodules=$GIT_PS1_IGNORESUBMODULES"}
> +					git diff $ignore_submodules --no-ext-diff --quiet --exit-code || w="*"
>  					if git rev-parse --quiet --verify HEAD >/dev/null; then
>  						git diff-index --cached --quiet HEAD -- || i="+"
>  					else
> -- 
> 1.7.3.3.574.g98527
> 
> 

  reply	other threads:[~2010-12-07  9:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06 23:22 [PATCH] completion: Add PS1 configuration for submodules Scott Kyle
2010-12-07  9:40 ` SZEDER Gábor [this message]
2010-12-07 12:15 ` Ævar Arnfjörð Bjarmason
2010-12-07 20:31   ` Kevin Ballard
2010-12-07 21:08     ` Jens Lehmann
2010-12-07 21:17       ` Scott Kyle
2010-12-07 21:28         ` Jens Lehmann
2010-12-07 21:29         ` Jonathan Nieder
2010-12-07 22:59           ` Scott Kyle
2010-12-12  6:38             ` Jonathan Nieder
2010-12-13 18:12               ` Jens Lehmann
2010-12-21 22:56                 ` Scott Kyle
2010-12-07 20:37   ` Scott Kyle
2010-12-07 20:41     ` Kevin Ballard
2010-12-08  0:27       ` Ævar Arnfjörð Bjarmason

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=20101207094057.GA6176@neumann \
    --to=szeder@ira.uka.de \
    --cc=git@vger.kernel.org \
    --cc=scott@appden.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.
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).