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 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…
Reference in a new issue