From 0493649db316f3749417f906f9c23a219c2a1776 Mon Sep 17 00:00:00 2001 From: Brian Daniels Date: Thu, 8 Dec 2016 17:42:52 -0600 Subject: [PATCH] Add 'info' folder to .git folder if missing. Before writing the exclude file for the imported git repos, mbed-cli now checks if the info folder is there. If it isn't it now creates it before writing the file. --- mbed/mbed.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mbed/mbed.py b/mbed/mbed.py index 157fbb33..761741c3 100644 --- a/mbed/mbed.py +++ b/mbed/mbed.py @@ -785,6 +785,10 @@ def revbranches(rev): def ignores(): try: + ignore_file_parent_directory = os.path.dirname(Git.ignore_file) + if not os.path.exists(ignore_file_parent_directory): + os.mkdir(ignore_file_parent_directory) + with open(Git.ignore_file, 'w') as f: f.write('\n'.join(ignores)+'\n') except IOError: @@ -799,6 +803,10 @@ def ignore(dest): if not exists: try: + ignore_file_parent_directory = os.path.dirname(Git.ignore_file) + if not os.path.exists(ignore_file_parent_directory): + os.mkdir(ignore_file_parent_directory) + with open(Git.ignore_file, 'a') as f: f.write(dest.replace("\\", "/") + '\n') except IOError: @@ -813,6 +821,10 @@ def unignore(dest): if dest in lines: lines.remove(dest) try: + ignore_file_parent_directory = os.path.dirname(Git.ignore_file) + if not os.path.exists(ignore_file_parent_directory): + os.mkdir(ignore_file_parent_directory) + with open(Git.ignore_file, 'w') as f: f.write('\n'.join(lines) + '\n') except IOError: