Skip to contentSkip to conversation

(unknown)

PATCH [email protected] 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw
Quoted 1 line

From 3e4e22e93bf07355b40ba0abcb3a15c4941cfee7 Mon Sep 17 00:00:00 2001

From: Cody A Taylor <[email protected]>
Date: Thu, 12 Mar 2015 20:36:44 -0400
Subject: [PATCH] git prompt: Use toplevel to find untracked files.

The __git_ps1() prompt function would not show an untracked state when the current working directory was not a parent of the untracked file.

---
 contrib/completion/git-prompt.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/completion/git-prompt.sh +2 -1
index 214e859f99e7..f0d8a2669236 100644
@@ -487,7 +487,8 @@ __git_ps1 ()
 
 		if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
 		   [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
-		   git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null 2>/dev/null
+		   git ls-files --others --exclude-standard --error-unmatch -- \
+		     "$(git rev-parse --show-toplevel)/*" >/dev/null 2>/dev/null
 		then
 			u="%${ZSH_VERSION+%}"
 		fi
Signature · 1 line
2.3.2
#1 lore raw

Re:

Quoted 19 lines · On Fri, Mar 13, 2015 at 8:34 AM, <[email protected]> wrote:

From 3e4e22e93bf07355b40ba0abcb3a15c4941cfee7 Mon Sep 17 00:00:00 2001
From: Cody A Taylor <[email protected]>
Date: Thu, 12 Mar 2015 20:36:44 -0400
Subject: [PATCH] git prompt: Use toplevel to find untracked files.

The __git_ps1() prompt function would not show an untracked state when the current working directory was not a parent of the untracked file.

---
 contrib/completion/git-prompt.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/completion/git-prompt.sh +0 -0
index 214e859f99e7..f0d8a2669236 100644

contrib/completion/git-prompt.sh __git_ps1 () · line 491

Quoted 6 lines
contrib/completion/git-prompt.sh +2 -1
@@ -487,7 +487,8 @@ __git_ps1 ()
 
                if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ] &&
                   [ "$(git config --bool bash.showUntrackedFiles)" != "false" ] &&
-                  git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null 2>/dev/null
+                  git ls-files --others --exclude-standard --error-unmatch -- \
+                    "$(git rev-parse --show-toplevel)/*" >/dev/null 2>/dev/null

Or make it a bit simpler, just replace '*' with ':/*'.

Signature · 1 line
Duy