diff options
Diffstat (limited to 'core/save-git.c')
-rw-r--r-- | core/save-git.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/core/save-git.c b/core/save-git.c index 7b903a5e9..cdc0ca980 100644 --- a/core/save-git.c +++ b/core/save-git.c @@ -879,18 +879,12 @@ static void save_divesites(git_repository *repo, struct dir *tree) subdir = new_directory(repo, tree, &dirname); free_buffer(&dirname); + purge_empty_dive_sites(); for (int i = 0; i < dive_site_table.nr; i++) { struct membuffer b = { 0 }; struct dive_site *ds = get_dive_site(i); - if (dive_site_is_empty(ds) || !is_dive_site_used(ds, false)) { - int j; - struct dive *d; - for_each_dive(j, d) { - if (d->dive_site == ds) - d->dive_site = NULL; - } - delete_dive_site(ds); - i--; // since we just deleted that one + if (!is_dive_site_used(ds, false)) { + /* Only write used dive sites */ continue; } else if (ds->name && (strncmp(ds->name, "Auto-created dive", 17) == 0 || |