Fixed an issue in GuiThemeDownloader where local changes could not be reset if there were no updates available

This commit is contained in:
Leon Styhre 2023-03-29 22:36:15 +02:00
parent b0cf51aa6b
commit c285ae7d63

View file

@ -263,6 +263,12 @@ bool GuiThemeDownloader::fetchRepository(const std::string& repositoryName,
} }
} }
if (allowReset && checkLocalChanges(repository)) {
LOG(LogInfo) << "Repository \"" << repositoryName
<< "\" contains local changes, performing hard reset";
resetRepository(repository);
}
if (mergeAnalysis & GIT_MERGE_ANALYSIS_UP_TO_DATE) { if (mergeAnalysis & GIT_MERGE_ANALYSIS_UP_TO_DATE) {
LOG(LogInfo) << "Repository \"" << repositoryName << "\" already up to date"; LOG(LogInfo) << "Repository \"" << repositoryName << "\" already up to date";
if (repositoryName != "themes-list") if (repositoryName != "themes-list")
@ -275,12 +281,6 @@ bool GuiThemeDownloader::fetchRepository(const std::string& repositoryName,
return false; return false;
} }
if (allowReset && checkLocalChanges(repository)) {
LOG(LogInfo) << "Repository \"" << repositoryName
<< "\" contains local changes, performing hard reset";
resetRepository(repository);
}
LOG(LogInfo) << "Performing Git fast-forward of repository \"" << repositoryName << "\""; LOG(LogInfo) << "Performing Git fast-forward of repository \"" << repositoryName << "\"";
git_reference* oldTargetRef {nullptr}; git_reference* oldTargetRef {nullptr};