191559601a
Prior to this patch, the following config led to incorrect behavior: - link: ~/.folder/file: path: file create: true relative: true relink: true Prior to the change, running the config the first time would result in expected behavior. However, running the config for the second time would result in deletion and re-creation of the link (even when the link is correct). This patch improves the interaction of relink and relative, taking relative paths into account when checking the validity of existing links in the `_delete()` method.
32 lines
691 B
Bash
32 lines
691 B
Bash
test_description='relink relative does not incorrectly relink file'
|
|
. '../test-lib.bash'
|
|
|
|
test_expect_success 'setup' '
|
|
echo "apple" > ${DOTFILES}/f &&
|
|
echo "grape" > ~/.f
|
|
'
|
|
|
|
test_expect_success 'run1' '
|
|
run_dotbot <<EOF
|
|
- link:
|
|
~/.folder/f:
|
|
path: f
|
|
create: true
|
|
relative: true
|
|
EOF
|
|
'
|
|
|
|
# these are done in a single block because they run in a subshell, and it
|
|
# wouldn't be possible to access `$mtime` outside of the subshell
|
|
test_expect_success 'test' '
|
|
mtime=$(stat ~/.folder/f | grep Modify)
|
|
run_dotbot <<EOF
|
|
- link:
|
|
~/.folder/f:
|
|
path: f
|
|
create: true
|
|
relative: true
|
|
relink: true
|
|
EOF
|
|
[[ "$mtime" == "$(stat ~/.folder/f | grep Modify)" ]]
|
|
'
|