Previously 'latest' was chosen in the VFS by taking max(revs), which
would pick the most recent commit by rev_list date, which only has a
resolution of integer seconds.
That approach could fail if two commits (i.e. two "bup save" runs)
executed close enough together that both commits ended up with the
same rev_list date. In that case, the sort order was determined by
the commit hash, which is effectively random.
Since I couldn't think of a case where you wouldn't want 'latest' to
refer to the most recent commit (save) to the relevant branch,
'latest' is now computed as revs[0], i.e. the first commit returned by
rev_list.
Thanks to Zoran and Gabriel for some helpful sanity checks while
tracking this down.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
tags = git.tags()
revs = list(git.rev_list(self.hash.encode('hex')))
+ latest = revs[0]
for (date, commit) in revs:
l = time.localtime(date)
ls = time.strftime('%Y-%m-%d-%H%M%S', l)
t1.ctime = t1.mtime = date
self._subs[tag] = t1
- latest = max(revs)
if latest:
(date, commit) = latest
commithex = commit.encode('hex')