git://git.iain.cx/iain
/
profile.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Try to change to directory from which become was run.
[profile.git]
/
.profile.d
/
svn-completion.bashrc
diff --git
a/.profile.d/svn-completion.bashrc
b/.profile.d/svn-completion.bashrc
index
3ccc627
..
3f32703
100644
(file)
--- a/
.profile.d/svn-completion.bashrc
+++ b/
.profile.d/svn-completion.bashrc
@@
-1,12
+1,20
@@
+# Get UUID for the working copy.
function __svn_uuid() {
svn info 2>/dev/null | sed -n 's/^Repository UUID: //p'
return $?
}
function __svn_uuid() {
svn info 2>/dev/null | sed -n 's/^Repository UUID: //p'
return $?
}
+# Get SVN toplevel.
function __svn_dir() {
local last="$1"; shift
local uuid=$(__svn_uuid)
function __svn_dir() {
local last="$1"; shift
local uuid=$(__svn_uuid)
+ # Bomb out if we ended up in an unexecutable directory.
+ if [ ! -x "$PWD" ]; then
+ return 1
+ fi
+
+ # Return the last directory if we just changed and found a different repo.
if [ -n "$last" -a ! "$uuid" = "$last" ]; then
echo "$OLDPWD"
return 0
if [ -n "$last" -a ! "$uuid" = "$last" ]; then
echo "$OLDPWD"
return 0
@@
-14,6
+22,8
@@
function __svn_dir() {
last="$uuid"
cd ..
last="$uuid"
cd ..
+
+ # Root?
if [ "$PWD" = "$OLDPWD" ]; then
return 1
fi
if [ "$PWD" = "$OLDPWD" ]; then
return 1
fi
@@
-22,6
+32,7
@@
function __svn_dir() {
return $?
}
return $?
}
+# Find the URL for the working copy and detect if we are on trunk.
function __svn_url() {
local url=$(svn info "$1" 2>/dev/null | sed -n 's/^URL: //p')
[ $? -gt 0 ] && return 1
function __svn_url() {
local url=$(svn info "$1" 2>/dev/null | sed -n 's/^URL: //p')
[ $? -gt 0 ] && return 1