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:
parent
943d146c62
commit
2655b39e5b
1 changed files with 7 additions and 5 deletions
12
yadm
12
yadm
|
@ -117,11 +117,13 @@ function alt() {
|
||||||
#; for every file which matches the above regex, create a symlink
|
#; for every file which matches the above regex, create a symlink
|
||||||
for tracked_file in $(git ls-files | sort); do
|
for tracked_file in $(git ls-files | sort); do
|
||||||
tracked_file="$YADM_WORK/$tracked_file"
|
tracked_file="$YADM_WORK/$tracked_file"
|
||||||
if [[ $tracked_file =~ $match ]] ; then
|
if [ -e "$tracked_file" ] ; then
|
||||||
new_link="${BASH_REMATCH[1]}"
|
if [[ $tracked_file =~ $match ]] ; then
|
||||||
debug "Linking $tracked_file to $new_link"
|
new_link="${BASH_REMATCH[1]}"
|
||||||
[ -n "$LOUD" ] && echo "Linking $tracked_file to $new_link"
|
debug "Linking $tracked_file to $new_link"
|
||||||
ln -fs "$tracked_file" "$new_link"
|
[ -n "$LOUD" ] && echo "Linking $tracked_file to $new_link"
|
||||||
|
ln -fs "$tracked_file" "$new_link"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue