deadc0de6 / dotdrop

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

[bug] Subdirectories are not cmp/up-ignored #405

Closed flavio-a closed 11 months ago

flavio-a commented 11 months ago

Dotdrop version and git commit (ran as submodule): 2eb1801eff77ad5e12658785b4cad5f2e4f16fc7 dotdrop (v1.13.2-51-g2eb1801)

Describe the bug

Dotdrop compares/imports (sub)directories matching cmpignore and upignore in the config file. According to the documentation, adding a directory name in cmpignore/upignore should not compare/import it.

Steps to Reproduce

  1. Create the following dir tree:
    test
    ├─ config1
    └─ ignoreme
    └─ config2
  2. Import it with dotdrop.sh import <path to test>
  3. In config.yaml add the lines
    cmpignore:
    - ignoreme
  4. Delete the ignoreme dir in dotfiles/test
  5. Run dotdrop.sh compare
  6. The output contains the following warning:
    => compare d_test: diffing with "/tmp/test/"
    => "ignoreme" does not exist in dotdrop

Analogously, if you add upignore and run dotdrop.sh import it copies ignoreme into dotfiles/test.

Expected behavior

Dotdrop should not compare nor import the subdirectory ignoreme

Additional information

The relevant part of the config file

dotfiles:
  d_test:
    src: tmp/test
    dst: /tmp/test
    cmpignore:
    - ignoreme
    upignore:
    - ignoreme

These patterns exhibit the same bug: '*ignoreme', ignoreme/ Single files and files matched by wildcards are ignored correctly: if I add eg. cmpignore: - ignoreme/* it ignores the file ignoreme/config2 (you can see it with update). If this is the intended way to ignore a dir, I think it's worth mentioning explicitly in the documentation.

Dotdrop's execution with the debug logs (--verbose)

$ dotdrop compare --verbose
[DEBUG][dotdrop.options._get_config_path] config from yaml in current dir config.yaml
[DEBUG][dotdrop.options.__init__] config abs path: /tmp/dottest/config.yaml
[DEBUG][dotdrop.options.__init__] #################################################
[DEBUG][dotdrop.options.__init__] #################### DOTDROP ####################
[DEBUG][dotdrop.options.__init__] #################################################
[DEBUG][dotdrop.options.__init__] version: 1.13.2
[DEBUG][dotdrop.options.__init__] command: /tmp/dottest/dotdrop/dotdrop/dotdrop.py --verbose compare
[DEBUG][dotdrop.options.__init__] config file: /tmp/dottest/config.yaml
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] START of config parsing
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] reloading: False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] profile: zenithia
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] included profiles: 
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] ----------dump:/tmp/dottest/config.yaml----------
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] 
config:
  backup: true
  create: true
  dotpath: dotfiles
dotfiles:
  d_test:
    src: tmp/test
    dst: /tmp/test
    cmpignore:
    - ignoreme
    upignore:
    - ignoreme
profiles:
  zenithia:
    dotfiles:
    - d_test
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] ----------end:/tmp/dottest/config.yaml----------
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] format: yaml
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] normalizing relative to cfg: dotfiles -> /tmp/dottest/dotfiles
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] settings block::
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "backup": True
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "banner": True
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "create": True
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "dotpath": /tmp/dottest/dotfiles
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "ignoreempty": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "keepdot": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "link_dotfile_default": nolink
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "link_on_import": nolink
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "longkey": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "showdiff": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "workdir": /home/flavio/.config/dotdrop
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "minversion": None
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "diff_command": diff -r -u {0} {1}
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "template_dotfile_default": True
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "ignore_missing_in_dotdrop": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "force_chmod": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "chmod_on_import": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "check_version": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "clear_workdir": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "compare_workdir": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "key_prefix": True
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "key_separator": _
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "default_actions": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "import_actions": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "import_configs": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "import_variables": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "cmpignore": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "upignore": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "instignore": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "impignore": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "func_file": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "filter_file": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] variables block:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] dynvariables block:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] current variables defined:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "profile": zenithia
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "_dotdrop_dotpath": /tmp/dottest/dotfiles
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "_dotdrop_cfgpath": /tmp/dottest/config.yaml
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "_dotdrop_workdir": /home/flavio/.config/dotdrop
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] profiles block:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "zenithia"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * dotfiles: "['d_test']"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] variables defined (after template dict):
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "profile": zenithia
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "_dotdrop_dotpath": /tmp/dottest/dotfiles
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "_dotdrop_cfgpath": /tmp/dottest/config.yaml
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "_dotdrop_workdir": /home/flavio/.config/dotdrop
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] variables defined (after template include):
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "profile": zenithia
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "_dotdrop_dotpath": /tmp/dottest/dotfiles
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "_dotdrop_cfgpath": /tmp/dottest/config.yaml
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "_dotdrop_workdir": /home/flavio/.config/dotdrop
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] dotfiles block:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "d_test"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * src: "tmp/test"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * dst: "/tmp/test"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * cmpignore: "['ignoreme']"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * upignore: "['ignoreme']"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * link: "nolink"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * ignoreempty: "False"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * template: "True"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] actions block:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] trans_r block:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] trans_w block:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] templating dotfiles entries
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] uservariables block:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] ########### final config ###########
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] Current entries
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] entry settings:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "backup": True
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "banner": True
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "create": True
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "dotpath": /tmp/dottest/dotfiles
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "ignoreempty": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "keepdot": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "link_dotfile_default": nolink
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "link_on_import": nolink
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "longkey": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "showdiff": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "workdir": /home/flavio/.config/dotdrop
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "minversion": None
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "diff_command": diff -r -u {0} {1}
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "template_dotfile_default": True
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "ignore_missing_in_dotdrop": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "force_chmod": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "chmod_on_import": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "check_version": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "clear_workdir": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "compare_workdir": False
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "key_prefix": True
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "key_separator": _
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "default_actions": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "import_actions": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "import_configs": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "import_variables": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "cmpignore": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "upignore": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "instignore": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "impignore": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "func_file": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "filter_file": []
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] entry dotfiles:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "d_test"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * src: "/tmp/dottest/dotfiles/tmp/test"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * dst: "/tmp/test"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * cmpignore: "['ignoreme']"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * upignore: "['ignoreme']"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * link: "nolink"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * ignoreempty: "False"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * template: "True"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] entry profiles:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "zenithia"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]     * dotfiles: "['d_test']"
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] entry actions:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] entry trans_r:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] entry trans_w:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] entry variables:
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "profile": zenithia
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "_dotdrop_dotpath": /tmp/dottest/dotfiles
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "_dotdrop_cfgpath": /tmp/dottest/config.yaml
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml]   - "_dotdrop_workdir": /home/flavio/.config/dotdrop
[DEBUG][dotdrop.cfg_yaml._dbg] [dottest/config.yaml] END of config parsing
[DEBUG][dotdrop.cfg_aggregator._load] parsing cfgyaml into cfg_aggregator
[DEBUG][dotdrop.cfg_aggregator._load] parsing settings
[DEBUG][dotdrop.cfg_aggregator._load] parsing dotfiles
[DEBUG][dotdrop.utils.debug_list] dotfiles:
[DEBUG][dotdrop.utils.debug_list]   - key:"d_test", src:"/tmp/dottest/dotfiles/tmp/test", dst:"/tmp/test", link:"nolink", template:True
[DEBUG][dotdrop.cfg_aggregator._load] parsing profiles
[DEBUG][dotdrop.utils.debug_list] profiles:
[DEBUG][dotdrop.utils.debug_list]   - key:"zenithia"
[DEBUG][dotdrop.cfg_aggregator._load] parsing actions
[DEBUG][dotdrop.utils.debug_list] actions:
[DEBUG][dotdrop.cfg_aggregator._load] parsing trans_r
[DEBUG][dotdrop.utils.debug_list] trans_r:
[DEBUG][dotdrop.cfg_aggregator._load] parsing trans_w
[DEBUG][dotdrop.utils.debug_list] trans_w:
[DEBUG][dotdrop.cfg_aggregator._load] parsing variables
[DEBUG][dotdrop.utils.debug_dict] variables:
[DEBUG][dotdrop.utils.debug_dict]   - "profile": zenithia
[DEBUG][dotdrop.utils.debug_dict]   - "_dotdrop_dotpath": /tmp/dottest/dotfiles
[DEBUG][dotdrop.utils.debug_dict]   - "_dotdrop_cfgpath": /tmp/dottest/config.yaml
[DEBUG][dotdrop.utils.debug_dict]   - "_dotdrop_workdir": /home/flavio/.config/dotdrop
[DEBUG][dotdrop.cfg_aggregator._load] enrich variables
[DEBUG][dotdrop.cfg_aggregator._enrich_variables] enrich variables with os=linux
[DEBUG][dotdrop.cfg_aggregator._enrich_variables] enrich variables with release=6.1.0-10-amd64
[DEBUG][dotdrop.cfg_aggregator._enrich_variables] enrich variables with distro_id=debian
[DEBUG][dotdrop.cfg_aggregator._enrich_variables] enrich variables with distro_version=12
[DEBUG][dotdrop.cfg_aggregator._enrich_variables] enrich variables with distro_like=
[DEBUG][dotdrop.cfg_aggregator._load] patch keys...
[DEBUG][dotdrop.cfg_aggregator._patch_keys_to_objs] patching dotfiles ...
[DEBUG][dotdrop.cfg_aggregator._patch_keys_to_objs] patching actions ...
[DEBUG][dotdrop.cfg_aggregator._patch_keys_to_objs] patching actions ...
[DEBUG][dotdrop.cfg_aggregator._patch_keys_to_objs] patching default_actions ...
[DEBUG][dotdrop.cfg_aggregator._load] default actions: []
[DEBUG][dotdrop.cfg_aggregator._patch_keys_to_objs] patching trans_r ...
[DEBUG][dotdrop.cfg_aggregator._patch_keys_to_objs] patching trans_w ...
[DEBUG][dotdrop.cfg_aggregator._load] done parsing cfgyaml into cfg_aggregator
[DEBUG][dotdrop.utils.debug_dict] effective settings:
[DEBUG][dotdrop.utils.debug_dict]   - "backup": True
[DEBUG][dotdrop.utils.debug_dict]   - "banner": True
[DEBUG][dotdrop.utils.debug_dict]   - "create": True
[DEBUG][dotdrop.utils.debug_dict]   - "dotpath": /tmp/dottest/dotfiles
[DEBUG][dotdrop.utils.debug_dict]   - "ignoreempty": False
[DEBUG][dotdrop.utils.debug_dict]   - "keepdot": False
[DEBUG][dotdrop.utils.debug_dict]   - "link_dotfile_default": nolink
[DEBUG][dotdrop.utils.debug_dict]   - "link_on_import": nolink
[DEBUG][dotdrop.utils.debug_dict]   - "longkey": False
[DEBUG][dotdrop.utils.debug_dict]   - "showdiff": False
[DEBUG][dotdrop.utils.debug_dict]   - "workdir": /home/flavio/.config/dotdrop
[DEBUG][dotdrop.utils.debug_dict]   - "minversion": None
[DEBUG][dotdrop.utils.debug_dict]   - "diff_command": diff -r -u {0} {1}
[DEBUG][dotdrop.utils.debug_dict]   - "template_dotfile_default": True
[DEBUG][dotdrop.utils.debug_dict]   - "ignore_missing_in_dotdrop": False
[DEBUG][dotdrop.utils.debug_dict]   - "force_chmod": False
[DEBUG][dotdrop.utils.debug_dict]   - "chmod_on_import": False
[DEBUG][dotdrop.utils.debug_dict]   - "check_version": False
[DEBUG][dotdrop.utils.debug_dict]   - "clear_workdir": False
[DEBUG][dotdrop.utils.debug_dict]   - "compare_workdir": False
[DEBUG][dotdrop.utils.debug_dict]   - "key_prefix": True
[DEBUG][dotdrop.utils.debug_dict]   - "key_separator": _
[DEBUG][dotdrop.utils.debug_dict]   - "default_actions":
[DEBUG][dotdrop.utils.debug_dict]   - "import_actions":
[DEBUG][dotdrop.utils.debug_dict]   - "import_configs":
[DEBUG][dotdrop.utils.debug_dict]   - "import_variables":
[DEBUG][dotdrop.utils.debug_dict]   - "cmpignore":
[DEBUG][dotdrop.utils.debug_dict]   - "upignore":
[DEBUG][dotdrop.utils.debug_dict]   - "instignore":
[DEBUG][dotdrop.utils.debug_dict]   - "impignore":
[DEBUG][dotdrop.utils.debug_dict]   - "func_file":
[DEBUG][dotdrop.utils.debug_dict]   - "filter_file":
[DEBUG][dotdrop.options._debug_attr] effective options:
[DEBUG][dotdrop.utils.debug_dict] -> args:
[DEBUG][dotdrop.utils.debug_dict]   - "install": False
[DEBUG][dotdrop.utils.debug_dict]   - "--verbose": True
[DEBUG][dotdrop.utils.debug_dict]   - "--no-banner": False
[DEBUG][dotdrop.utils.debug_dict]   - "--temp": False
[DEBUG][dotdrop.utils.debug_dict]   - "--force": False
[DEBUG][dotdrop.utils.debug_dict]   - "--nodiff": False
[DEBUG][dotdrop.utils.debug_dict]   - "--dry": False
[DEBUG][dotdrop.utils.debug_dict]   - "--showdiff": False
[DEBUG][dotdrop.utils.debug_dict]   - "--force-actions": False
[DEBUG][dotdrop.utils.debug_dict]   - "--workdir-clear": False
[DEBUG][dotdrop.utils.debug_dict]   - "--cfg": None
[DEBUG][dotdrop.utils.debug_dict]   - "--profile": zenithia
[DEBUG][dotdrop.utils.debug_dict]   - "--workers": 1
[DEBUG][dotdrop.utils.debug_dict]   - "<key>":
[DEBUG][dotdrop.utils.debug_dict]   - "import": False
[DEBUG][dotdrop.utils.debug_dict]   - "--preserve-mode": False
[DEBUG][dotdrop.utils.debug_dict]   - "--ignore":
[DEBUG][dotdrop.utils.debug_dict]       - *.dotdropbak
[DEBUG][dotdrop.utils.debug_dict]       - *.dotdropbak
[DEBUG][dotdrop.utils.debug_dict]       - *.dotdropbak
[DEBUG][dotdrop.utils.debug_dict]   - "--transr": None
[DEBUG][dotdrop.utils.debug_dict]   - "--transw": None
[DEBUG][dotdrop.utils.debug_dict]   - "--link": None
[DEBUG][dotdrop.utils.debug_dict]   - "--as": None
[DEBUG][dotdrop.utils.debug_dict]   - "<path>":
[DEBUG][dotdrop.utils.debug_dict]   - "compare": True
[DEBUG][dotdrop.utils.debug_dict]   - "--file-only": False
[DEBUG][dotdrop.utils.debug_dict]   - "--ignore-missing": False
[DEBUG][dotdrop.utils.debug_dict]   - "--file":
[DEBUG][dotdrop.utils.debug_dict]   - "update": False
[DEBUG][dotdrop.utils.debug_dict]   - "--key": False
[DEBUG][dotdrop.utils.debug_dict]   - "--show-patch": False
[DEBUG][dotdrop.utils.debug_dict]   - "remove": False
[DEBUG][dotdrop.utils.debug_dict]   - "files": False
[DEBUG][dotdrop.utils.debug_dict]   - "--template": False
[DEBUG][dotdrop.utils.debug_dict]   - "--grepable": False
[DEBUG][dotdrop.utils.debug_dict]   - "detail": False
[DEBUG][dotdrop.utils.debug_dict]   - "profiles": False
[DEBUG][dotdrop.utils.debug_dict]   - "--help": False
[DEBUG][dotdrop.utils.debug_dict]   - "--version": False
[DEBUG][dotdrop.options._debug_attr] -> backup: True
[DEBUG][dotdrop.options._debug_attr] -> banner: True
[DEBUG][dotdrop.options._debug_attr] -> check_version: False
[DEBUG][dotdrop.options._debug_attr] -> chmod_on_import: False
[DEBUG][dotdrop.options._debug_attr] -> clear_workdir: False
[DEBUG][dotdrop.options._debug_attr] -> cmd_compare: True
[DEBUG][dotdrop.options._debug_attr] -> cmd_detail: False
[DEBUG][dotdrop.options._debug_attr] -> cmd_files: False
[DEBUG][dotdrop.options._debug_attr] -> cmd_import: False
[DEBUG][dotdrop.options._debug_attr] -> cmd_install: False
[DEBUG][dotdrop.options._debug_attr] -> cmd_profiles: False
[DEBUG][dotdrop.options._debug_attr] -> cmd_remove: False
[DEBUG][dotdrop.options._debug_attr] -> cmd_update: False
[DEBUG][dotdrop.utils.debug_list] -> cmpignore:
[DEBUG][dotdrop.options._debug_attr] -> compare_fileonly: False
[DEBUG][dotdrop.utils.debug_list] -> compare_focus:
[DEBUG][dotdrop.utils.debug_list] -> compare_ignore:
[DEBUG][dotdrop.utils.debug_list]   - *.dotdropbak
[DEBUG][dotdrop.options._debug_attr] -> compare_workdir: False
[DEBUG][dotdrop.options._debug_attr] -> conf: <dotdrop.cfg_aggregator.CfgAggregator object at 0x7f558dbf3a50>
[DEBUG][dotdrop.options._debug_attr] -> confpath: /tmp/dottest/config.yaml
[DEBUG][dotdrop.options._debug_attr] -> create: True
[DEBUG][dotdrop.options._debug_attr] -> debug: True
[DEBUG][dotdrop.utils.debug_list] -> default_actions:
[DEBUG][dotdrop.utils.debug_list] -> detail_keys:
[DEBUG][dotdrop.options._debug_attr] -> diff_command: diff -r -u {0} {1}
[DEBUG][dotdrop.utils.debug_list] -> dotfiles:
[DEBUG][dotdrop.utils.debug_list]   - key:"d_test", src:"/tmp/dottest/dotfiles/tmp/test", dst:"/tmp/test", link:"nolink", template:True
[DEBUG][dotdrop.options._debug_attr] -> dotpath: /tmp/dottest/dotfiles
[DEBUG][dotdrop.options._debug_attr] -> dry: False
[DEBUG][dotdrop.options._debug_attr] -> files_grepable: False
[DEBUG][dotdrop.options._debug_attr] -> files_templateonly: False
[DEBUG][dotdrop.utils.debug_list] -> filter_file:
[DEBUG][dotdrop.options._debug_attr] -> force_chmod: False
[DEBUG][dotdrop.utils.debug_list] -> func_file:
[DEBUG][dotdrop.options._debug_attr] -> ignore_missing_in_dotdrop: False
[DEBUG][dotdrop.options._debug_attr] -> ignoreempty: False
[DEBUG][dotdrop.utils.debug_list] -> impignore:
[DEBUG][dotdrop.utils.debug_list] -> import_actions:
[DEBUG][dotdrop.options._debug_attr] -> import_as: None
[DEBUG][dotdrop.utils.debug_list] -> import_configs:
[DEBUG][dotdrop.utils.debug_list] -> import_ignore:
[DEBUG][dotdrop.utils.debug_list]   - *.dotdropbak
[DEBUG][dotdrop.options._debug_attr] -> import_link: nolink
[DEBUG][dotdrop.options._debug_attr] -> import_mode: False
[DEBUG][dotdrop.utils.debug_list] -> import_path:
[DEBUG][dotdrop.options._debug_attr] -> import_transr: None
[DEBUG][dotdrop.options._debug_attr] -> import_transw: None
[DEBUG][dotdrop.utils.debug_list] -> import_variables:
[DEBUG][dotdrop.options._debug_attr] -> install_backup_suffix: .dotdropbak
[DEBUG][dotdrop.options._debug_attr] -> install_clear_workdir: False
[DEBUG][dotdrop.utils.debug_list] -> install_default_actions_post:
[DEBUG][dotdrop.utils.debug_list] -> install_default_actions_pre:
[DEBUG][dotdrop.options._debug_attr] -> install_diff: True
[DEBUG][dotdrop.options._debug_attr] -> install_force_action: False
[DEBUG][dotdrop.options._debug_attr] -> install_force_chmod: False
[DEBUG][dotdrop.utils.debug_list] -> install_ignore:
[DEBUG][dotdrop.utils.debug_list] -> install_keys:
[DEBUG][dotdrop.options._debug_attr] -> install_showdiff: False
[DEBUG][dotdrop.options._debug_attr] -> install_temporary: False
[DEBUG][dotdrop.utils.debug_list] -> instignore:
[DEBUG][dotdrop.options._debug_attr] -> keepdot: False
[DEBUG][dotdrop.options._debug_attr] -> key_prefix: True
[DEBUG][dotdrop.options._debug_attr] -> key_separator: _
[DEBUG][dotdrop.options._debug_attr] -> link_dotfile_default: nolink
[DEBUG][dotdrop.options._debug_attr] -> link_on_import: nolink
[DEBUG][dotdrop.options._debug_attr] -> log: <dotdrop.logger.Logger object at 0x7f558c857e10>
[DEBUG][dotdrop.options._debug_attr] -> longkey: False
[DEBUG][dotdrop.options._debug_attr] -> minversion: None
[DEBUG][dotdrop.options._debug_attr] -> profile: zenithia
[DEBUG][dotdrop.utils.debug_list] -> profiles:
[DEBUG][dotdrop.utils.debug_list]   - key:"zenithia"
[DEBUG][dotdrop.options._debug_attr] -> profiles_grepable: False
[DEBUG][dotdrop.options._debug_attr] -> remove_iskey: False
[DEBUG][dotdrop.utils.debug_list] -> remove_path:
[DEBUG][dotdrop.options._debug_attr] -> safe: True
[DEBUG][dotdrop.options._debug_attr] -> showdiff: False
[DEBUG][dotdrop.options._debug_attr] -> template_dotfile_default: True
[DEBUG][dotdrop.utils.debug_list] -> update_ignore:
[DEBUG][dotdrop.utils.debug_list]   - *.dotdropbak
[DEBUG][dotdrop.options._debug_attr] -> update_iskey: False
[DEBUG][dotdrop.utils.debug_list] -> update_path:
[DEBUG][dotdrop.options._debug_attr] -> update_showpatch: False
[DEBUG][dotdrop.utils.debug_list] -> upignore:
[DEBUG][dotdrop.utils.debug_dict] -> variables:
[DEBUG][dotdrop.utils.debug_dict]   - "profile": zenithia
[DEBUG][dotdrop.utils.debug_dict]   - "_dotdrop_dotpath": /tmp/dottest/dotfiles
[DEBUG][dotdrop.utils.debug_dict]   - "_dotdrop_cfgpath": /tmp/dottest/config.yaml
[DEBUG][dotdrop.utils.debug_dict]   - "_dotdrop_workdir": /home/flavio/.config/dotdrop
[DEBUG][dotdrop.utils.debug_dict]   - "os": linux
[DEBUG][dotdrop.utils.debug_dict]   - "release": 6.1.0-10-amd64
[DEBUG][dotdrop.utils.debug_dict]   - "distro_id": debian
[DEBUG][dotdrop.utils.debug_dict]   - "distro_version": 12
[DEBUG][dotdrop.utils.debug_dict]   - "distro_like": 
[DEBUG][dotdrop.options._debug_attr] -> workdir: /home/flavio/.config/dotdrop
[DEBUG][dotdrop.options._debug_attr] -> workers: 1
[DEBUG][__main__.main] 

[DEBUG][__main__._exec_command] running cmd: compare
[DEBUG][dotdrop.templategen.__init__] loading templategen
[DEBUG][dotdrop.templategen.__init__] load global functions:
[DEBUG][dotdrop.templategen._load_funcs_to_dic] load function "basename"
[DEBUG][dotdrop.templategen._load_funcs_to_dic] load function "dirname"
[DEBUG][dotdrop.templategen._load_funcs_to_dic] load function "exists"
[DEBUG][dotdrop.templategen._load_funcs_to_dic] load function "exists_in_path"
[DEBUG][dotdrop.templategen._debug_dict] template additional variables:
[DEBUG][dotdrop.templategen._debug_dict]   - "profile": zenithia
[DEBUG][dotdrop.templategen._debug_dict]   - "_dotdrop_dotpath": /tmp/dottest/dotfiles
[DEBUG][dotdrop.templategen._debug_dict]   - "_dotdrop_cfgpath": /tmp/dottest/config.yaml
[DEBUG][dotdrop.templategen._debug_dict]   - "_dotdrop_workdir": /home/flavio/.config/dotdrop
[DEBUG][dotdrop.templategen._debug_dict]   - "os": linux
[DEBUG][dotdrop.templategen._debug_dict]   - "release": 6.1.0-10-amd64
[DEBUG][dotdrop.templategen._debug_dict]   - "distro_id": debian
[DEBUG][dotdrop.templategen._debug_dict]   - "distro_version": 12
[DEBUG][dotdrop.templategen._debug_dict]   - "distro_like": 
[DEBUG][__main__._dotfile_compare] comparing key:"d_test", src:"/tmp/dottest/dotfiles/tmp/test", dst:"/tmp/test", link:"nolink", template:True
[DEBUG][dotdrop.utils.ignores_to_absolute] ignores before patching: ['ignoreme', '*.dotdropbak']
[DEBUG][dotdrop.utils.ignores_to_absolute] ignores after patching: ['/tmp/test/ignoreme', '/tmp/dottest/dotfiles/tmp/test/ignoreme', '*.dotdropbak']
[DEBUG][dotdrop.templategen.path_is_template] is NOT template: "/tmp/dottest/dotfiles/tmp/test"
[DEBUG][dotdrop.comparator.compare] comparing "/tmp/dottest/dotfiles/tmp/test" and "/tmp/test"
[DEBUG][dotdrop.comparator.compare] ignore pattern(s): ['/tmp/test/ignoreme', '/tmp/dottest/dotfiles/tmp/test/ignoreme', '*.dotdropbak']
[DEBUG][dotdrop.comparator.compare] "/tmp/dottest/dotfiles/tmp/test" is a directory
[DEBUG][dotdrop.comparator._comp_dir] compare directory /tmp/dottest/dotfiles/tmp/test with /tmp/test
[DEBUG][dotdrop.utils.must_ignore] must ignore? "['/tmp/dottest/dotfiles/tmp/test', '/tmp/test']" against ['/tmp/test/ignoreme', '/tmp/dottest/dotfiles/tmp/test/ignoreme', '*.dotdropbak']
[DEBUG][dotdrop.utils.must_ignore] NOT ignoring "['/tmp/dottest/dotfiles/tmp/test', '/tmp/test']"
[DEBUG][dotdrop.comparator._compare_dirs] compare /tmp/dottest/dotfiles/tmp/test and /tmp/test
[DEBUG][dotdrop.comparator._compare_dirs] files only in deployed dir: []
[DEBUG][dotdrop.comparator._compare_dirs] files only in dotpath dir: ['ignoreme']
[DEBUG][dotdrop.utils.must_ignore] must ignore? "['/tmp/test/ignoreme']" against ['/tmp/test/ignoreme', '/tmp/dottest/dotfiles/tmp/test/ignoreme', '*.dotdropbak']
[DEBUG][dotdrop.utils._must_ignore] ignore would have match but neg ignores present and is a dir: "/tmp/test/ignoreme" -> not ignored!
[DEBUG][dotdrop.utils.must_ignore] NOT ignoring "['/tmp/test/ignoreme']"
[DEBUG][dotdrop.comparator._compare_dirs] files with different types: []
[DEBUG][dotdrop.comparator._compare_dirs] files with different content: []
[DEBUG][__main__.main] done executing command "compare"
[DEBUG][__main__.main] options loaded in 0.7968142032623291
[DEBUG][__main__.main] command executed in 0.08138823509216309
[DEBUG][__main__.main] return False
     _       _      _
  __| | ___ | |_ __| |_ __ ___  _ __
 / _` |/ _ \| __/ _` | '__/ _ \| '_ |
 \__,_|\___/ \__\__,_|_|  \___/| .__/  v1.13.2
                               |_|

=> compare d_test: diffing with "/tmp/test"
=> "ignoreme" does not exist in dotdrop

1 dotfile(s) compared.
deadc0de6 commented 11 months ago

Thanks for reporting this. Can you try with the following config:

dotfiles:
  d_test:
    src: tmp/test
    dst: /tmp/test
    cmpignore:
    - '*/ignoreme'
    upignore:
    - '*/ignoreme'
flavio-a commented 11 months ago

Sorry for the late response.

I tried the config with '*/ignoreme' and it produces the same (wrong) behaviour.

deadc0de6 commented 11 months ago

I was able to reproduce the bug with the cmpignore, I'm working on a fix in https://github.com/deadc0de6/dotdrop/pull/408.

Analogously, if you add upignore and run dotdrop.sh import it copies ignoreme into dotfiles/test.

upignore is meant for update and not import. Since you're removing ignoreme in the dotpath, when import is run, that directory still exists in /tmp/test/ and thus would be imported, that is the expected behavior.

deadc0de6 commented 11 months ago

I was able to reproduce the issue with import and impignore. It will be fixed in the same branch.

flavio-a commented 11 months ago

Tyvm. I really appreciate dotdrop and your work.

deadc0de6 commented 11 months ago

@flavio-a the fix is available in the master branch. Thanks again for your help on this :+1: