Make it executable and remove magic whitespace on shebang line.

Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't leak file descriptor in the error case

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Deal with theoretical memory leaks

This is rather academic, but it will make Coverity happy.
If we start running out of memory we should make sure we don't leak any
more memory.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix real memory leak

We can't keep the cache around (even though it's tempting) as the next
iteration might change the start time of the planned dive or other
parameters which would make the cached data invalid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
Prevent another file descriptor leak

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Fix memory leak when parsing a dive fails

We had all these repetitive calls to dc_parser_destroy but didn't free the
already allocated dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>