Support for symlinked directories (#17)

pull/26/head
Tim Byrne 8 years ago
parent 85abcf981c
commit fa286f0c9d
No known key found for this signature in database
GPG Key ID: 6CBE24C2FD8CF76E

21
yadm

@ -117,16 +117,23 @@ function alt() {
#; loop over all "tracked" files
#; for every file which matches the above regex, create a symlink
last_linked=''
for tracked_file in $(git ls-files | sort); do
tracked_file="$YADM_WORK/$tracked_file"
if [ -e "$tracked_file" ] ; then
if [[ $tracked_file =~ $match ]] ; then
new_link="${BASH_REMATCH[1]}"
debug "Linking $tracked_file to $new_link"
[ -n "$loud" ] && echo "Linking $tracked_file to $new_link"
ln -fs "$tracked_file" "$new_link"
#; process both the path, and it's parent directory
for alt_path in "$tracked_file" "${tracked_file%/*}"; do
if [ -e "$alt_path" ] ; then
if [[ $alt_path =~ $match ]] ; then
if [ "$alt_path" != "$last_linked" ] ; then
new_link="${BASH_REMATCH[1]}"
debug "Linking $alt_path to $new_link"
[ -n "$loud" ] && echo "Linking $alt_path to $new_link"
ln -nfs "$alt_path" "$new_link"
last_linked="$alt_path"
fi
fi
fi
fi
done
done
}

@ -356,6 +356,10 @@ If running on a Solaris server, the link use the default "##" version:
If no "##" version exists and no files match the current OS/HOSTNAME/USER, then no link will be created.
Links are also created for directories named this way, as long as they have at least one
.B yadm
managed file within them.
OS is determined by running
.BR uname\ -s ,
HOSTNAME by running

Loading…
Cancel
Save