diff --git a/docs/config/config-dotfiles.md b/docs/config/config-dotfiles.md index cad385e..1db9e45 100644 --- a/docs/config/config-dotfiles.md +++ b/docs/config/config-dotfiles.md @@ -236,8 +236,7 @@ dotfiles: - "*otherdir*" ``` -When this option is enabled: -- During **install** operations, any directory matching a pattern in `dir_as_block` will be replaced as a whole, rather than updating individual files -- This option has **no effect** on **compare** operations, which will always show file-by-file differences - -This option defaults to an empty list and can be set on any dotfile that represents a directory. It has no effect on dotfiles that are regular files. \ No newline at end of file +Note: +- During **install** operations, any directory matching a pattern in `dir_as_block` will be replaced as a whole +- This option has no effect on **compare** operations, which will always show file-by-file differences +- This option has no effect on dotfiles that are regular files \ No newline at end of file diff --git a/dotdrop/dotdrop.py b/dotdrop/dotdrop.py index 45cda4a..037f64b 100644 --- a/dotdrop/dotdrop.py +++ b/dotdrop/dotdrop.py @@ -232,9 +232,6 @@ def _dotfile_install(opts, dotfile, tmpdir=None): LinkTypes.RELATIVE, LinkTypes.ABSOLUTE ): # nolink|relative|absolute|link_children - asblock = False - if hasattr(dotfile, 'dir_as_block'): - asblock = True ret, err = inst.install( templ, dotfile.src, @@ -244,7 +241,7 @@ def _dotfile_install(opts, dotfile, tmpdir=None): is_template=is_template, ignore=ignores, chmod=dotfile.chmod, - dir_as_block=asblock, + dir_as_block=dotfile.dir_as_block, ) else: # nolink @@ -258,9 +255,6 @@ def _dotfile_install(opts, dotfile, tmpdir=None): src = tmp # make sure to re-evaluate if is template is_template = dotfile.template and Templategen.path_is_template(src) - asblock = False - if hasattr(dotfile, "dir_as_block"): - asblock = True ret, err = inst.install( templ, src, @@ -271,7 +265,7 @@ def _dotfile_install(opts, dotfile, tmpdir=None): ignore=ignores, is_template=is_template, chmod=dotfile.chmod, - dir_as_block=asblock, + dir_as_block=dotfile.dir_as_block, ) if tmp: tmp = os.path.join(opts.dotpath, tmp) diff --git a/dotdrop/ftree.py b/dotdrop/ftree.py index c1dd66d..d911899 100644 --- a/dotdrop/ftree.py +++ b/dotdrop/ftree.py @@ -7,7 +7,6 @@ filesystem tree for directories import os -import fnmatch # local imports from dotdrop.utils import must_ignore, dir_empty @@ -19,11 +18,11 @@ class FTreeDir: directory tree for comparison """ - def __init__(self, path, ignores=None, debug=False, dir_as_block=None): + def __init__(self, path, ignores=None, + debug=False): self.path = path self.ignores = ignores self.debug = debug - self.dir_as_block = dir_as_block or [] self.entries = [] self.log = Logger(debug=self.debug) if os.path.exists(path) and os.path.isdir(path): @@ -35,12 +34,6 @@ class FTreeDir: ignore empty directory test for ignore pattern """ - for pattern in self.dir_as_block: - if fnmatch.fnmatch(self.path, pattern): - self.log.dbg(f'dir_as_block match: {pattern} for {self.path}') - self.entries.append(self.path) - return - for root, dirs, files in os.walk(self.path, followlinks=True): for file in files: fpath = os.path.join(root, file)