mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-04 15:39:43 +00:00
refactoring
This commit is contained in:
@@ -239,7 +239,7 @@ def _match_ignore_pattern(path, pattern, debug=False):
|
||||
ret = fnmatch.fnmatch(subpath, pattern)
|
||||
if ret:
|
||||
if debug:
|
||||
LOG.dbg(f'ignore \"{pattern}\" match: {subpath} from {path}',
|
||||
LOG.dbg(f'ignore \"{pattern}\" match: {subpath} ({path})',
|
||||
force=True)
|
||||
return ret
|
||||
subpath = os.path.dirname(subpath)
|
||||
@@ -322,17 +322,17 @@ def must_ignore(paths, ignores, debug=False):
|
||||
if not ignores:
|
||||
return False
|
||||
if debug:
|
||||
LOG.dbg(f'IGNORE? \"{paths}\" against {ignores}',
|
||||
LOG.dbg(f'[IGN] IGNORE? \"{paths}\" against {ignores}',
|
||||
force=True)
|
||||
nign, ign = categorize(
|
||||
lambda ign: ign.startswith('!'), ignores)
|
||||
for path in paths:
|
||||
if _must_ignore(path, ign, nign, debug=debug):
|
||||
if debug:
|
||||
LOG.dbg(f'IGNORING \"{paths}\"', force=True)
|
||||
LOG.dbg(f'[IGN] IGNORING \"{paths}\"', force=True)
|
||||
return True
|
||||
if debug:
|
||||
LOG.dbg(f'NOT IGNORING \"{paths}\"', force=True)
|
||||
LOG.dbg(f'[IGN] NOT IGNORING \"{paths}\"', force=True)
|
||||
return False
|
||||
|
||||
|
||||
|
||||
20
tests-ng/ignore-patterns-negative.sh
vendored
20
tests-ng/ignore-patterns-negative.sh
vendored
@@ -227,21 +227,21 @@ clean_both
|
||||
create_in_dst
|
||||
|
||||
cd "${ddpath}" | ${bin} import -f -c "${cfg3}" -p p1 -V "${tmpd}/mpv"
|
||||
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepme" ] && echo "import (cfg3) failed" && exit 1
|
||||
[ ! -d "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo" ] && echo "import (cfg3) failed" && exit 1
|
||||
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo/keepmetoo" ] && echo "import (cfg3) failed" && exit 1
|
||||
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepmeaswell/keepmeaswell" ] && echo "import (cfg3) failed" && exit 1
|
||||
[ -e "${dotpath}/${tmpd}/mpv/watch_later/watch_later_file" ] && echo "import (cfg3) failed" && exit 1
|
||||
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepme" ] && echo "import (cfg3) 1 failed" && exit 1
|
||||
[ ! -d "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo" ] && echo "import (cfg3) 2 failed" && exit 1
|
||||
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo/keepmetoo" ] && echo "import (cfg3) 3 failed" && exit 1
|
||||
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepmeaswell/keepmeaswell" ] && echo "import (cfg3) 4 failed" && exit 1
|
||||
[ -e "${dotpath}/${tmpd}/mpv/watch_later/watch_later_file" ] && echo "import (cfg3) 5 failed" && exit 1
|
||||
|
||||
clean_both
|
||||
create_in_dst
|
||||
|
||||
cd "${ddpath}" | ${bin} import -f -c "${cfg4}" -p p1 -V "${tmpd}/mpv"
|
||||
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepme" ] && echo "import (cfg4) failed" && exit 1
|
||||
[ ! -d "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo" ] && echo "import (cfg4) failed" && exit 1
|
||||
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo/keepmetoo" ] && echo "import (cfg4) failed" && exit 1
|
||||
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepmeaswell/keepmeaswell" ] && echo "import (cfg4) failed" && exit 1
|
||||
[ -e "${dotpath}/${tmpd}/mpv/watch_later/watch_later_file" ] && echo "import (cfg4) failed" && exit 1
|
||||
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepme" ] && echo "import (cfg4) 1 failed" && exit 1
|
||||
[ ! -d "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo" ] && echo "import (cfg4) 2 failed" && exit 1
|
||||
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo/keepmetoo" ] && echo "import (cfg4) 3 failed" && exit 1
|
||||
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepmeaswell/keepmeaswell" ] && echo "import (cfg4) 4 failed" && exit 1
|
||||
[ -e "${dotpath}/${tmpd}/mpv/watch_later/watch_later_file" ] && echo "import (cfg4) 5 failed" && exit 1
|
||||
|
||||
###################################################
|
||||
# test compare
|
||||
|
||||
Reference in New Issue
Block a user