Browse Source

Confirm targets exist before linking

Targets *might* exist in Git, but not in the work tree.
(especially when initially cloning)
pull/1/head
Tim Byrne 7 years ago
parent
commit
2655b39e5b
  1. 12
      yadm

12
yadm

@ -117,11 +117,13 @@ function alt() { @@ -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

Loading…
Cancel
Save