cloudstorage: some cleanup of cloud url handling

We know the preference is never empty, so stop testing for this. But
don't maintain two different preferences with basically the same
content. Instead add the '/git' suffix where needed and keep this all in
one place.

Simplify the extraction of the branch name from the cloud URL.

Also a typo fix and a new comment.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2021-04-10 17:40:30 -07:00
parent da6395a4a8
commit c5eb806adb
12 changed files with 14 additions and 41 deletions

View file

@ -31,7 +31,6 @@ void qPrefCloudStorage::set_cloud_base_url(const QString &value)
// only free and set if not default
if (prefs.cloud_base_url != default_prefs.cloud_base_url) {
qPrefPrivate::copy_txt(&prefs.cloud_base_url, value);
qPrefPrivate::copy_txt(&prefs.cloud_git_url, value + "/git");
}
disk_cloud_base_url(true);
@ -44,7 +43,6 @@ void qPrefCloudStorage::disk_cloud_base_url(bool doSync)
qPrefPrivate::propSetValue(keyFromGroupAndName(group, "cloud_base_url"), prefs.cloud_base_url, default_prefs.cloud_base_url);
} else {
prefs.cloud_base_url = copy_qstring(qPrefPrivate::propValue(keyFromGroupAndName(group, "cloud_base_url"), default_prefs.cloud_base_url).toString());
qPrefPrivate::copy_txt(&prefs.cloud_git_url, QString(prefs.cloud_base_url) + "/git");
}
}