Always clean files manually instead of using git

I see a couple problems with using git to determine the files to delete:
- git needs to be installed
- The manual cleaning code is supposed to function correctly, so why not always use it? That way bugs in the manual cleaning code are also more likely to get discovered
- If some files ignored by git should not be deleted, they need to be added to a sort of blacklist. If some files should be deleted by the manual cleanup code, they need to be added to a sort of whitelist. If someone forgets to add files to one of these lists, then not deleting files that should be deleted is better than deleting files that should not be deleted.
This commit is contained in:
Luflosi 2019-06-23 17:05:18 +02:00
parent 3ce68ed53f
commit 0e1a423889
No known key found for this signature in database
GPG Key ID: 14140F703B7D8362

View File

@ -780,17 +780,6 @@ Categories=System;TerminalEmulator;
def clean():
os.chdir(os.path.dirname(os.path.abspath(__file__)))
if os.path.exists('.git'):
for f in subprocess.check_output(
'git ls-files --others --ignored --exclude-from=.gitignore'.split()
).decode('utf-8').splitlines():
if f.startswith('logo/kitty.iconset') or f.startswith('dev/'):
continue
os.unlink(f)
if os.sep in f and not os.listdir(os.path.dirname(f)):
os.rmdir(os.path.dirname(f))
return
# Not a git checkout, clean manually
def safe_remove(*entries):
for x in entries: