Thomas Wolf [Tue, 12 Nov 2019 08:38:04 +0000 (09:38 +0100)]
Fix NPE in SystemReader in tests
SystemReader.updateAll() must _not_ test whether the file exists. In
tests at least there are FileBasedConfigs with a null file. Test
configs should (and do) override isOutdated() to deal with this case.
Change-Id: I56303fe0d56afeb9f2203ee807a92c5dcf3809e9 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Matthias Sohn [Mon, 11 Nov 2019 19:07:01 +0000 (11:07 -0800)]
Merge branch 'stable-5.5'
* stable-5.5:
BaseReceivePack: Fix the format
Prepend hostname to subsection used to store file timestamp resolution
Store filesystem timestamp resolution in extra jgit config
SystemReader: extract updating config and its parents if outdated
Change-Id: Iecfddce8081303af29badcdcd3d72a0da50c964f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Matthias Sohn [Mon, 7 Oct 2019 17:05:07 +0000 (19:05 +0200)]
Prepend hostname to subsection used to store file timestamp resolution
This ensures the measured filesystem timestamp resolution will be only
used on the machine where it was measured and avoid errors in case the
~/.jgitconfig file is copied to another machine.
Bug: 551850
Change-Id: Iff2a11be62ca94c3bbe4a955182988dc50852f9f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Matthias Sohn [Mon, 7 Oct 2019 15:58:56 +0000 (17:58 +0200)]
Store filesystem timestamp resolution in extra jgit config
This avoids polluting hand-crafted user level config with
auto-configured options which might disturb in environments where
the user level config is replicated between different machines.
Add a jgit config as parent of the system level config. Persist
measured timestamp resolutions always in this jgit config and read it
via the user global config. This has the effect that auto-configured
timestamp resolution will be used by default and can be overridden in
either the system level or user level config.
Store the jgit config under the XDG_CONFIG_HOME directory following the
XDG base directory specification [1] in order to ensure that we have
write permissions to persist the file. This has the effect that each OS
user will use its jgit config since they typically use different
XDG_CONFIG_HOME directories.
If the environment variable XDG_CONFIG_HOME is defined the jgit config
file is located at $XDG_CONFIG_HOME/jgit/config otherwise the default is
~/.config/jgit/config.
If you want to avoid redundant measurement for different OS users
manually copy the values measured and auto-configured for one OS user to
the system level git config.
Change-Id: I0f2fd3a218ea31f6f6b58b1816af9361e4de54e4 Signed-off-by: David Ostrovsky <d.ostrovsky@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Thomas Wolf [Sat, 21 Sep 2019 12:38:22 +0000 (14:38 +0200)]
SystemReader: extract updating config and its parents if outdated
Change-Id: Ia77f442e47c5670c2d6d279ba862044016aabd86 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Matthias Sohn [Tue, 5 Nov 2019 15:28:06 +0000 (16:28 +0100)]
Merge branch 'stable-5.5'
* stable-5.5:
Run JMH benchmarks using bazel
Benchmark for creating files and FileSnapshots
Implement benchmark for looking up FileStore of a given Path
JMH benchmark for SimpleLruCache
Update API problem filters
Remove unused API problem filters
Silence API errors for new API added since 5.1.0
Change-Id: If87a13d0f809d9968ad2921b786f4b18e1b494d0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Matthias Sohn [Tue, 5 Nov 2019 15:10:48 +0000 (16:10 +0100)]
Merge branch 'stable-5.4' into stable-5.5
* stable-5.4:
Run JMH benchmarks using bazel
Benchmark for creating files and FileSnapshots
Implement benchmark for looking up FileStore of a given Path
JMH benchmark for SimpleLruCache
Update API problem filters
Remove unused API problem filters
Silence API errors for new API added since 5.1.0
Change-Id: I071536d630a95e89f5bbbf965a1571b9f5eb81ee Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Matthias Sohn [Tue, 5 Nov 2019 14:42:14 +0000 (15:42 +0100)]
Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
Run JMH benchmarks using bazel
Benchmark for creating files and FileSnapshots
Implement benchmark for looking up FileStore of a given Path
JMH benchmark for SimpleLruCache
Update API problem filters
Remove unused API problem filters
Silence API errors for new API added since 5.1.0
Change-Id: Ib735c4039e24ec8b045ae2cc81df1e9e5c9fa996 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Matthias Sohn [Tue, 5 Nov 2019 14:24:54 +0000 (15:24 +0100)]
Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
Run JMH benchmarks using bazel
Benchmark for creating files and FileSnapshots
Implement benchmark for looking up FileStore of a given Path
JMH benchmark for SimpleLruCache
Update API problem filters
Remove unused API problem filters
Silence API errors for new API added since 5.1.0
Change-Id: I00615958ab6fbdff601e87a9792aba5606cda12a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Matthias Sohn [Tue, 5 Nov 2019 14:07:39 +0000 (15:07 +0100)]
Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
Run JMH benchmarks using bazel
Benchmark for creating files and FileSnapshots
Implement benchmark for looking up FileStore of a given Path
JMH benchmark for SimpleLruCache
Remove unused API problem filters
Silence API errors for new API added since 5.1.0
Change-Id: If91c55a192d3b2c441d9c8d414f2e24a7261b1b6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Matthias Sohn [Sat, 3 Aug 2019 10:02:34 +0000 (12:02 +0200)]
JMH benchmark for SimpleLruCache
See [1] for JMH documentation and [2] how to use JMH in Eclipse.
The benchmarks pom currently cannot use the JGit parent pom due to an
ecj bug [3] regarding annotation processing. Hence for now do not
inherit from the JGit parent pom and copy the compiler plugin
configuration for javac from the parent pom.
After running the Maven build the benchmark can be run using Maven:
Thomas Wolf [Sat, 2 Nov 2019 18:26:42 +0000 (19:26 +0100)]
WorkingTreeModifiedEvent: must be fired explicitly after merge
A merge may write files to the working tree. After a successful
merge one must fire a WorkingTreeModifiedEvent explicitly if
getModifiedFiles() is not empty.
Also, any touched files must be reported by the
WorkingTreeModifiedEvent fired by DirCacheCheckout.checkout().
Bug: 552636
Change-Id: I5fab8279ed8be8a4ae34cddfa726836b9277aea6 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Han-Wen Nienhuys [Sun, 13 Oct 2019 16:14:17 +0000 (18:14 +0200)]
reftable: enforce ascending order in sortAndWriteRefs
MergedReftableTest#scanDuplicates tests whether we can write duplicate
keys in a merged reftable. Apparently, the first key appearing should
get precedence, and this works because the sort() algorithm on ordered
collections is stable.
This is potentially confusing behavior, because you can write data
into the table that cannot be retrieved (Merged table can only have
one entry per key), and the APIs such as exactRef() only return a
single value.
Make this consistent with behavior introduced in I04f55c481 "reftable:
enforce ordering for ref and log writes" by considering a duplicate key
in sortAndWriteRefs as a fatal runtime error.
Thomas Wolf [Wed, 31 Jul 2019 17:40:40 +0000 (19:40 +0200)]
HttpSupport.proxyFor(): use only scheme, host, and port
Some URLs cannot be converted via URL.toURI(). So don't convert
the full URL but only the bits that are needed to find a proxy
via java.net.ProxySelector.
Bug: 549690
Change-Id: I55b5ecee70c6b52f72f9bdba9ce552fde7f33976 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
By using ${min_update}-${max_update} as file name template, we
guarantee that each file has a unique name.
This allows data from open files to be cached across reloads of the
stack.
This is in anticipation of Change I1837f268e
("file: implement FileReftableDatabase"), which is the first
implementation of reftable on a filesystem.
Michael Keppler [Fri, 25 Oct 2019 11:20:05 +0000 (13:20 +0200)]
Upgrade Jetty to 9.4.22.v20191022
Change-Id: Ie2ee0a978949f9cf70833645132eedf26c3cf1c8 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Thomas Wolf [Tue, 22 Oct 2019 22:55:28 +0000 (00:55 +0200)]
GPG: implement more OpenPGP UserId matching formats
Instead of just looking for a substring match of user.signingKey
in a key's user ID implement the GPG matching formats[1] for:
'=' Full exact match
'<' Full exact match of the e-mail address
'@' Substring match within the e-mail address only
'*' General case-insensitive substring match (default)
When user.signingKey is not set, the committer's e-mail address is
used by default. In that case, use '<', i.e., require an exact match
on the OpenPGP e-mail address.
Also handle the optional "0x" prefix for (partial) key fingerprints.
Jonathan Tan [Tue, 22 Oct 2019 00:26:22 +0000 (17:26 -0700)]
TreeRevFilterTest: Simplify filter used
TreeRevFilterTest uses an unncessarily complicated TreeFilter - an
AndTreeFilter - when it should be as simple as possible because this
class tests TreeRevFilter, not AndTreeFilter. Replace the filter with a
simpler one.
Change-Id: I3256a65f6e0042d32fd76a9224b79a835674ff3a Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Roan Hofland [Tue, 22 Oct 2019 00:16:43 +0000 (02:16 +0200)]
GpgKeyLocator: Return a signing key for a user instead of the master key
Currently when a GPG key is looked up using a user identity the first
key from the keyring that has this user identity is returned.
The code was changed to instead return the first signing [S] key in this
keyring and only return the master key if no such signing key was found.
If the master key also does not have the signing flag set null is
returned instead.
Roan Hofland [Tue, 22 Oct 2019 00:06:31 +0000 (02:06 +0200)]
GpgKeyLocator: Return subkeys instead of the first key for subkeys
Currently when a subkey is configured for signing via the git
user.signingkey configuration option the first key from the keyring for
this subkey would be returned for use (master key). The code has been
changed to return the requested key from the keyring instead.
Thomas Wolf [Fri, 20 Sep 2019 14:41:39 +0000 (16:41 +0200)]
Support for core.hooksPath
Support the core.hooksPath git config. This can be an absolute or
relative path of a directory where to find git hooks; a relative
path is resolved relative to the directory the hook will run in.
Bug: 500266
Change-Id: I671999a6386a837e897c31718583c91d8035f3ba Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Matthias Sohn [Mon, 21 Oct 2019 07:29:50 +0000 (09:29 +0200)]
Remove meaningless comment in CloneCommandTest
This comment was probably copied from testCloneRepositoryWithBranch() to
testBareCloneRepositoryOnlyOneBranch() where it doesn't make sense.
Hence remove it.
Change-Id: I846debd084dd77fd473c3602a799f195a8390f77 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This introduces ReftableBatchRefUpdate and ReftableDatabase, as
generic classes, with some code moved to DfsReftableBatchRefUpdate and
DfsReftableDatabase.
Clarify thread-safety requirements by asserting locked status in
accessors, and acquiring locks in callers. This does not fix threading
problems, because ReftableBatchRefUpdate already wraps the whole
transaction in a lock.
This also fixes a number of bugs in ReftableBatchRefUpdate:
* non-atomic updates should not bail on first failure
* isNameConflicting should also check for conflicts between names that
are added and removed in the BatchRefUpdate.
Change-Id: I5ec91173ea9a0aa19da444c8c0b2e0f4e8f88798 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Han-Wen Nienhuys [Sun, 13 Oct 2019 17:21:06 +0000 (19:21 +0200)]
reftable: fix lookup by ID in merged reftables
On changing a ref, the old SHA1 is not updated in the object => ref
mapping. This means search by object ID may still turn up a ref from
deeper within the stack. To fix this, check all refs produced by the
merged iterator against the merged reftables.
The flag enabling sideband-all is used in two places: in UploadPack
for advertisement and in the protocol parser to read it from the
request.
This leds to problems in distributed deployments where the two requests of
a fetch can go to different servers with different configurations.
Use the existing allowsidebandall to accept the sideband-all request
(and respond to it) and introduce a new "advertisesidebandall" to toggle
the advertising of the feature.
Change-Id: I892d541bc3f321606c89bad1d333b079dce6b5fa Signed-off-by: Ivan Frade <ifrade@google.com>
Thomas Wolf [Mon, 14 Oct 2019 19:06:18 +0000 (21:06 +0200)]
IndexDiff: close SubmoduleWalk and use already loaded DirCache
If the SubModuleWalk isn't closed its TreeWalk's ObjectReader won't
be closed. Re-loading the DirCache during an IndexDiff is not only
inefficient but could also give strange results if an external
process had modified the index in the meantime: file diffs would
be based on a "before" state, but submodule diffs on an "after"
state.
Change-Id: Iab948c08ac342138b37263c9028d80b84101f6d6 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Ivan Frade [Wed, 9 Oct 2019 21:10:14 +0000 (14:10 -0700)]
CachedPackUriProvider: Add size to the pack information
The object identifying packfiles to send them via packfile-uri contains
only the uri and the hash. This is the information that goes through the
wire. It would be useful to know also the size of those packfile, for
example to track how many bytes have been offloaded to HTTP.
Add size field the CachedPackUriProvider.PackInfo object.
Change-Id: If6b921b48a4764d936141c777879b148cc80bbd3 Signed-off-by: Ivan Frade <ifrade@google.com>
Terry Parker [Wed, 9 Oct 2019 19:55:48 +0000 (15:55 -0400)]
Merge changes Ieebbd671,I0e3e9456,Ia8d72e31
* changes:
UploadPack: Create a method that propagates an exception as-is
UploadPack: Consolidate the sideband handling code to one place
UploadPack: Introduce ErrorWriter
Masaya Suzuki [Tue, 6 Aug 2019 19:02:23 +0000 (12:02 -0700)]
http: Allow specifying a custom error handler for UploadPack
By abstracting the error handler, this lets a user customize the error
handler for UploadPack. A customized error handler can show a custom
error message to the clients based on the exception thrown from the
hook, create a monitoring system for server errors, or do custom
logging.
ErrorWriter writes an error message to the user. The implementation is
swapped once it detects that the client supports sideband. By default it
uses the protocol level ERR packet, which was introduced recently.
In total the error output is done in two different places;
UploadPack#upload and UploadPack#sendPack. These will be consolidated in
the next change.