mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-24 22:48:23 -05:00
dbhub: Fix 1af81359a9
Fix bug in 1af81359a9 which could show you
the override database warning when not actually downloading a database.
This commit is contained in:
+18
-18
@@ -522,26 +522,26 @@ void RemoteDatabase::fetch(const QUrl& url, RequestType type, const QString& cli
|
||||
emit openFile(exists);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we already have a clone of this database branch. If so, show a warning because there might
|
||||
// be unpushed changes. For this we don't care about the currently checked out commit id because for
|
||||
// any commit local changes could be lost.
|
||||
// TODO Detect local changes and don't warn when no changes were made
|
||||
QUrl url_without_commit_id(url);
|
||||
QUrlQuery url_without_commit_id_query(url_without_commit_id);
|
||||
url_without_commit_id_query.removeQueryItem("commit");
|
||||
url_without_commit_id.setQuery(url_without_commit_id_query);
|
||||
if(!localExists(url_without_commit_id, clientCert, QUrlQuery(url).queryItemValue("branch").toStdString()).isEmpty())
|
||||
{
|
||||
if(QMessageBox::warning(nullptr,
|
||||
QApplication::applicationName(),
|
||||
tr("Fetching this commit might override local changes when you have not pushed them yet.\n"
|
||||
"Are you sure you want to fetch it?"),
|
||||
QMessageBox::Yes | QMessageBox::Cancel,
|
||||
QMessageBox::Cancel) == QMessageBox::Cancel)
|
||||
// Check if we already have a clone of this database branch. If so, show a warning because there might
|
||||
// be unpushed changes. For this we don't care about the currently checked out commit id because for
|
||||
// any commit local changes could be lost.
|
||||
// TODO Detect local changes and don't warn when no changes were made
|
||||
QUrl url_without_commit_id(url);
|
||||
QUrlQuery url_without_commit_id_query(url_without_commit_id);
|
||||
url_without_commit_id_query.removeQueryItem("commit");
|
||||
url_without_commit_id.setQuery(url_without_commit_id_query);
|
||||
if(!localExists(url_without_commit_id, clientCert, QUrlQuery(url).queryItemValue("branch").toStdString()).isEmpty())
|
||||
{
|
||||
return;
|
||||
if(QMessageBox::warning(nullptr,
|
||||
QApplication::applicationName(),
|
||||
tr("Fetching this commit might override local changes when you have not pushed them yet.\n"
|
||||
"Are you sure you want to fetch it?"),
|
||||
QMessageBox::Yes | QMessageBox::Cancel,
|
||||
QMessageBox::Cancel) == QMessageBox::Cancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user