String#to_i works by returning all the digits in a string up to the first non-digit that isn't _ (they're treated as separators) or the end of the string - if no digits are found then zero is returned.
One of the feedback items on #461 was that when we can't determine the revision time we should explicitly return nil instead of a Time; but the above logic of String#to_i means we can end up returning the start of the epoch which goes against that.
This changes our logic so that we explicitly return nil if we end up getting a zero, ensuring our "Unknown time" logic will be triggered.
String#to_i
works by returning all the digits in a string up to the first non-digit that isn't_
(they're treated as separators) or the end of the string - if no digits are found then zero is returned.One of the feedback items on #461 was that when we can't determine the revision time we should explicitly return
nil
instead of aTime
; but the above logic ofString#to_i
means we can end up returning the start of the epoch which goes against that.This changes our logic so that we explicitly return
nil
if we end up getting a zero, ensuring our "Unknown time" logic will be triggered.