This adds a top-level "00-Subsurface" file that sorts first in the git
tree, and contains version information, dive computer nicknames and
settings. Although right now the settings are just the autogroup thing.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Oops. Really stupid bug in event saving, resulting in bad event lines,
that I didn't notice until I started trying to parse them.
The argument order is a bit mixed up, which is partly why this happened.
But considering that this is the worst bug I've hit so far in the saving
code, I guess I shouldn't complain too much.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We want to make sure that we load them in the same order we save them,
and while using the hash made the divecomputer names unique, it didn't
sort them. You couldn't tell with just one or two dive computers, but
if you have three or more dive computers on a dive, the order of any but
the first ended up depending on the ordering of the unique hash
extensions.
So just append a numeric index instead of relying on the hash to make
the names unique. But skip the index if there is just one dive
computer.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It doesn't actually parse the files themselves, but it does walk the
object tree and print out the dives and trips it finds.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of hardcoding the regular file mode (0100644 is the traditional
Unix S_IFREG file mode with -rw-r--r-- protections), use
GIT_FILEMODE_BLOB (and GIT_FILEMODE_TREE for 040000 - S_IFDIR).
The numbers were historically indeed the regular S_IFREG/S_IFDIR values,
but since those aren't portable, git ended up defining their own.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This fixes up the writing of the git format to the point that it might
be getting close to complete. In particular:
- Add subsurface version information into commit message as requested by Dirk
- Fix missed string quoting ('\' needs to be quoted as '\\')
- rename "git_save_error()" as "report_error()", since we'll want to
use this for the loading code too.
- Improve on dive and trip name generation
- create a date-based directory hierarchy
- save dive computer data as individual files
- actually save the trip information
There might be further changes as I start to actually *read* the git
files, of course.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Add the following to your qmake command line and things should compile
again:
qmake ... CONFIG+=libgit21-api
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Linus was wrong - the change to the API happened after 0.20 was released.
So libgit2 0.20 still needs the fix.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>