diff options
| author | Georgios Kokolatos | 2023-01-12 10:37:05 +0000 |
|---|---|---|
| committer | Magnus Hagander | 2023-01-15 19:06:21 +0000 |
| commit | c88b5e6205f9a348b66310619136eea8534b722a (patch) | |
| tree | 74469e93860946b77384fa5e5ad24a0d7c500724 /tools | |
| parent | 6db78f794d28a4f5485124fb40c8b24d89a8a954 (diff) | |
Protect against erasing a version controlled directory
deploystatic.py will erase the unknown files in destpath. It is a wanted
feature which when used carelessly can lead to disaster. While one can not
protect from all disaster cases, a low hanging fruit is figuring out if destpath
is source controlled.
This is admittedly a minor gain, however it also minor to check.
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/deploystatic/deploystatic.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/deploystatic/deploystatic.py b/tools/deploystatic/deploystatic.py index 557f7f02..31654654 100755 --- a/tools/deploystatic/deploystatic.py +++ b/tools/deploystatic/deploystatic.py @@ -314,6 +314,10 @@ if __name__ == "__main__": print("Destination directory does not exist!") sys.exit(1) + if os.path.exists(os.path.join(args.destpath, '.git')): + print("Destination directory seems to be version controlled!") + sys.exit(1) + if args.branch: s = subprocess.Popen(['/usr/bin/git', 'archive', '--format=tar', args.branch], stdout=subprocess.PIPE, |
