From d6694f9653c0bb181586ee4e30018e3577e50c38 Mon Sep 17 00:00:00 2001 From: "E. Keys" Date: Sat, 21 Nov 2020 10:00:37 -0500 Subject: [PATCH] link.py: globbing keep leading '.' - Updated plugins/link.py so that globbing will not strip leading '.' when creating link names. - Corrected test collection output in test/link-glob-multi-start Fixes #244 --- dotbot/plugins/link.py | 2 ++ test/tests/link-glob-multi-star.bash | 2 +- test/tests/link-glob.bash | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/dotbot/plugins/link.py b/dotbot/plugins/link.py index 6f2b562..5c30823 100644 --- a/dotbot/plugins/link.py +++ b/dotbot/plugins/link.py @@ -76,6 +76,8 @@ class Link(dotbot.Plugin): else: self._log.lowinfo("Globs from '" + path + "': " + str(glob_results)) glob_base = path[:glob_star_loc] + if glob_base.endswith('/.'): + glob_base = path[:glob_star_loc - 1] for glob_full_item in glob_results: glob_item = glob_full_item[len(glob_base):] glob_link_destination = os.path.join(destination, glob_item) diff --git a/test/tests/link-glob-multi-star.bash b/test/tests/link-glob-multi-star.bash index 11ae740..3a2ca71 100644 --- a/test/tests/link-glob-multi-star.bash +++ b/test/tests/link-glob-multi-star.bash @@ -1,4 +1,4 @@ -test_description='link glob' +test_description='link glob multi star' . '../test-lib.bash' test_expect_success 'setup' ' diff --git a/test/tests/link-glob.bash b/test/tests/link-glob.bash index f1c813d..ae09df4 100644 --- a/test/tests/link-glob.bash +++ b/test/tests/link-glob.bash @@ -45,3 +45,27 @@ grep "apple" ~/bin/a && grep "banana" ~/bin/b && grep "cherry" ~/bin/c ' + +test_expect_success 'setup 3' ' +rm -rf ~/bin && +echo "dot_apple" > ${DOTFILES}/bin/.a && +echo "dot_banana" > ${DOTFILES}/bin/.b && +echo "dot_cherry" > ${DOTFILES}/bin/.c +' + +test_expect_success 'run 3' ' +run_dotbot -v <