Commit Graph

7654 Commits

Author SHA1 Message Date
David Pursehouse 51b24ea17c Merge changes I6e022e4a,If1b9d808
* changes:
  Close TreeWalks in tests
  Close SubmoduleWalks in tests
2019-10-15 20:11:35 -04:00
Christian Halstrick 101b8ea58f Merge "IndexDiff: close SubmoduleWalk and use already loaded DirCache" 2019-10-15 17:06:12 -04:00
Ivan Frade 914e320ac6 ProtocolV2Parser: Introduce advertise sideband-all option
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>
2019-10-15 12:20:37 -07:00
Thomas Wolf 563ec9ecb6 Close TreeWalks in tests
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>
2019-10-15 13:24:30 +02:00
Thomas Wolf 5e0eca6943 Close SubmoduleWalks in tests
Change-Id: If1b9d80830b6b136d4ab33f5c7043b140bd92f85
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-10-15 08:54:25 +02:00
Thomas Wolf 36e16435be 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>
2019-10-15 08:54:20 +02:00
David Pursehouse bca00aa5f4 DfsPackFile: Remove unused parameter from loadReverseIdx method
Change-Id: I2373084c8b40ebd6f432806dddc8633a76938e80
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-10-14 15:39:15 -04:00
Matthias Sohn d1d8bc30c2 Silence API errors for new fields added to PackStatistics.Accumulator
These fields were added in a307c887.

Change-Id: I9e80abdb6f48dc7bf72de683dcf3566d2dab611f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-12 18:25:33 +02:00
Matthias Sohn e3b0ee14d9 Remove unused API warning filters
Change-Id: I78262681e12079028752d8c144720ad0256c5707
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-12 11:05:02 +02:00
Matthias Sohn 71bd70e67f Add missing @since tag to UploadPack#uploadWithExceptionPropagation
This was missed in b8d9734c

Change-Id: I4b9c1cf058eff16af725375047d743944e7f5db4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-12 11:05:02 +02:00
David Pursehouse 009e07882f Merge branch 'stable-5.5'
* stable-5.5:
  Bazel: Bump bazel version to 1.0.0

Change-Id: I1dc833e8de7a0c54492ea847fb74971ecf438e51
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-10-12 09:40:45 +09:00
David Pursehouse 67f44ce9fe Merge branch 'stable-5.4' into stable-5.5
* stable-5.4:
  Bazel: Bump bazel version to 1.0.0

Change-Id: I967ad9e0fa6f13c5217aafb8faedc4a7dfb37c58
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-10-12 09:39:51 +09:00
Ivan Frade 10b1b490a6 CachedPackUriProvider: size should be a long (not an int)
Change-Id: I5cd8b6376cdec59c5ead318edc5385da961511ec
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-10-11 16:24:45 -07:00
Matthias Sohn 2fda4d3983 Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Bazel: Bump bazel version to 1.0.0

Change-Id: If07e2ff3281dc96bec206b68631d22be8fd4636a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-12 00:28:18 +02:00
Jonathan Tan 52408c6afb Merge changes from topic 'packfile-offloading-stats'
* changes:
  PackWriter/Statistics: Report offloaded size
  CachedPackUriProvider: Add size to the pack information
2019-10-11 17:50:29 -04:00
Matthias Sohn f884705088 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Bazel: Bump bazel version to 1.0.0

Change-Id: Ife26567c08ec053741c9db4ca8b5b2836044dcde
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-11 23:43:52 +02:00
Ivan Frade a307c88714 PackWriter/Statistics: Report offloaded size
Add to statistics the amount and size of packfiles offloaded to HTTP
download.

Change-Id: I895a7219ecac2794368bfc4fdfae74c1238deed9
Signed-off-by: Ivan Frade <ifrade@google.com>
2019-10-11 14:13:24 -07:00
Ivan Frade 892c804699 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>
2019-10-11 14:13:17 -07:00
Matthias Sohn e93ba0a200 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Bazel: Bump bazel version to 1.0.0

Change-Id: I067d8ebd15f35f139d86bc67473b42afac4f0f53
2019-10-11 20:00:56 +02:00
David Pursehouse 3b704aec70 Bazel: Bump bazel version to 1.0.0
Change-Id: I607915af0556efe8b2fb640e9387029b755d1a7f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-10-11 15:35:26 +02:00
Terry Parker dfef00a2c8 Merge "http: Allow specifying a custom error handler for UploadPack" 2019-10-09 18:26:48 -04:00
Terry Parker 6bd9bc23b7 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
2019-10-09 15:55:48 -04:00
Masaya Suzuki abedaf0d38 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.

