summaryrefslogtreecommitdiffstats
path: root/git-access.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-13 09:12:16 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-13 09:14:48 -0700
commitabde615c1c3f64bed1d492a1f5f878fd890b111c (patch)
tree1233637ac1e6dc70b6516a62056a40a3c1320eb1 /git-access.c
parent3ad517d87a63c287981e4f857ed826507cee041d (diff)
downloadsubsurface-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>
Diffstat (limited to 'git-access.c')
-rw-r--r--git-access.c14
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;