1
0
Fork 0
mirror of synced 2024-12-13 02:45:45 -05:00

Merge pull request #177 from rasa/rasa/make-symlinks-relative

This commit is contained in:
Tim Byrne 2019-11-17 12:39:52 -06:00
commit 8d2373b5c5
No known key found for this signature in database
GPG key ID: 14DB4FC2465A4B12

24
yadm
View file

@ -447,11 +447,11 @@ function remove_stale_links() {
if [ -L "$stale_candidate" ]; then
link_target=$(readlink "$stale_candidate" 2>/dev/null)
if [ -n "$link_target" ]; then
removal=yes
for review_link in "${alt_linked[@]}"; do
[ "$link_target" = "$review_link" ] && removal=no
[ "$link_target" = "$review_link" ] && continue 2
[ "$link_target" = "$(basename "$review_link")" ] && continue 2
done
[ "$removal" = "yes" ] && rm -f "$stale_candidate"
rm -f "$stale_candidate"
fi
fi
done
@ -526,7 +526,7 @@ function alt_future_linking() {
[ -L "$filename" ] && rm -f "$filename"
cp -f "$target" "$filename"
else
ln -nfs "$target" "$filename"
alt_ln "$target" "$filename"
alt_linked+=("$target")
fi
fi
@ -570,7 +570,7 @@ function alt_past_linking() {
fi
cp -f "$alt_path" "$new_link"
else
ln -nfs "$alt_path" "$new_link"
alt_ln "$alt_path" "$new_link"
alt_linked+=("$alt_path")
fi
last_linked="$alt_path"
@ -607,6 +607,20 @@ function alt_past_linking() {
}
function alt_ln() {
local alt_dir alt_base new_base
alt_dir="$(dirname "$1")"
alt_base="$(basename "$1")"
new_base="$(basename "$2")"
if pushd "$alt_dir" >/dev/null ; then
ln -nfs "$alt_base" "$new_base"
popd &>/dev/null
else
ln -nfs "$1" "$2"
fi
}
function bootstrap() {
bootstrap_available || error_out "Cannot execute bootstrap\n'$YADM_BOOTSTRAP' is not an executable program."