Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return nil if revision time ends up being zero #506

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Oct 19, 2023

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.

@G-Rath G-Rath force-pushed the improve-revision-time branch from a247ecd to 138a894 Compare October 19, 2023 19:40
@lukeify lukeify merged commit 1fb9931 into main Oct 19, 2023
7 of 22 checks passed
@lukeify lukeify deleted the improve-revision-time branch October 19, 2023 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants