1
0
Fork 0
mirror of synced 2024-07-19 11:00:34 -04:00

Confirm targets exist before linking

Targets *might* exist in Git, but not in the work tree.
(especially when initially cloning)
This commit is contained in:
Tim Byrne 2015-07-14 10:04:09 -05:00
parent 943d146c62
commit 2655b39e5b

12
yadm
View file

@ -117,11 +117,13 @@ function alt() {
#; for every file which matches the above regex, create a symlink
for tracked_file in $(git ls-files | sort); do
tracked_file="$YADM_WORK/$tracked_file"
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"
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"
fi
fi
done