GN tools: copy_git_directory.py better error message.

No-Try: true
Change-Id: Ifd92c47ae1beaaa53430e6fa8e658a795a398b55
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255299
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
Hal Canary 2019-11-19 11:58:13 -05:00 committed by Skia Commit-Bot
parent d667e61cfb
commit 22814dbf6b

View File

@ -17,7 +17,8 @@ def copy_git_directory(src, dst, out=None):
not tracked by git. Also, if out is not None, write summary of actions to out.
If `dst` is a top-level git directory, the `.git` directory will be removed.
'''
assert os.path.isdir(src)
if not os.path.isdir(src):
raise Exception('Directory "%s" does not exist.' % src)
if not os.path.isdir(dst):
os.makedirs(dst)
ls_files = subprocess.check_output(['git', 'ls-files', '-z', '.'], cwd=src)