Skip to content

Instantly share code, notes, and snippets.

@zeph1e
Last active April 22, 2016 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeph1e/694dbe897bfd3da4ad9884d8053e9393 to your computer and use it in GitHub Desktop.
Save zeph1e/694dbe897bfd3da4ad9884d8053e9393 to your computer and use it in GitHub Desktop.
Avoid $(git_ps) for NFS mounted directory
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