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>