From 88090baaed8c5ee4c9732dd48189989839024aca Mon Sep 17 00:00:00 2001 From: Jon Bernard Date: Wed, 1 Jan 2014 10:25:06 -0500 Subject: Prevent adding toplevel package directories This change prevents users from adding toplevel package directories via the add operation in the cli. Until add is package-aware, allowing this behaviour can lead to loss of configuration files if the --force option is later used to sync. Adding packages already-defined packages will be possible in the future, but this patch is necessary to prevent users from reaching an invalid state. Re #20, #27 --- dotfiles/core.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dotfiles/core.py b/dotfiles/core.py index 3212939..078e9b6 100644 --- a/dotfiles/core.py +++ b/dotfiles/core.py @@ -232,6 +232,9 @@ class Dotfiles(object): else: home = self.homedir target = self._fqpn(file) + if action == 'add' and os.path.split(target)[1] in self.packages: + print("Skipping \"%s\", packages not yet supported" % file) + return if sub_dir.startswith('.') or file_name.startswith('.'): dotfile = Dotfile(file, target, home, dry_run=self.dry_run) getattr(dotfile, action)() -- cgit v1.2.3