Change-Id: Idd3b87d6bd471fef807c0cf1183e904b2886157e
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
2019-10-09 10:25:54 -07:00
Masaya Suzuki b8d9734c02 UploadPack: Create a method that propagates an exception as-is
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>
2019-10-09 10:02:03 -07:00
Masaya Suzuki 1e3a7bcef7 UploadPack: Consolidate the sideband handling code to one place
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>
2019-10-09 10:02:01 -07:00
Masaya Suzuki 63bd24cf35 UploadPack: Introduce ErrorWriter
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>
2019-10-09 10:01:06 -07:00
Thomas Wolf 2abd3c43bd Apache HTTP: support proxy authentication
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>
2019-10-07 13:53:10 -04:00
David Pursehouse 7192d9aecd ProtocolV2Parser: Add missing $NON-NLS suppression
Change-Id: If0a6eb9829a4790073f1c9baa2cfe39cb43f7d84
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-10-07 16:32:02 +02:00
David Pursehouse ab3c47df67 UploadPackTest: Stop using deprecated PacketLineIn constants
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>
2019-10-07 16:32:02 +02:00
Thomas Wolf b87f1259d6 Fix parsing of core.logAllRefUpdates
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>
2019-10-07 16:07:47 +02:00
Matthias Sohn d0adf52df8 Update Jetty to 9.4.21.v20190926
Change-Id: If01a01015024db9743c38c59f920964b3c3a0539
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-04 22:41:40 +02:00
Matthias Sohn 226dc134d2 Create 4.14 staging target platform
Change-Id: I6d8a6a0af41775a40342d56665cbd4e2e4aa5c61
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-04 22:34:55 +02:00
Matthias Sohn c9a8d3d040 Merge "Merge branch 'stable-5.5'" 2019-10-04 15:42:20 -04:00
Minh Thai 8dc0cca308 Fix NPE in DfsPackCompactor.compactReftables
Output pack description needs to be initialized.

Change-Id: I4b66a18fa7020f528b312bc9f74b8d094ad6ad66
Signed-off-by: Minh Thai <mthai@google.com>
2019-10-04 01:07:48 -07:00
Matthias Sohn 8b6d47636a Merge branch 'stable-5.5'
* 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>
2019-10-03 23:23:30 +02:00
Matthias Sohn b570b6907c Prepare 5.5.2-SNAPSHOT builds
Change-Id: Ief9940182fd6e3f3e2df88e6485be753c1260e6b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-03 02:06:57 +02:00
Matthias Sohn 2796d86d1e JGit v5.5.1.201910021850-r
Change-Id: I9930b35b095f638119b4601a8311257daf5e5420
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-03 00:49:02 +02:00
Matthias Sohn 285073d554 Merge branch 'stable-5.4' into stable-5.5
* 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>
2019-10-03 00:47:16 +02:00
Matthias Sohn 430a34e6e1 Merge branch 'stable-5.3' into stable-5.4
* 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>
2019-10-02 11:36:05 +02:00
Matthias Sohn ca207cd3ae Prepare 5.3.7-SNAPSHOT builds
Change-Id: I3465b6a4d913bfb2864abba58448423e7c262f60
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-02 11:23:28 +02:00
Matthias Sohn 38258f3f72 JGit v5.3.6.201910020505-r
Change-Id: I12d1c6af03f2d7474c99c22cd2aabb77e95fcb32
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-02 11:03:41 +02:00
Matthias Sohn e59a17d733 Merge branch 'stable-5.2' into stable-5.3
* 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>
2019-10-02 11:01:39 +02:00
Matthias Sohn 3cb3ac95b2 Merge branch 'stable-5.1' into stable-5.2
# 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>
2019-10-02 10:56:15 +02:00
Matthias Sohn 929dd414c1 Prepare 5.1.13-SNAPSHOT builds
Change-Id: Ic1dca14924f49ad07eb5cd0570ce7ece9f319d0d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-02 00:40:49 +02:00
Matthias Sohn ebe1e15781 JGit v5.1.12.201910011832-r
Change-Id: I69fef9b2cdc18bbf1c8b9b290fb3d190684be13c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-02 00:32:04 +02:00
Luca Milanesio 3b5a4416aa Rename servlet-api-3_1 to match Gerrit master
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>
2019-10-01 14:11:43 -04:00
Han-Wen Nienhuys a358d0c53b reftable: move AutoCloseable to ReftableReader
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>
2019-09-27 18:57:10 +02:00
Saša Živkov 3d8649ddef Do not rely on ArrayIndexOutOfBoundsException to detect end of input
In the Config#StringReader we relied on ArrayIndexOutOfBoundsException
to detect the end of the input. Creation of exception with (deep) stack
trace can significantly degrade performance in case when we read
thousands of config files, like in the case when Gerrit reads all
external ids from the NoteDb.

Use the buf.length to detect the end of the input.

Change-Id: I12266f25751373a870ce3fa623cf2a95d882d521
2019-09-27 15:58:10 +02:00
Matthias Sohn e7a48bce3f Add missing braces in CherryPickCommand
Change-Id: I4b038ba7f86a45eb52422d3c2b4c4fc30ea16362
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-26 09:37:14 -04:00
Matthias Sohn cda3b2b492 Fire WorkingTreeModifiedEvent if cherry-pick failed with conflicts
Otherwise the paths modified by a cherry-pick with conflicts won't be
reported as modified via WorkingTreeModifiedEvents.

Change-Id: I875b67c0d2f68efdf90a9c32b80a2e074ed3570d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-09-26 15:10:05 +02:00