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>
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.
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I41e9cd395b0608eedeeaead0a9fd997238d747c9
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>
Note that TreeWalk.forPath() needs not be closed; the ObjectReader
_is_ closed when that method returns.
Change-Id: I6e022e4a2fde0c88d610a82de092ea541b33f75c
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
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>
* stable-5.5:
Bazel: Bump bazel version to 1.0.0
Change-Id: I1dc833e8de7a0c54492ea847fb74971ecf438e51
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* stable-5.4:
Bazel: Bump bazel version to 1.0.0
Change-Id: I967ad9e0fa6f13c5217aafb8faedc4a7dfb37c58
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* stable-5.3:
Bazel: Bump bazel version to 1.0.0
Change-Id: If07e2ff3281dc96bec206b68631d22be8fd4636a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* stable-5.2:
Bazel: Bump bazel version to 1.0.0
Change-Id: Ife26567c08ec053741c9db4ca8b5b2836044dcde
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Add to statistics the amount and size of packfiles offloaded to HTTP
download.
Change-Id: I895a7219ecac2794368bfc4fdfae74c1238deed9
Signed-off-by: Ivan Frade <ifrade@google.com>
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>
* changes:
UploadPack: Create a method that propagates an exception as-is
UploadPack: Consolidate the sideband handling code to one place
UploadPack: Introduce ErrorWriter
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.
Change-Id: Idd3b87d6bd471fef807c0cf1183e904b2886157e
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Exception handling can be isolated from UploadPack. This makes it
possible to make the exception handler pluggable.
Change-Id: Ieebbd6711963c7f2e47a98783b4ad815793721c7
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
This consolidates the sideband stream creation code and the error
handling code for the sideband-allowed part in the Git protocol to one
place.
Change-Id: I0e3e94564f50d1be32006f9d8bcd1ef1ce6bf07e
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
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.
Change-Id: Ia8d72e31170bbeafc8ffa8ddb92702196af8a587
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Add a credentials provider that forwards to the java.net.Authenticator.
Needed to support proxies requiring authentication.
Bug: 549832
Change-Id: I181ee27a6c9f1b3fa402ce58affdd5ff3f7c96c9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
The DELIM and END constants are deprecated and using them causes
warnings. Replace them with the accessor methods.
Change-Id: Iadb27000755e8fd8c61d9218591f9d110b8265c8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Also correctly parse the "always" value (allowed in canonical git
since git 2.12.0[1]). Adapt the ReflogWriter.
[1] https://github.com/git/git/commit/341fb2862
Bug: 551664
Change-Id: I051c76ca355a2ac8d6092de65f44b18bf9aeb125
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* stable-5.5:
Prepare 5.5.2-SNAPSHOT builds
JGit v5.5.1.201910021850-r
Prepare 5.3.7-SNAPSHOT builds
JGit v5.3.6.201910020505-r
Prepare 5.1.13-SNAPSHOT builds
JGit v5.1.12.201910011832-r
Do not rely on ArrayIndexOutOfBoundsException to detect end of input
Change-Id: Iabebdc4786b52ec678caa798975428fda4ad7bd7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* stable-5.4:
Prepare 5.3.7-SNAPSHOT builds
JGit v5.3.6.201910020505-r
Prepare 5.1.13-SNAPSHOT builds
JGit v5.1.12.201910011832-r
Do not rely on ArrayIndexOutOfBoundsException to detect end of input
Change-Id: Ia1070fd170651ce827bc6b876c6764a44ffe60eb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* stable-5.3:
Prepare 5.3.7-SNAPSHOT builds
JGit v5.3.6.201910020505-r
Prepare 5.1.13-SNAPSHOT builds
JGit v5.1.12.201910011832-r
Do not rely on ArrayIndexOutOfBoundsException to detect end of input
Change-Id: Ia621d06a9489ee276c793de9dd4a77f4ff19e2ac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* stable-5.2:
Prepare 5.1.13-SNAPSHOT builds
JGit v5.1.12.201910011832-r
Do not rely on ArrayIndexOutOfBoundsException to detect end of input
Change-Id: I3f11a83e177daefa0a2e91173f70f9547067f713
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
# By Matthias Sohn (2) and Saša Živkov (1)
* stable-5.1:
Prepare 5.1.13-SNAPSHOT builds
JGit v5.1.12.201910011832-r
Do not rely on ArrayIndexOutOfBoundsException to detect end of input
Change-Id: Iaae4b171eaa0081f9142489de8df94ab455d65f7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
JGit is built from source on Gerrit-CI: the Bazel build
dependencies need to be aligned. On Gerrit master the servlet-api-3_1
is renamed to servlet-api (see [1]): do the same on the JGit master
branch.
In addition, removing the version suffix from dependency rule makes
it much easier to upgrade. The actual reason the for the renaming it
in Gerrit core is upgrade attempt to servlet-api 4.0, done in [2].
[1] https://gerrit-review.googlesource.com/c/gerrit/+/238496
[2] https://gerrit-review.googlesource.com/c/gerrit/+/238383
Change-Id: I63c506da335deef54eb279879e897b427200797b
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
MergedReftable is not used as an AutoCloseable, because closing tables
is currently handled by DfsReftableStack#close.
Encode that a MergedReftable is a list of ReftableReaders. The previous
code suggested that we could form nested trees of MergedReftables,
which is not how we use reftables.
Change-Id: Icbe2fee8a5a12373f45fc5f97d8b1a2b14231c96
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>