mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-11 03:21:29 +00:00
git: don't check for git sha in parse_file()
parse_file() refused to load from a git repository if we already had that repository and there were no changes. However, this only checked the global divelist_changed flag, which does not track undo-commands. Thus, after editing dives the user couldn't reload from git. Remove this check. It is somewhat questionable that the io layer refuses to load from a repository anyway. Let the caller decide. There appears to be a check_git_sha function for that purpose(?). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
64a5f10cfe
commit
d8b92a1852
1 changed files with 0 additions and 16 deletions
16
core/file.c
16
core/file.c
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
#include "dive.h"
|
#include "dive.h"
|
||||||
#include "subsurface-string.h"
|
#include "subsurface-string.h"
|
||||||
#include "divelist.h"
|
|
||||||
#include "errorhelper.h"
|
#include "errorhelper.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "git-access.h"
|
#include "git-access.h"
|
||||||
|
@ -297,7 +296,6 @@ int parse_file(const char *filename, struct dive_table *table, struct trip_table
|
||||||
{
|
{
|
||||||
struct git_repository *git;
|
struct git_repository *git;
|
||||||
const char *branch = NULL;
|
const char *branch = NULL;
|
||||||
char *current_sha = copy_string(saved_git_id);
|
|
||||||
struct memblock mem;
|
struct memblock mem;
|
||||||
char *fmt;
|
char *fmt;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -308,22 +306,8 @@ int parse_file(const char *filename, struct dive_table *table, struct trip_table
|
||||||
&& git == dummy_git_repository) {
|
&& git == dummy_git_repository) {
|
||||||
/* opening the cloud storage repository failed for some reason
|
/* opening the cloud storage repository failed for some reason
|
||||||
* give up here and don't send errors about git repositories */
|
* give up here and don't send errors about git repositories */
|
||||||
free(current_sha);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* if this is a git repository, do we already have this exact state loaded ?
|
|
||||||
* get the SHA and compare with what we currently have */
|
|
||||||
if (git && git != dummy_git_repository) {
|
|
||||||
const char *sha = get_sha(git, branch);
|
|
||||||
if (!empty_string(sha) &&
|
|
||||||
same_string(sha, current_sha) &&
|
|
||||||
!unsaved_changes()) {
|
|
||||||
fprintf(stderr, "already have loaded SHA %s - don't load again\n", sha);
|
|
||||||
free(current_sha);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(current_sha);
|
|
||||||
if (git)
|
if (git)
|
||||||
return git_load_dives(git, branch, table, trips, sites);
|
return git_load_dives(git, branch, table, trips, sites);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue