deadc0de6 / dotdrop

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

[bug] Duplicate entries when using `import` feature in `profiles.dotfiles` section #349

Closed RayZ0rr closed 2 years ago

RayZ0rr commented 2 years ago

Dotdrop version (and git commit if run from source): v0.xxx Using dotdrop: as a submodule, from pypi, '...' Using from AUR

~$ dotdrop -v
1.8.2
(  1.8.2.r12.g30a0724-1 )

Describe the bug

When using the imoprt feature as mentioned here](https://dotdrop.readthedocs.io/en/latest/config-details/#profile-import-entry), duplicate entries are added to profile - dotfiles section.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Extract the following tar tar -xzf dotdroptest.tar.gz in home folder : dotdroptest.tar.gz or create the following config files in $HOME/dotdroptest config.yaml
    config:
    dotpath: dotfiles
    dotfiles:
    f_test1:
    src: dotdroptest/test1
    dst: ~/dotdroptest/test1
    f_imported:
    src: dotdroptest/imported
    dst: ~/dotdroptest/imported
    profiles:
    Arch:
    dotfiles:
    - f_test1
    import:
    - dotfiles.yaml

dotfiles.yaml

dotfiles:
  - f_imported
  1. Use the command in the dotdroptest folder dotdrop -p Arch imported
  2. A new entry will be added to config.yaml . It will become
    config:
    dotpath: dotfiles
    dotfiles:
    f_test1:
    src: dotdroptest/test1
    dst: ~/dotdroptest/test1
    f_imported:
    src: dotdroptest/imported
    dst: ~/dotdroptest/imported
    profiles:
    Arch:
    dotfiles:
    - f_test1
    - f_imported
    import:
    - dotfiles.yaml

Expected behavior

Duplicate entries are not added.

deadc0de6 commented 2 years ago

Thanks for reporting this however I was unable to reproduce the issue.

What command are you running through dotdrop -p Arch imported? I tried with import and update but was able to reproduce. Can you double check and give me more info on which command triggers the bug.

Thanks!

RayZ0rr commented 2 years ago

Sorry, for lack of clarification. I will put detailed steps here again.

  1. Extract the following tar tar -xzf dotdroptest.tar.gz in home folder : dotdroptest.tar.gz
  2. Use the command in the ~/dotdroptest folder dotdrop -p Arch import imported

~/dotdroptest/config.yaml before import command above:

config:
  dotpath: dotfiles
dotfiles:
  f_test1:
    src: dotdroptest/test1
    dst: ~/dotdroptest/test1
  f_imported:
    src: dotdroptest/imported
    dst: ~/dotdroptest/imported
profiles:
  Arch:
    dotfiles:
    - f_test1
    import:
    - dotfiles.yaml

~/dotdroptest/config.yaml after import command:

config:
  dotpath: dotfiles
dotfiles:
  f_test1:
    src: dotdroptest/test1
    dst: ~/dotdroptest/test1
  f_imported:
    src: dotdroptest/imported
    dst: ~/dotdroptest/imported
profiles:
  Arch:
    dotfiles:
    - f_test1
    - f_imported
    import:
    - dotfiles.yaml
deadc0de6 commented 2 years ago

Ok got it, I was able to reproduce and it's indeed a bug. Sorry for that, I'll fix it. Thanks for your patience

deadc0de6 commented 2 years ago

A fix has been pushed in the master branch and will be part of the next release. Thanks for submitting the bug report!

deadc0de6 commented 2 years ago

@RayZ0rr this is now available in version v1.9.0