now if repo's .git is damaged redownloads repo, but doesn't alter folder

master 3.7.2.6
idziubenko 2 years ago
parent 0bc12b3320
commit 9dfc73b8a1

@ -230,6 +230,8 @@ class Update(MethodsInterface):
status = git.getStatusInfo(rpath)
if not status or status['files']:
need_update = True
except GitError as e:
need_update = True
if need_update:
@ -431,8 +433,18 @@ class Update(MethodsInterface):
cb_progress=self.setProgress,
clean=check_status,
notask=fallback_sync)
removeDir(rpath)
shutil.move(rpath_new, rpath)
if not isinstance(e, NotGitError):
removeDir(rpath)
shutil.move(rpath_new, rpath)
else:
#delete everything in rpath dir, but not rpath itself
for root, dirs, files in os.walk(rpath):
for f in files:
os.unlink(os.path.join(root, f))
for d in dirs:
shutil.rmtree(os.path.join(root, d))
for i in os.listdir(rpath_new):
shutil.move(os.path.join(rpath_new, i), rpath)
except OSError as e:
raise UpdateError(_("Failed to modify the "
"{repname} repository").format(

Loading…
Cancel
Save