]> git.phdru.name Git - dotfiles.git/commitdiff
bash_prompt: Run `ls-files` from the root of the repo
authorOleg Broytman <phd@phdru.name>
Fri, 17 Dec 2021 15:22:28 +0000 (18:22 +0300)
committerOleg Broytman <phd@phdru.name>
Fri, 17 Dec 2021 15:22:28 +0000 (18:22 +0300)
Running `ls-files` in a subdirectory could miss files
in other parts of the working tree.

admin/prog/bash_prompt

index dc6f2935545b54d29213ac6850af837d59211a18..0436df4a951bac7043a6437255c0fcd4ba5036d8 100644 (file)
@@ -46,7 +46,7 @@ prompt_git() {
             #git update-index --really-refresh -q &>/dev/null
 
             # check for unstaged changes
-            if [ -n "$(git ls-files --modified)" ]; then
+            if [ -n "$(git ls-files --modified :/)" ]; then
                 s="$s*";
             fi
 
@@ -61,7 +61,7 @@ prompt_git() {
             fi
 
             # check for untracked files
-            if [ -n "$(git ls-files --others --exclude-standard)" ]; then
+            if [ -n "$(git ls-files --others --exclude-standard :/)" ]; then
                 s="$s%";
             fi