From: Linus Torvalds Date: Tue, 3 Apr 2012 05:00:29 +0000 (-0700) Subject: Renumber dives when deleting a dive X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=9470f713d05b489fec32457a4d2eba759bc64d7a;hp=9470f713d05b489fec32457a4d2eba759bc64d7a;p=ext%2Fsubsurface.git Renumber dives when deleting a dive ... but only do it if the numbering of subsequent dives was consecutive to begin with. Note that we do accept unnumbered dives (and will stop the sequence check if we find one), but in order to renumber dives on delete, we require that starting with the dive we delete, the subsequent numbered dives have to be a nice incrementing series. If that is the case, then we fix up that numbering as we delete the dive. Put another way: if the dive numbering was an incrementing sequence before the delete, then it will be a sane incrementing sequence after it too. But if you had missing dives before the delete, we will turn the delete into just another missing dive. The basic rule is that we never renumber any dives unless that renumbering is "obviously correct". It's better to leave old numbers as-is (and expect that the user is going to do an explicit re-numbering operation) than it is to change dive numbers in a sequence that we don't understand. I do suspect that we should possibly check the dive number "backwards" too, but this doesn't do that. Signed-off-by: Linus Torvalds ---