mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: don't fetch the remote twice when loading
We first check the sha to see if we want to load at all. But at that point we already have the repository and the branch and we have synced with the remote. So when we decide that we need to reload from storage, we don't need to repeat those steps, instead we can go directly to the git load. For that to work we need to pass the repository pointer and the branch name back to the caller so that we can directly call git_load_dives(). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8b670c3f3f
commit
3555cadb77
4 changed files with 18 additions and 6 deletions
|
|
@ -435,13 +435,17 @@ static int parse_file_buffer(const char *filename, struct memblock *mem)
|
|||
return parse_xml_buffer(filename, mem->buffer, mem->size, &dive_table, NULL);
|
||||
}
|
||||
|
||||
int check_git_sha(const char *filename)
|
||||
int check_git_sha(const char *filename, struct git_repository **git_p, const char **branch_p)
|
||||
{
|
||||
struct git_repository *git;
|
||||
const char *branch = NULL;
|
||||
|
||||
char *current_sha = strdup(saved_git_id);
|
||||
git = is_git_repository(filename, &branch, NULL, false);
|
||||
if (git_p)
|
||||
*git_p = git;
|
||||
if (branch_p)
|
||||
*branch_p = branch;
|
||||
if (prefs.cloud_git_url &&
|
||||
strstr(filename, prefs.cloud_git_url)
|
||||
&& git == dummy_git_repository) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue