Cloud storage: use preference member instead of hard coded strings

This creates the basis to allow other backends to be used with the cloud
storage infrastructure.

So far this should all just transparently continue to work. A user would
have to manually add the cloud_base_url entry to the CloudStorage section
in their config file in order to use a different backend server.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-06-15 06:05:00 -07:00
parent 617b105458
commit c593dea119
6 changed files with 12 additions and 13 deletions

View file

@ -374,12 +374,12 @@ static git_repository *create_local_repo(const char *localdir, const char *remot
int len = sizeof("Reference 'refs/remotes/origin/' not found" + strlen(branch));
char *pattern = malloc(len);
snprintf(pattern, len, "Reference 'refs/remotes/origin/%s' not found", branch);
if (strstr(remote, "https://cloud.subsurface-divelog.org/git") && strstr(msg, pattern)) {
if (strstr(remote, prefs.cloud_git_url) && strstr(msg, pattern)) {
/* we're trying to open the remote branch that corresponds
* to our cloud storage and the branch doesn't exist.
* So we need to create the branch and push it to the remote */
cloned_repo = create_and_push_remote(localdir, remote, branch);
} else if (strstr(remote, "https://cloud.subsurface-divelog.org/git")) {
} else if (strstr(remote, prefs.cloud_git_url)) {
report_error(translate("gettextFromC", "Error connecting to Subsurface cloud storage"));
} else {
report_error(translate("gettextFromC", "git clone of %s failed (%s)"), remote, msg);