Don't force loopy local symlinks if we've already linked a parent.
authorW. Trevor King <wking@tremily.us>
Thu, 27 Sep 2012 13:02:22 +0000 (09:02 -0400)
committerW. Trevor King <wking@tremily.us>
Thu, 27 Sep 2012 13:02:22 +0000 (09:02 -0400)
This avoids things like:

  .emacs.d/site-lisp -> .../patched-src/.emacs.d/site-lisp
  .emacs.d/site-lisp/querty.el -> querty.el

which is an endless, self-referential loop for querty.el.

dotfiles.sh

index 907fbe2ffe82c587891c887be2b3b7459e79ff19..54ce7a324e3c79c12750dd56155ceb71bed1afd4 100755 (executable)
@@ -592,6 +592,9 @@ function link()
                        if [ "${FORCE_LINK}" = 'no' ]; then
                                # don't prompt about --force-link, because this will happen a lot
                                continue  # already simlinked
+                       elif [ ! -h "${TARGET}/${FILE}" ]; then
+                               # target file/dir underneath an already symlinked dir
+                               continue
                        else
                                # don't backup links that already point to the right place
                                BACKUP='no'