Environment
- OS: Ubuntu
- Dotter version: 0.13.5
- Additional relevant information
Description
Crazy schizo edge-case, but if a directory is deployed as a single symlink (recurse = false) and a file inside that directory is also configured as a template, the template's target path resolves through the directory symlink back to the template's own source file.
Reproduction
[nvim.files]
"files/nvim" = { target = "~/.config/nvim", type = "symbolic", recurse = false }
"files/nvim/lua/keys.lua" = { target = "~/.config/nvim/lua/keys.lua", type = "template" }
Without --force this is reported as target file already exists. Skipping., which is misleading but harmless. With --force, dotter removes the target — which is the source — and then fails reading it:
[WARN] Creating template "files/nvim/lua/keys.lua" -> ".../.config/nvim/lua/keys.lua" but target file already exists. Forcing.
[ERROR] Failed to create template ...
Caused by:
perform template cache
read template source file
read from file
No such file or directory (os error 2)
The file is gone from the repository, and there is nothing to recover it from.
Expected behavior
A check should be added that a template's source and target are not the same file.
Actual behavior
The file is gone from the repository, and there is nothing to recover it from.
Environment
Description
Crazy schizo edge-case, but if a directory is deployed as a single symlink (
recurse = false) and a file inside that directory is also configured as a template, the template's target path resolves through the directory symlink back to the template's own source file.Reproduction
Without
--forcethis is reported astarget file already exists. Skipping., which is misleading but harmless. With--force, dotter removes the target — which is the source — and then fails reading it:The file is gone from the repository, and there is nothing to recover it from.
Expected behavior
A check should be added that a template's source and target are not the same file.
Actual behavior
The file is gone from the repository, and there is nothing to recover it from.