git object format: make sure parenthood isn't lost when saving

This makes subsurface remember the git source commit of the dive data.

If you save to an existing branch, subsurface will now complain and
refuse to save if you try to save if the existing branch is not related
to the original source.  That would destroy the history of the dive
data, which in turn would make it impossible to do sane merging of the
data.

If you save to a new branch, it will see if the previous parent commit
is known in the repository you are saving to, and will save parenthood
information if so.  Otherwise it will save it as a new parentless commit
("root commit" in git parlance).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2014-03-13 15:42:45 -07:00 committed by Dirk Hohndel
parent 0b114a198e
commit 3fe0019bc2
5 changed files with 74 additions and 17 deletions

View file

@ -214,6 +214,7 @@ void MainWindow::on_actionClose_triggered()
ui.newProfile->setEmptyState();
/* free the dives and trips */
clear_git_id();
while (dive_table.nr)
delete_single_dive(0);