guard against wrong timestamps in git log

For example, my sound repo has in the git-annex branch a commit from
2036, which is followed by one from 2034, in amoung commits from 2013.
Clearly there was a problem with the clock.

Since git log --date-order has a behavior of
"Show no parents before all of its children are shown", the data still
gets processed ok. The future timestamp just prevented displaying data
after that commit. It seems better, when the clock was wrong, to display
a wrong date, and then return to right dates.

It would be nice to filter out the wrong dates from display entirely,
but that seems it would need to buffer the whole output. This command is
too slow to buffer it all before displaying anything, and anyway this
kind of problem is probably rare.

Sponsored-by: Joshua Antonishen on Patreon
This commit is contained in:
Joey Hess 2023-11-13 15:06:04 -04:00
parent 2ab11fe06e
commit cde081a025
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -408,6 +408,7 @@ sizeHistoryInfo mu o = do
&& (prevoutput /= Just output) = do
displayts zone t output
return (zone, True, t, Just output)
| t < prevt = return (zone, displayedyet, t, Just output)
| otherwise = return (zone, displayedyet, prevt, Just output)
where
output = intercalate "," (map showsize sizes)