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

[PATCH v1.5 2/3] bash prompt: remove a redundant 'git diff' option

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Nov 21, 2015, 14:46 UTC
Message-ID
<1448117200-7299-1-git-send-email-szeder@ira.uka.de>
In-Reply-To
<1448105409-4494-2-git-send-email-szeder@ira.uka.de>

To get the dirty state indicator __git_ps1() runs 'git diff' with '--quiet --exit-code' options. '--quiet' already implies '--exit-code', so the latter is unnecessary and can be removed.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
Reworded the Subject: line, because it sounded as if the patch were to
remove a command line option of the bash prompt script.
The rest is unchanged.
 contrib/completion/git-prompt.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 07b52bedf1..7a95fbdcfd 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -476,7 +476,7 @@ __git_ps1 ()
 		if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ] &&
 		   [ "$(git config --bool bash.showDirtyState)" != "false" ]
 		then
-			git diff --no-ext-diff --quiet --exit-code || w="*"
+			git diff --no-ext-diff --quiet || w="*"
 			if [ -n "$short_sha" ]; then
 				git diff-index --cached --quiet HEAD -- || i="+"
 			else
-- 
2.6.3.402.geb6a0f7
Previous: SZEDER GáborNext: SZEDER Gábor
Message 3 of 4 in “bash prompt: test dirty index and worktree while on an orphan branch”
  1. 1/3 bash prompt: test dirty index and worktree while on an orphan branchSZEDER Gábor, Nov 21, 2015
  2. 2/3 bash prompt: remove a redundant command line optionSZEDER Gábor, Nov 21, 2015
  3. 2/3 bash prompt: remove a redundant 'git diff' optionSZEDER Gábor, Nov 21, 2015
  4. 3/3 bash prompt: indicate dirty index even on orphan branchesSZEDER Gábor, Nov 21, 2015

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.