Prevent prompt from spewing errors if cwd has disappeared

This commit is contained in:
Jason Nader 2020-03-02 21:12:11 +09:00 committed by Fabian Homborg
parent e0645c9473
commit 33f55e05d0

View file

@ -7,7 +7,9 @@ function fish_print_hg_root
# Find an hg directory above $PWD
# without calling `hg root` because that's too slow
set -l root
set -l dir (pwd -P)
set -l dir (pwd -P 2>/dev/null)
or return 1
while test $dir != "/"
if test -f $dir'/.hg/dirstate'
echo $dir/.hg