diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-09-08 09:45:09 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-08 09:45:09 -0700 |
commit | a29f897125878e25e3d47b98d499a68970154004 (patch) | |
tree | f5687b8319aab8a9cc8a3aa95c1537eff374d754 /save-git.c | |
parent | 4f3a9ba58309e5fc207733edcf01077f78ddf380 (diff) | |
download | subsurface-a29f897125878e25e3d47b98d499a68970154004.tar.gz |
Only store dive site uuid in dive if the dive site exists
Don't store stale uuids.
As a side effect this makes it easy to remove dive sites from the XML file
(or the git repository) when duplicates have been added for some reason
and the user wants to restart from scratch.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-git.c')
-rw-r--r-- | save-git.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/save-git.c b/save-git.c index 9e6819322..96a689ffa 100644 --- a/save-git.c +++ b/save-git.c @@ -403,8 +403,10 @@ static void create_dive_buffer(struct dive *dive, struct membuffer *b) SAVE("visibility", visibility); cond_put_format(dive->tripflag == NO_TRIP, b, "notrip\n"); save_tags(b, dive->tag_list); - cond_put_format(dive->dive_site_uuid, b, "divesiteid %08x\n", dive->dive_site_uuid); - + cond_put_format(dive->dive_site_uuid && get_dive_site_by_uuid(dive->dive_site_uuid), + b, "divesiteid %08x\n", dive->dive_site_uuid); + if (verbose && dive->dive_site_uuid && get_dive_site_by_uuid(dive->dive_site_uuid)) + fprintf(stderr, "removed reference to non-existant dive site with uuid %08x\n", dive->dive_site_uuid); save_overview(b, dive); save_cylinder_info(b, dive); save_weightsystem_info(b, dive); |