mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 20:40:56 +01:00
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
This commit is contained in:
parent
72a03dc03e
commit
d952dd5912
1 changed files with 9 additions and 1 deletions
|
@ -406,9 +406,17 @@ final class PhabricatorRepositoryDiscoveryEngine
|
||||||
|
|
||||||
$refs = array();
|
$refs = array();
|
||||||
foreach ($commits as $commit) {
|
foreach ($commits as $commit) {
|
||||||
|
$epoch = $stream->getCommitDate($commit);
|
||||||
|
|
||||||
|
// If the epoch doesn't fit into a uint32, treat it as though it stores
|
||||||
|
// the current time. For discussion, see T11537.
|
||||||
|
if ($epoch > 0xFFFFFFFF) {
|
||||||
|
$epoch = PhabricatorTime::getNow();
|
||||||
|
}
|
||||||
|
|
||||||
$refs[] = id(new PhabricatorRepositoryCommitRef())
|
$refs[] = id(new PhabricatorRepositoryCommitRef())
|
||||||
->setIdentifier($commit)
|
->setIdentifier($commit)
|
||||||
->setEpoch($stream->getCommitDate($commit))
|
->setEpoch($epoch)
|
||||||
->setCanCloseImmediately($close_immediately)
|
->setCanCloseImmediately($close_immediately)
|
||||||
->setParents($stream->getParents($commit));
|
->setParents($stream->getParents($commit));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue