summaryrefslogtreecommitdiffstats
path: root/dive.h
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2014-03-06 13:28:39 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-06 14:52:03 -0800
commit689fe36030537ab57d3a5a1a55baf86675d5ecdb (patch)
tree4cd3ddc4fe114a288267e1c1d4cdd5c5badca246 /dive.h
parentc64227efe02868438c7afe2339c89014fc285ee2 (diff)
downloadsubsurface-689fe36030537ab57d3a5a1a55baf86675d5ecdb.tar.gz
Initial implementation of git save format
This saves the dive data into a git object repository instead of a single XML file. We create a git object tree with each dive as a separate file, hierarchically by trip and date. NOTE 1: This largely duplicates the XML saving code, because trying to share it seemed just too painful: the logic is very similar, but the details of the actual strings end up differing sufficiently that there are tons of trivial differences. The git save format is line-based with minimal quoting, while XML quotes everything with either "<..\>" or using single quotes around attributes. NOTE 2: You currently need a dummy "file" to save to, which points to the real save location: the git repository and branch to be used. We should make this a config thing, but for testing, do something like this: echo git /home/torvalds/scuba:linus > git-test to create that git information file, and when you use "Save To" and specify "git-test" as the file to save to, subsurface will use the new git save logic to save to the branch "linus" in the repository found at "/home/torvalds/scuba". NOTE 3: The git save format uses just the git object directory, it does *not* check out the result in any git working tree or index. So after you do a save, you can do git log -p linus to see what actually happened in that branch, but it will not affect any actual checked-out state in the repository. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r--dive.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/dive.h b/dive.h
index a36c6e4f4..a87d05d7d 100644
--- a/dive.h
+++ b/dive.h
@@ -685,6 +685,7 @@ extern void save_dives(const char *filename);
extern void save_dives_logic(const char *filename, bool select_only);
extern void save_dive(FILE *f, struct dive *dive);
extern void export_dives_uddf(const char *filename, const bool selected);
+extern int git_save_dives(int fd, bool select_only);
extern int subsurface_rename(const char *path, const char *newpath);
extern int subsurface_open(const char *path, int oflags, mode_t mode);
@@ -723,6 +724,8 @@ extern void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int
extern void add_event(struct divecomputer *dc, int time, int type, int flags, int value, const char *name);
extern void per_cylinder_mean_depth(struct dive *dive, struct divecomputer *dc, int *mean, int *duration);
extern int get_cylinder_index(struct dive *dive, struct event *ev);
+extern int nr_cylinders(struct dive *dive);
+extern int nr_weightsystems(struct dive *dive);
/* UI related protopypes */