From 2894165b9550f2a2dec5861f07b4785567fb984f Mon Sep 17 00:00:00 2001 From: Aaron Lichtman Date: Sat, 28 Mar 2020 21:29:11 -0500 Subject: [PATCH] Create dotfiles dir before creating .gitignore --- shallow_backup/__main__.py | 5 ++--- shallow_backup/git_wrapper.py | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/shallow_backup/__main__.py b/shallow_backup/__main__.py index 5c8c33c7..2c998b6a 100644 --- a/shallow_backup/__main__.py +++ b/shallow_backup/__main__.py @@ -3,9 +3,8 @@ from .prompts import * from .reinstall import * from .git_wrapper import * -from .utils import ( - mkdir_warn_overwrite, destroy_backup_dir, expand_to_abs_path, - new_dir_is_valid) +from .utils import (mkdir_warn_overwrite, destroy_backup_dir, + expand_to_abs_path, new_dir_is_valid) from .config import * from .upgrade import upgrade_from_pre_v3 diff --git a/shallow_backup/git_wrapper.py b/shallow_backup/git_wrapper.py index 663ce96e..4a91a828 100644 --- a/shallow_backup/git_wrapper.py +++ b/shallow_backup/git_wrapper.py @@ -4,6 +4,7 @@ from shutil import move from .printing import * from .config import get_config +from .utils import safe_mkdir ######### # GLOBALS @@ -44,6 +45,7 @@ def create_gitignore(dir_path, key): Handles backwards compatibility for the default-gitignore -> root-gitignore change and the introduction of the dotfiles-gitignore key in v4.0. """ + safe_mkdir(dir_path) gitignore_path = os.path.join(dir_path, ".gitignore") print_yellow_bold(f"Updating .gitignore file at {gitignore_path} with config from {key}") try: