mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-15 22:00:05 +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)
|
ret = fnmatch.fnmatch(subpath, pattern)
|
||||||
if ret:
|
if ret:
|
||||||
if debug:
|
if debug:
|
||||||
LOG.dbg(f'ignore \"{pattern}\" match: {subpath} from {path}',
|
LOG.dbg(f'ignore \"{pattern}\" match: {subpath} ({path})',
|
||||||
force=True)
|
force=True)
|
||||||
return ret
|
return ret
|
||||||
subpath = os.path.dirname(subpath)
|
subpath = os.path.dirname(subpath)
|
||||||
@@ -322,17 +322,17 @@ def must_ignore(paths, ignores, debug=False):
|
|||||||
if not ignores:
|
if not ignores:
|
||||||
return False
|
return False
|
||||||
if debug:
|
if debug:
|
||||||
LOG.dbg(f'IGNORE? \"{paths}\" against {ignores}',
|
LOG.dbg(f'[IGN] IGNORE? \"{paths}\" against {ignores}',
|
||||||
force=True)
|
force=True)
|
||||||
nign, ign = categorize(
|
nign, ign = categorize(
|
||||||
lambda ign: ign.startswith('!'), ignores)
|
lambda ign: ign.startswith('!'), ignores)
|
||||||
for path in paths:
|
for path in paths:
|
||||||
if _must_ignore(path, ign, nign, debug=debug):
|
if _must_ignore(path, ign, nign, debug=debug):
|
||||||
if debug:
|
if debug:
|
||||||
LOG.dbg(f'IGNORING \"{paths}\"', force=True)
|
LOG.dbg(f'[IGN] IGNORING \"{paths}\"', force=True)
|
||||||
return True
|
return True
|
||||||
if debug:
|
if debug:
|
||||||
LOG.dbg(f'NOT IGNORING \"{paths}\"', force=True)
|
LOG.dbg(f'[IGN] NOT IGNORING \"{paths}\"', force=True)
|
||||||
return False
|
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
|
create_in_dst
|
||||||
|
|
||||||
cd "${ddpath}" | ${bin} import -f -c "${cfg3}" -p p1 -V "${tmpd}/mpv"
|
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
|
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepme" ] && echo "import (cfg3) 1 failed" && exit 1
|
||||||
[ ! -d "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo" ] && echo "import (cfg3) 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) 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) 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) failed" && exit 1
|
[ -e "${dotpath}/${tmpd}/mpv/watch_later/watch_later_file" ] && echo "import (cfg3) 5 failed" && exit 1
|
||||||
|
|
||||||
clean_both
|
clean_both
|
||||||
create_in_dst
|
create_in_dst
|
||||||
|
|
||||||
cd "${ddpath}" | ${bin} import -f -c "${cfg4}" -p p1 -V "${tmpd}/mpv"
|
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
|
[ ! -e "${dotpath}/${tmpd}/mpv/watch_later/keepme" ] && echo "import (cfg4) 1 failed" && exit 1
|
||||||
[ ! -d "${dotpath}/${tmpd}/mpv/watch_later/keepmetoo" ] && echo "import (cfg4) 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) 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) 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) failed" && exit 1
|
[ -e "${dotpath}/${tmpd}/mpv/watch_later/watch_later_file" ] && echo "import (cfg4) 5 failed" && exit 1
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
# test compare
|
# test compare
|
||||||
|
|||||||
Reference in New Issue
Block a user