mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-07 05:22:56 +00:00
[scripts/git-upload] Fix logic of --forbid-overwrite
This commit is contained in:
@@ -96,14 +96,14 @@ def do_copy(args):
|
||||
src = args.src
|
||||
dst = args.dst
|
||||
|
||||
try:
|
||||
if src.is_dir():
|
||||
shutil.copytree(src, dst)
|
||||
else:
|
||||
shutil.copy(src, dst)
|
||||
except FileExistsError:
|
||||
if args.forbid_overwrite:
|
||||
raise
|
||||
if args.forbid_overwrite and dst.exists():
|
||||
raise FileExistsError(f"File exists: '{dst}'")
|
||||
|
||||
if src.is_dir():
|
||||
shutil.rmtree(dst, ignore_errors=True)
|
||||
shutil.copytree(src, dst)
|
||||
else:
|
||||
shutil.copy(src, dst)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in New Issue
Block a user