diff --git a/dotdrop/updater.py b/dotdrop/updater.py index 6c51137..f585df9 100644 --- a/dotdrop/updater.py +++ b/dotdrop/updater.py @@ -273,6 +273,7 @@ class Updater: ignore_missing_in_dotdrop, ignores): """create dirs that don't exist in dotdrop""" + self.log.dbg(f'_merge_dirs_create_left_only: {diff.left_only}') for toadd in diff.left_only: exist = os.path.join(left, toadd) if not os.path.isdir(exist): @@ -315,6 +316,7 @@ class Updater: ignore_missing_in_dotdrop, ignores): """remove dirs that don't exist in deployed version""" + self.log.dbg(f'_merge_dirs_remove_right_only: {diff.right_only}') for toremove in diff.right_only: old = os.path.join(right, toremove) if not os.path.isdir(old): @@ -333,6 +335,7 @@ class Updater: # handle files diff # sync files that exist in both but are different + self.log.dbg(f'_merge_dirs_remove_right_only: {diff.diff_files}') fdiff = diff.diff_files fdiff.extend(diff.funny_files) fdiff.extend(diff.common_funny) @@ -354,6 +357,7 @@ class Updater: ignore_missing_in_dotdrop, ignores): """copy files that don't exist in dotdrop""" + self.log.dbg(f'_merge_dirs_copy_left_only: {diff.left_only}') for toadd in diff.left_only: exist = os.path.join(left, toadd) if os.path.isdir(exist): @@ -379,6 +383,7 @@ class Updater: def _merge_dirs_remove_right_only_2(self, diff, right, ignores): """remove files that don't exist in deployed version""" + self.log.dbg(f'_merge_dirs_remove_right_only_2: {diff.right_only}') for toremove in diff.right_only: new = os.path.join(right, toremove) if not os.path.exists(new): diff --git a/tests-ng/update-negative-ignore-all-but.sh b/tests-ng/update-negative-ignore-all-but.sh index 73076d3..ae51a31 100755 --- a/tests-ng/update-negative-ignore-all-but.sh +++ b/tests-ng/update-negative-ignore-all-but.sh @@ -42,20 +42,20 @@ echo "[+] dst dir: ${tmpd}" # dotfiles in dotdrop mkdir -p "${basedir}"/dotfiles/a/{b,c,x} -echo 'a' > "${basedir}"/dotfiles/a/b/abfile1 -echo 'a' > "${basedir}"/dotfiles/a/b/abfile2 -echo 'a' > "${basedir}"/dotfiles/a/b/abfile3 -echo 'a' > "${basedir}"/dotfiles/a/c/acfile -echo 'a' > "${basedir}"/dotfiles/a/x/axfile +echo 'original' > "${basedir}"/dotfiles/a/b/abfile1 +echo 'original' > "${basedir}"/dotfiles/a/b/abfile2 +echo 'original' > "${basedir}"/dotfiles/a/b/abfile3 +echo 'original' > "${basedir}"/dotfiles/a/c/acfile +echo 'original' > "${basedir}"/dotfiles/a/x/axfile # filesystem mkdir -p "${tmpd}"/a/{b,c,d,x} -echo "b" > "${tmpd}/a/b/abfile1" -echo "b" > "${tmpd}/a/b/abfile2" -echo "b" > "${tmpd}/a/b/abfile3" -echo "b" > "${tmpd}/a/c/acfile" -echo "b" > "${tmpd}/a/d/adfile" -echo "b" > "${tmpd}/a/x/axfile" +echo "updated" > "${tmpd}/a/b/abfile1" +echo "updated" > "${tmpd}/a/b/abfile2" +echo "updated" > "${tmpd}/a/b/abfile3" +echo "updated" > "${tmpd}/a/c/acfile" +echo "updated" > "${tmpd}/a/d/adfile" +echo "updated" > "${tmpd}/a/x/axfile" clear_on_exit "${basedir}" clear_on_exit "${tmpd}" @@ -87,13 +87,13 @@ echo "[+] update" cd "${ddpath}" | ${bin} update -f -c "${cfg}" --verbose --profile=p1 --key d_abc # check files haven't been updated -grep_or_fail a "${basedir}"/dotfiles/a/b/abfile1 -grep_or_fail a "${basedir}"/dotfiles/a/b/abfile2 -grep_or_fail a "${basedir}"/dotfiles/a/b/abfile3 -grep_or_fail b "${basedir}"/dotfiles/a/c/acfile +grep_or_fail "original" "${basedir}"/dotfiles/a/b/abfile1 +grep_or_fail "original" "${basedir}"/dotfiles/a/b/abfile2 +grep_or_fail "original" "${basedir}"/dotfiles/a/b/abfile3 +grep_or_fail "updated" "${basedir}"/dotfiles/a/c/acfile [ ! -s "${basedir}"/dotfiles/a/d/adfile ] && echo "adfile not updated" && exit 1 -grep_or_fail b "${basedir}"/dotfiles/a/d/adfile -grep_or_fail a "${basedir}"/dotfiles/a/x/axfile +grep_or_fail "updated" "${basedir}"/dotfiles/a/d/adfile +grep_or_fail "original" "${basedir}"/dotfiles/a/x/axfile echo "OK" exit 0