@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

When importing Git repositories, treat out-of-range timestamps as the current time

Summary:
Fixes T11537. See that task for discussion.

Although we could accommodate these faithfully, it requires a huge migration and affects one repository on one install which was written with buggy tools.

At least for now, just replace out-of-32-bit-range epoch values with the current time, which is often somewhat close to the real value.

Test Plan:
- Following the instructions in T11537, created commits in 40,000 AD.
- Tried to import them, reproducing the "epoch" database issue.
- Applied the patch.
- Successfully imported future-commits, with some liberties around commit dates. Note that author date (not stored in an `epoch` column) is still shown faithfully:

{F1789302}

Reviewers: chad, avivey

Reviewed By: avivey

Maniphest Tasks: T11537

Differential Revision: https://secure.phabricator.com/D16456

+9 -1
+9 -1
src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
··· 406 406 407 407 $refs = array(); 408 408 foreach ($commits as $commit) { 409 + $epoch = $stream->getCommitDate($commit); 410 + 411 + // If the epoch doesn't fit into a uint32, treat it as though it stores 412 + // the current time. For discussion, see T11537. 413 + if ($epoch > 0xFFFFFFFF) { 414 + $epoch = PhabricatorTime::getNow(); 415 + } 416 + 409 417 $refs[] = id(new PhabricatorRepositoryCommitRef()) 410 418 ->setIdentifier($commit) 411 - ->setEpoch($stream->getCommitDate($commit)) 419 + ->setEpoch($epoch) 412 420 ->setCanCloseImmediately($close_immediately) 413 421 ->setParents($stream->getParents($commit)); 414 422 }