| commit | e2f9a3ec75625d47038de8574ba9719e7aeb8ae6 | [log] [tgz] |
|---|---|---|
| author | David Ostrovsky <david@ostrovsky.org> | Fri Jan 22 23:10:49 2021 +0100 |
| committer | David Ostrovsky <david.ostrovsky@gmail.com> | Sun Feb 14 21:45:44 2021 +0000 |
| tree | 3c6e1486b160de629bae5ee236922f72eff14e0b | |
| parent | 41623da45ec6b2fdd21a4012fdd31a34db4e6379 [diff] |
uploadPackAuditEventLog: Avoid commit timestamp mismatch
JGit's TestRepository instance uses a mocked system reader with a mocked
time source:
now = Aug 15 20:12:58 GMT-03:30 2009
That's why the new upstream commit has a commit time 11 years in the
past. However, when a new repository is created, an empty commit is
created per default without using the mocked system reader. When second
commit is created, using TestRepository, then we have the following
situation:
root commit timestamp: 1611269860
second commit timestamp: 1250379779
Until now we don't really care, but in the recent JGit version git wire
protocol v2 is used per default for fetching. When trying to upgrade to
this new JGit version, we supposed to change the number of requests
required to fetch new commit from remote repository from 2 to 3.
However due to timestamp skew between root commit and second commit 4
requests are required. Even though, the want commit is present in the
repository, it's not found in UploadPack.wantSatisfied() method because
of commit TimeRev filter:
if (oldestTime != 0)
walk.setRevFilter(CommitTimeRevFilter.after(oldestTime * 1000L));
Because the common base commit timestamp is older than the second
commit, commit TimeRev filter prevents the want commit to be found.
As the consequence the fetch command isn't finishing with three requests
and an additional request is required.
To rectify, skip empty commit during project creation, and create
common commit using TestRepository instead. That way the same mocked
system reader is used for both commits.
This is the fix for JGit update change: I00fd18587c.
Change-Id: Idd60394b8d3453c3b61fec292867f28a5532aa8b
Gerrit is a code review and project management tool for Git based projects.
Gerrit makes reviews easier by showing changes in a side-by-side display, and allowing inline comments to be added by any reviewer.
Gerrit simplifies Git based project maintainership by permitting any authorized user to submit changes to the master Git repository, rather than requiring all approved changes to be merged in by hand by the project maintainer.
For information about how to install and use Gerrit, refer to the documentation.
Our canonical Git repository is located on googlesource.com. There is a mirror of the repository on Github.
Please report bugs on the issue tracker.
Gerrit is the work of hundreds of contributors. We appreciate your help!
Please read the contribution guidelines.
Note that we do not accept Pull Requests via the Github mirror.
The Developer Mailing list is repo-discuss on Google Groups.
Gerrit is provided under the Apache License 2.0.
Install Bazel and run the following:
git clone --recurse-submodules https://gerrit.googlesource.com/gerrit
cd gerrit && bazel build release
The instruction how to configure GerritForge/BinTray repositories is here
On Debian/Ubuntu run:
apt-get update & apt-get install gerrit=<version>-<release>
NOTE: release is a counter that starts with 1 and indicates the number of packages that have been released with the same version of the software.
On CentOS/RedHat run:
yum clean all && yum install gerrit-<version>[-<release>]
On Fedora run:
dnf clean all && dnf install gerrit-<version>[-<release>]
Docker images of Gerrit are available on DockerHub
To run a CentOS 8 based Gerrit image:
docker run -p 8080:8080 gerritcodereview/gerrit[:version]-centos8
To run a Ubuntu 20.04 based Gerrit image:
docker run -p 8080:8080 gerritcodereview/gerrit[:version]-ubuntu20
NOTE: release is optional. Last released package of the version is installed if the release number is omitted.