diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-13 09:12:16 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-13 09:14:48 -0700 |
commit | abde615c1c3f64bed1d492a1f5f878fd890b111c (patch) | |
tree | 1233637ac1e6dc70b6516a62056a40a3c1320eb1 | |
parent | 3ad517d87a63c287981e4f857ed826507cee041d (diff) | |
download | subsurface-abde615c1c3f64bed1d492a1f5f878fd890b111c.tar.gz |
Cloud storage: give user friendly error messages
Instead of showing the git URL and talking about failures to clone
repositories, simply tell the user what's happening with the cloud
storage.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | git-access.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/git-access.c b/git-access.c index c37360075..60e369bfb 100644 --- a/git-access.c +++ b/git-access.c @@ -15,6 +15,7 @@ #include "strndup.h" #include "qthelperfromc.h" #include "git-access.h" +#include "gettext.h" /* * The libgit2 people are incompetent at making libraries. They randomly change @@ -293,7 +294,18 @@ static git_repository *create_local_repo(const char *localdir, const char *remot return 0; error = git_clone(&cloned_repo, remote, localdir, &opts); if (error) { - report_error("git clone of %s failed (%s)", remote, giterr_last()->message); + char *msg = giterr_last()->message; + 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)) { + report_error(translate("gettextFromC", "Subsurface cloud storage is empty")); + } else if (strstr(remote, "https://cloud.subsurface-divelog.org/git")) { + report_error(translate("gettextFromC", "Error connecting to Subsurface cloud storage")); + } else { + report_error(translate("gettextFromC", "git clone of %s failed (%s)"), remote, msg); + } + free(pattern); return NULL; } return cloned_repo; |