aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d/vr.sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-12-14 13:14:00 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-12-14 13:14:00 +1300
commite0ff7ac01d6439d826ff9ef6f134a7638ade714f (patch)
tree781004065fefcbfd8e543a61de3d168383e71bde /sh/shrc.d/vr.sh
parentMerge branch 'release/v3.1.0' (diff)
parentBump VERSION (diff)
downloaddotfiles-e0ff7ac01d6439d826ff9ef6f134a7638ade714f.tar.gz
dotfiles-e0ff7ac01d6439d826ff9ef6f134a7638ade714f.zip
Merge branch 'release/v3.2.0'v3.2.0
* release/v3.2.0: Bump VERSION Refactor some conditionals Factor out zsh ENV hack into one file Refactor "path list" not to require a subshell Correct completion for deep pass(1) directories Move filetype.vim helper funcs into autoload Fix a local var name in openssl(1ssl) completion Correct a variable ref in openssl(1ssl) completion Disable shellcheck rules for missed definition Add filenames treatment to mex(1df) completion Remove unneeded declaration Refactor some completions to avoid loops Remove unneeded stdout redirect Remove unneeded semicolon from sh "for VAR ; do" Substitute bad `continue` for `return` Add actual completion matching to git completion Apply much simpler completion to Git
Diffstat (limited to 'sh/shrc.d/vr.sh')
-rw-r--r--sh/shrc.d/vr.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/sh/shrc.d/vr.sh b/sh/shrc.d/vr.sh
index 8b35357c..c7057ec2 100644
--- a/sh/shrc.d/vr.sh
+++ b/sh/shrc.d/vr.sh
@@ -11,9 +11,14 @@ vr() {
exit 2
fi
- # Get path from first argument, strip trailing slash
+ # Get path from first argument
path=${1:-"$PWD"}
- [ "$path" = / ] || path=${path%/}
+
+ # Strip a trailing slash
+ case $path in
+ (/) ;;
+ (*) path=${path%/} ;;
+ esac
# Step into the directory
cd -- "$path" || exit
@@ -34,7 +39,7 @@ vr() {
# that is the root (bad)
while svn info >/dev/null 2>&1 ; do
root=$PWD
- [ "$root" = / ] && break
+ ! [ "$root" = / ] || break
cd .. || exit
done
if [ -n "$root" ] ; then