Last active
April 22, 2016 04:22
-
-
Save zeph1e/694dbe897bfd3da4ad9884d8053e9393 to your computer and use it in GitHub Desktop.
Avoid $(git_ps) for NFS mounted directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export NFS_MOUNT_PATH="$HOME/titan" # colon-separated list | |
export BACKUP_PS1= | |
function avoid_gitps_on_nfs() { | |
IFS=":" | |
set $NFS_MOUNT_PATH | |
for var in $NFS_MOUNT_PATH; do | |
if [ -n "`echo \"^$PWD\" | grep -e $var`" ]; then | |
export BACKUP_PS1=$PS1 | |
export PS1=$NFS_PS1 | |
return | |
fi | |
done | |
if [ -n "$BACKUP_PS1" ]; then | |
export PS1=$BACKUP_PS1 | |
fi | |
} | |
function cd() { | |
builtin cd $@ && avoid_gitps_on_nfs | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment