diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2021-04-10 17:40:30 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-04-19 12:51:01 -0700 |
commit | c5eb806adb345e24b13ac4bf106cceb1dc9d3431 (patch) | |
tree | a071c9dede0640e23dd8032e6b1d0863d85b983e /core/file.c | |
parent | da6395a4a8b68978caf47f98b48a82fabbe1dd20 (diff) | |
download | subsurface-c5eb806adb345e24b13ac4bf106cceb1dc9d3431.tar.gz |
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>
Diffstat (limited to 'core/file.c')
-rw-r--r-- | core/file.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/core/file.c b/core/file.c index d1cbc3c62..e53d39f4d 100644 --- a/core/file.c +++ b/core/file.c @@ -284,9 +284,7 @@ int check_git_sha(const char *filename, struct git_repository **git_p, const cha *git_p = git; if (branch_p) *branch_p = branch; - if (prefs.cloud_git_url && - strstr(filename, prefs.cloud_git_url) - && git == dummy_git_repository) { + if (strstr(filename, prefs.cloud_base_url) && git == dummy_git_repository) { /* opening the cloud storage repository failed for some reason, * so we don't know if there is additional data in the remote */ free(current_sha); @@ -317,13 +315,11 @@ int parse_file(const char *filename, struct dive_table *table, struct trip_table int ret; git = is_git_repository(filename, &branch, NULL, false); - if (prefs.cloud_git_url && - strstr(filename, prefs.cloud_git_url) - && git == dummy_git_repository) { + if (strstr(filename, prefs.cloud_base_url) && git == dummy_git_repository) /* opening the cloud storage repository failed for some reason * give up here and don't send errors about git repositories */ return -1; - } + if (git) return git_load_dives(git, branch, table, trips, sites, devices, filter_presets); |