deadc0de6 / dotdrop

Save your dotfiles once, deploy them everywhere
https://dotdrop.readthedocs.io
GNU General Public License v3.0
1.79k stars 105 forks source link

fix: report error on double config import #341

Closed davla closed 2 years ago

davla commented 2 years ago

Here is the PR for #340. Without much fuss, I copy-paste the description of the issue there, just for the records

Dotdrop crashes while parsing config files, regardless of the actual command. It specifically hits the `unable to merge` execution branch in `CfgYml._merge_dict`. This only happens in a very specific scenario: - A config file is imported more than once in the `import_configs` tree. For example ``` top-level.yml --[import]--> mid-level.yml --[import]--> bottom-level.yml top-level.yml --[import]--> bottom-level.yml ``` `bottom-level.yml` here is imported twice, once directly by `top-level.yml` and once indirectly via `mid-level.yml` - A profile in the config file that is imported twice (e.g. `bottom-level.yml`) has profile variables

In the issue we decided that the best way to tackle the problem is to exit with an error if a config file is imported more than once.

coveralls commented 2 years ago

Coverage Status

Coverage increased (+0.03%) to 84.85% when pulling 46e10ec90ee1553cdef46b874a4a5374df13a5b2 on davla:fix/double-imports into 296c179f626397e6e53da9ae51d5108e0f11cf59 on deadc0de6:master.

deadc0de6 commented 2 years ago

awesome, thanks a lot for your help :+1: