summaryrefslogtreecommitdiffstats
path: root/core/git-access.h
AgeCommit message (Collapse)Author
2020-10-25cleanup: move function declarations to divelist.hGravatar Berthold Stoeger
unregister_dive() and delete_single_dive are defined in divelist.c, as they take an "index" argument into the global divelist. Therefore, move their declarations to divelist.h. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-24git: add device-table to git-parser-stateGravatar Berthold Stoeger
In analogy to the xml-parser add a device-table to git's parser-state. Currently this is unused. In upcoming commits the git parser will then be changed to add device nodes in this table instead of the global device table. The long-term goal being to detach the parsers from global state and to make dive-import fully undoable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-10-17filter: remove filter_preset_table_tGravatar Berthold Stoeger
We used a typedef "filter_preset_table_t" for the filter preset table, because it is a "std::vector<filter_preset>". However, that is in contrast to all the other global tables (dives, trips, sites) that we have. Therefore, turn this into a standard struct, which simply inherits from "std::vector<filter_preset>". Note that while inheriting from std::vector<> is generally not recommended, it is not a problem here, because we don't modify it in any shape or form. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-09-29filter: implement loading of filter presets from git repositoriesGravatar Berthold Stoeger
This is mostly copy and paste of other git loading code. Sadly, it adds a lot of state to the parser-state. I wish we could pass different parser states to the parser_* functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-06-14git-storage: add global flag to indicate successful cloud syncGravatar Dirk Hohndel
This may seem like a bit heavy handed as it adds more global state, but given the number of ways in which attempts to sync with the cloud can fail it seems much more reliable to claim success in the spots where we actually know that we have successfully synced with the remote server. Transporting that information back through the various call chains turned out to be very disruptive and ugly, so I went with global state instead. Whenever we access cloud storage (or any git repo), we always first check if it actually is a git repo by calling is_git_repository() - so this is the perfect spot to initialize the variable to false. And there are only two spots where we either clone the remote repo (create_local_repo()) or update the remote with the (potentially merged) local changes (check_remote_status()). So those are the two places where we set the variable to true. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-04-10cloud-storage: create consistent commit message for mergesGravatar Dirk Hohndel
This never made sense and I think I just forgot to complete this code when I first worked on it. Now we can see which version of Subsurface or Subsurface-mobile created a merge. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-17git: load into arbitrary dive tablesGravatar Berthold Stoeger
The git parser loads into the global dive table, even if it is called indirectly via parse_file(). However, parse_file() may be given a different table. Fix this by extending the git parser state. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-09-10prefs: git_local_only is not a preferenceGravatar Dirk Hohndel
It's the current state of the app, so it should be a global variable, not a preference. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-01-19Support non-https:// repositories for savingGravatar Berthold Stoeger
On saving to a remote git repository, the transport was set to https://, which broke saving to ssh:// repositories. Instead determine the transport from the remote url. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-06-18Clean up git storage update messagesGravatar Dirk Hohndel
Translate all of them, but also remove some redundant or possibly misleading messages. These are now seen by users, not just developers trying to debug the code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-17QML UI: redesign the user notificationGravatar Dirk Hohndel
The old system of cloud access updates with fake percentages just wasn't helpful. Even worse, it hid a lot important information from the user. This should be more useful (but it will require that we localize the messages sent from the git progress notifications and make them more 'user ready'). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-04-29Add SPDX header to core C filesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-27git storage: init local repositoryGravatar Dirk Hohndel
So far we didn't do that at all, we either relied on the user manually creating a local repo, or we cloned a remote repo. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05QML UI: more hacking around with git progress reportingGravatar Dirk Hohndel
I gave up on the magic numbers and instead report simply linear progress. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-05QML UI: don't fetch the remote twice when loadingGravatar Dirk Hohndel
We first check the sha to see if we want to load at all. But at that point we already have the repository and the branch and we have synced with the remote. So when we decide that we need to reload from storage, we don't need to repeat those steps, instead we can go directly to the git load. For that to work we need to pass the repository pointer and the branch name back to the caller so that we can directly call git_load_dives(). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04Move subsurface-core to core and qt-mobile to mobile-widgetsGravatar Dirk Hohndel
Having subsurface-core as a directory name really messes with autocomplete and is obviously redundant. Simmilarly, qt-mobile caused an autocomplete conflict and also was inconsistent with the desktop-widget name for the directory containing the "other" UI. And while cleaning up the resulting change in the path name for include files, I decided to clean up those even more to make them consistent overall. This could have been handled in more commits, but since this requires a make clean before the build, it seemed more sensible to do it all in one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>