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

Re: [PATCH 3/3] git-prompt.sh: fix for submodule 'dirty' indicator

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jan 24, 2017, 01:17 UTC
Message-ID
<20170124011708.qlq7aenmdfg6wosv@genre.crustytoothpaste.net>
In-Reply-To
<1485113421-22264-1-git-send-email-email@benjaminfuchs.de>
On Sun, Jan 22, 2017 at 08:30:21PM +0100, Benjamin Fuchs wrote:
> Fixing wrong git diff line.

This patch says 3/3, but I don't see 1 and 2. Also, this description doesn't tell me what the problem is, or why this fix is useful. Such information helps us down the line when looking at the history, and it also helps reviewers determine whether your change makes sense.

Right now I can only guess that there's an issue with spaces or slashes somehow. You might want to take a look at Documentation/SubmittingPatches, especially point 2.

Show 32 quoted lines
> ---
>  contrib/completion/git-prompt.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
> index c44b9a2..43b28e9 100644
> --- a/contrib/completion/git-prompt.sh
> +++ b/contrib/completion/git-prompt.sh
> @@ -306,9 +306,9 @@ __git_ps1_submodule ()
>  	local submodule_name="$(basename "$git_dir")"
>  	if [ "$submodule_name" != ".git" ] && [ "$submodule_name" != "." ]; then
>  		local parent_top="${git_dir%.git*}"
> -		local submodule_top="${git_dir#*modules}"
> +		local submodule_top="${git_dir#*modules/}"
>  		local status=""
> -		git diff -C "$parent_top" --no-ext-diff --ignore-submodules=dirty --quiet -- "$submodule_top" 2>/dev/null || status="+"
> +		git -C "$parent_top" diff --no-ext-diff --ignore-submodules=dirty --quiet -- "$submodule_top" 2>/dev/null || status="+"
>  		printf "$status$submodule_name:"
>  	fi
>  }
> @@ -544,7 +544,7 @@ __git_ps1 ()
>  
>  	local sub=""
>  	if [ -n "${GIT_PS1_SHOWSUBMODULE}" ]; then
> -		sub="$(__git_ps1_submodule $g)"
> +		sub="$(__git_ps1_submodule "$g")"
>  	fi
>  
>  	local f="$w$i$s$u"
> -- 
> 2.7.4
> 
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204
Previous: Benjamin Fuchs
Message 2 of 2 in “git-prompt.sh: fix for submodule 'dirty' indicator”
  1. 3/3 git-prompt.sh: fix for submodule 'dirty' indicatorBenjamin Fuchs, Jan 22, 2017
  2. brian m. carlsonJan 24, 2017

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.