Commit Graph

5339 Commits

Author SHA1 Message Date
Thomas Wolf e8c3619063 DirCacheCheckout: don't use deprecated method
Pass the CheckoutMetadata to checkoutEntry(), otherwise cr-lf settings
and smudge filters would be ignored.

Change-Id: Ifb1c4cb098a0b47c9752d0231d530db6a92b25a4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-11-03 10:14:40 +01:00
Thomas Wolf 64f2407f19 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>
2019-11-03 10:10:16 +01:00
David Pursehouse b29e9bd1cb Merge "HttpSupport.proxyFor(): use only scheme, host, and port" 2019-10-30 19:20:30 -04:00
Han-Wen Nienhuys 7c75a68b96 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.

Change-Id: I1eedd18f028180069f78c5c467169dcfe1521157
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2019-10-30 18:00:24 +01:00
Thomas Wolf b7d1eb4185 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>
2019-10-30 15:16:51 +01:00
David Pursehouse 078500ef1c Merge "[errorprone] Don't throw exception in finally" 2019-10-25 21:56:06 -04:00
David Pursehouse 66aa2cc30c Merge "[errorprone] Add parenthesis to clarify operator precedence" 2019-10-25 21:55:33 -04:00
Matthias Sohn 271051ef06 Replace "Rebase interactive" with "Interactive rebase"
The RepositoryState's description is shown in EGit's interactive rebase
view. Use the grammatically correct form.

Bug: 552359
Change-Id: I860ef730a67f2b34d7fabbfbda5ea65ead9270d2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-25 17:46:58 +02:00
Matthias Sohn 5625f70d25 [errorprone] Don't throw exception in finally
Instead log the problem. There is no reason to panic when we fail to
delete a single temporary file in java.io.tmpdir.

Change-Id: Idb867b3f07b090c7453ccd3688e94097df3b2672
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-25 15:27:36 +02:00
Matthias Sohn 6ba8f37ab7 [errorprone] Add parenthesis to clarify operator precedence
This fixes OperatorPrecedence error raised by errorprone on FS#findHook.

Change-Id: Ia15f61902c7deff7328c1afa066fc53152949bbf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-25 15:27:36 +02:00
Thomas Wolf 6a39da37fe 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.

[1] https://www.gnupg.org/documentation/manuals/gnupg/Specify-a-User-ID.html

Bug: 550335
Change-Id: I6ce482a099ff1a0dc9de45435cd4d3ec5b504f12
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-10-23 11:17:24 +02:00
Jonathan Tan d4404fb438 Merge "reftable: remove assert calls" 2019-10-22 17:07:00 -04:00
Han-Wen Nienhuys e4fd171da2 reftable: remove assert calls
The effect of assert is defined by compiler flags, so this code
introduced a potential vector for corruption. 

Change-Id: I12197432e4351a5bd4aa24d352a19937721845c3
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2019-10-22 11:59:24 +02:00
Gunnar Wagenknecht 4f83544e50 Merge "GpgKeyLocator: Return a signing key for a user instead of the master key" 2019-10-22 01:22:26 -04:00
Gunnar Wagenknecht 748db6a0d6 Merge "GpgKeyLocator: Return subkeys instead of the first key for subkeys" 2019-10-22 01:21:34 -04:00
Roan Hofland 0902e060f7
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.

Bug: 552288
Change-Id: I194862991d13c2c7ff34a60a54a227167f88f53b
Signed-off-by: Roan Hofland <roan.hofland@hotmail.com>
2019-10-22 02:28:18 +02:00
Roan Hofland 68b8317a09
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.

Bug: 552288
Change-Id: I1c1cdf64c1667316a274ff9d829fc2b563797f2a
Signed-off-by: Roan Hofland <roan.hofland@hotmail.com>
2019-10-22 02:26:23 +02:00
Thomas Wolf 385b503ae8 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>
2019-10-21 18:05:31 -04:00
Matthias Sohn 6216b0de8a Implement mirror option in CloneCommand
Bug: 552173
Change-Id: If79adf578b303890314a3285d7a6d2c71f48d091
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-10-21 09:27:13 +02:00
David Pursehouse 98cdca9b5a Enable and fix "Statement unnecessarily nested within else clause" warnings
Since [1] the gerrit project includes jgit as a submodule, and has this
warning enabled, resulting in 100s of warnings in the console.

Also enable the warning here, and fix them.

At the same time, add missing braces around adjacent and nearby one-line
blocks.

[1] https://gerrit-review.googlesource.com/c/gerrit/+/227897

Change-Id: I81df3fc7ed6eedf6874ce1a3bedfa727a1897e4c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-10-17 10:20:14 +09:00
Jonathan Tan 88bd901492 Merge "reftable: split off generic code from DFS code" 2019-10-16 15:13:53 -04:00
Han-Wen Nienhuys 2b1e942729 reftable: split off generic code from DFS code
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>
2019-10-16 19:44:30 +02:00
Jonathan Tan 3b96aeb2c9 Merge "reftable: fix lookup by ID in merged reftables" 2019-10-16 13:33:20 -04:00
Han-Wen Nienhuys 218bacdc1f 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.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I41e9cd395b0608eedeeaead0a9fd997238d747c9
2019-10-16 15:15:55 +02: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 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
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
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
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 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
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
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 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
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
Han-Wen Nienhuys e5880d9531 reftable: pass OutputStream at construction time
This makes the intended use of the classes more clear. It also
simplifies generic functions that write reftables: they only need a
ReftableWriter as argument, as the stream is carried within the
ReftableWriter.

Change-Id: Idbb06f89ae33100f0c0b562cc38e5b3b026d5181
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-20 01:48:11 +02:00
Han-Wen Nienhuys d75a6b5d81 dfs: rename ReftableStack to DfsReftableStack
The functionality in ReftableStack is specific to DFS.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: If6003d104b1ecb0f3ca7e9c3815b233fa0abf077
2019-09-19 18:32:20 +02:00
Han-Wen Nienhuys 33dc08c162 reftable: add maxUpdateIndex to Reftable
This makes maxUpdateIndex() available in MergedReftable, so we can
know generically at which index to create the next reftable in a
stack.

Change-Id: Ia2314bc57c8b5dd7e69d5e61096fdce1d35abd11
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2019-09-19 18:32:20 +02:00
Matthias Sohn 7be05205dd Merge branch 'stable-5.5'
* stable-5.5:
  WorkingTreeIterator: handle different timestamp resolutions

Change-Id: I61df7392d8826ab526c39da2a8718723a1cc602a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-17 00:42:32 +02:00
Matthias Sohn 37c8b35344 Merge branch 'stable-5.4' into stable-5.5
* stable-5.4:
  WorkingTreeIterator: handle different timestamp resolutions

Change-Id: I83384336e0d766237d0579152673c9eefc9edd65
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-17 00:41:35 +02:00
Matthias Sohn 35339b455e Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  WorkingTreeIterator: handle different timestamp resolutions

Change-Id: I87afe29578b0270c79bc54c4e2cfda579c329237
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-17 00:40:50 +02:00
Matthias Sohn 84022ac9de Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  WorkingTreeIterator: handle different timestamp resolutions

Change-Id: Ia2a38949089a66abb5f4f1cd41717d2ae8d0eb5b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-17 00:39:54 +02:00
Matthias Sohn 831ba0a628 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  WorkingTreeIterator: handle different timestamp resolutions

Change-Id: Ic33ebec963af03a182dfe8f46486f5e8d00c0694
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-17 00:38:32 +02:00
Thomas Wolf e3f535cb15 WorkingTreeIterator: handle different timestamp resolutions
Older JGit stored only milliseconds timestamps in the index. Newer
JGit may get finer timestamps from the file system. This leads to
slow index diffs when a new JGit runs against an index produced
by older JGit because many timestamps will differ and JGit will
then do many content checks. See [1].

Handle this migration case by only comparing milliseconds if the
index entry has only millisecond precision.

The inverse may also occur; also compare only milliseconds if the
file timestamp has only millisecond precision.

Do the same also for microsecond resolution. On Windows, NTFS may
provide 100ns resolution and may be used by external programs writing
the index, but Java's WindowsFileAttributes may provide only
microseconds.

File timestamp precision in Java depends not only on the Java APIs
used by different JGit versions but may also change when running the
same Java code on different VMs. And of course the resolution may
vary among operating and file systems. Moreover, timestamp precision
in the index depends on the program that wrote the index. Canonical
git may use a different resolution, maybe even different between git
versions.

[1] https://www.eclipse.org/forums/index.php/t/1100344/

Change-Id: Idfd08606c883cb98787b2138f9baf0cc89a57b56
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-17 00:36:22 +02:00
Thomas Wolf 2e75fe6be1 Remove an old work-around for core.autocrlf = input
The removed code was trying to avoid mistakenly reporting differences
when core.autocrlf was set to "input" but a file had already been
committed with CR-LF. It did that by running the blob from the cache
through a CRLF-to-LF filter because older JGit would also run the file
from the working tree through such a filter.

The real fix for this case was done in commit 60cf85a. Since then files
are not normalized if they have already been committed with CR-LF and
this old fix attempt from bug 372834 is no longer needed.

Change-Id: Ib4facc153d81325cb48b4ee956a596b423f36241
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-09-12 12:02:11 +02:00
David Pursehouse 0bfba11186 Merge "Merge branch 'stable-5.5'" 2019-09-11 20:53:12 -04:00
Matthias Sohn 5c29fdd23c Merge branch 'stable-5.5'
* stable-5.5:
  Prepare 5.5.1-SNAPSHOT builds
  JGit v5.5.0.201909110433-r
  Fix WorkingTreeIterator.compareMetadata() for CheckStat.MINIMAL

Change-Id: I113ce255739786623f7e101dc293b9a769abeff0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-11 22:19:16 +02:00
Han-Wen Nienhuys c78fbf23a5 dfs: use ReftableConfig() constructor in DfsReftableDatabase
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I756f086fccaba8e77db516160c14708f97519f93
2019-09-11 13:01:56 +02:00
Han-Wen Nienhuys 434e6c732a dfs: use RefDatabase API for exactRef in ReftableBatchRefUpdate
This removes one use of DFS specific code in this class.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I3ef6a4b98357cc6dc480892244ddc51d2fd751a2
2019-09-11 13:01:56 +02:00
Han-Wen Nienhuys 5c390cf9de reftable: add OutputStream argument to ReftableWriter constructor
This lets us write reftables generically with functions that take
just ReftableWriter argument

Change-Id: I7285951f62f9bd4c78e8f0de194c077d51fa4e51
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2019-09-11 13:01:56 +02:00
Han-Wen Nienhuys 90efbd216f reftable: read file footer in ReftableReader#allRefs
allRefs determined the end of the ref block without accounting for
index or log blocks. This could cause other blocks to be interpreted
as ref blocks, leading to "invalid block" error messages.

Change-Id: I7b9323e7d5e0e7d64535b3ec1efd576aed1e9870
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2019-09-11 13:01:56 +02:00
Han-Wen Nienhuys 726bcc4fdb reftable: add ReftableReflogReader
Change-Id: Iac2c4ac5e3aad0fa37157ed8866f1987d80268d6
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
2019-09-11 12:59:55 +02:00
Matthias Sohn 7f262b8745 Prepare 5.5.1-SNAPSHOT builds
Change-Id: Iaf929168770dfef54ce2a7bfcbee9b87c450ca8a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-11 11:46:58 +02:00
Matthias Sohn de2df8adde JGit v5.5.0.201909110433-r
Change-Id: I5715730ac47d32462f235c2f50581bf1579d46b9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-11 10:31:38 +02:00
Matthias Sohn 524fd0d8c6 Merge branch 'stable-5.4' into stable-5.5
* stable-5.4:
  Fix WorkingTreeIterator.compareMetadata() for CheckStat.MINIMAL

Change-Id: Ibdda7687da015b17cdca67427202766fe102fee1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-10 22:03:06 +02:00
Matthias Sohn 3c0230d844 Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Fix WorkingTreeIterator.compareMetadata() for CheckStat.MINIMAL

Change-Id: Ie8447fc28b03bfc918cee0cc2162a2aa3585f3ea
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-10 22:00:40 +02:00
Matthias Sohn 8f96e1bebb Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Fix WorkingTreeIterator.compareMetadata() for CheckStat.MINIMAL

Change-Id: I57093dfef181645088767471159c204c50961c3a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-10 21:26:40 +02:00
Matthias Sohn 718a8b11b3 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Fix WorkingTreeIterator.compareMetadata() for CheckStat.MINIMAL

Change-Id: Ic4ee37fb36f61dc7707391f768bf78a33094bfd3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-10 21:26:04 +02:00
Matthias Sohn 84ac86ee61 Fix WorkingTreeIterator.compareMetadata() for CheckStat.MINIMAL
If CheckStat is MINIMAL or timestamps have no nanosecond part
WorkingTreeIterator.compareMetaData only checks the second part of
timestamps and ignores nanoseconds which may have ended up in the index
by using native git.

If

fileLastModified.getEpochSecond() == cacheLastModified.getEpochSecond()

we currently proceed comparing fileLastModified and cacheLastModified
with full precision which is wrong since we determined that we detected
reduced timestamp resolution.

Fix this and also handle smudged index entries for CheckStat.MINIMAL.

Change-Id: I6149885903ac63d79b42d234cc02aa4e19578f3c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-10 16:08:45 +02:00
Matthias Sohn 830e214805 Merge branch 'stable-5.5'
* stable-5.5:
  bazel: fix running http tests
  Set parameter name in parameterized http tests
  Format BUILD files with buildifier
  Format BUILD files with buildifier
  [error prone] Suppress NonAtomicVolatileUpdate in SimpleLruCache
  Bazel: Format BUILD files with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: Idb0848dd33a76328b24908dc86db335cca742a1c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-08 17:36:59 +02:00
Matthias Sohn b31d5360f0 Merge branch 'stable-5.4' into stable-5.5
* stable-5.4:
  Format BUILD files with buildifier
  Format BUILD files with buildifier
  [error prone] Suppress NonAtomicVolatileUpdate in SimpleLruCache
  Bazel: Format BUILD files with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: Idf3abd80ad3b00188f655e638d9908228770911f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-08 17:35:14 +02:00
Matthias Sohn 80fd4cb075 Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Format BUILD files with buildifier
  [error prone] Suppress NonAtomicVolatileUpdate in SimpleLruCache
  Bazel: Format BUILD files with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: Iaea77a89fcd821df5dbb24f5e3e39e6d1dfc0bd4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-08 15:05:19 +02:00
Matthias Sohn 82badd0a87 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  [error prone] Suppress NonAtomicVolatileUpdate in SimpleLruCache
  Bazel: Format BUILD files with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: I0d8b7f79177a20dc00c89e2cf0005eb3d3039532
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-08 11:17:32 +02:00
Matthias Sohn d4752e2900 [error prone] Suppress NonAtomicVolatileUpdate in SimpleLruCache
We don't need to update time atomically since it's only used to order
cache entries in LRU order.

Change-Id: I756fa6d90b180c519bf52925f134763744f2c1f1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-08 10:37:54 +02:00
Matthias Sohn 38198972d4 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Bazel: Fix warning about deprecated lib.bzl
  Format lib/BUILD with buildifier
  Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
  Bazel: Bump minimum supported version to 0.29.0
  Bazel: Bump skylib library version to 0.8.0
  Use bazelisk to switch between used bazel version
  Bazel: Require minimum bazel version 0.17.1
  Fix wrong placeholder index in error message packInaccessible
  JGitText: Remove unused externalized strings
  RepoText: Remove unused externalized string
  CLI: Remove unused externalized strings

Change-Id: Iea37a8e39e9d4872dc607c9222dcf191ce4e4757
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-07 12:16:42 +02:00
David Pursehouse 85cea8c583 Bazel: Add fixes for --incompatible_load_java_rules_from_bzl
Change-Id: I24746335db132bf20f400cb3db400737596d4542
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-09-07 15:36:11 +09:00
Matthias Sohn 185dc84623 Fix wrong placeholder index in error message packInaccessible
See: https://www.eclipse.org/lists/jgit-dev/msg03850.html
Change-Id: I0e121a2b7ac399f4a663fa49ab330d27363e9a55
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-07 01:19:07 +02:00
David Pursehouse 8792743c51 JGitText: Remove unused externalized strings
Change-Id: I995d7a1b6ab2866221eee9f5cb828b97192daf4a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-09-07 01:19:07 +02:00
David Pursehouse 689474248c RepoText: Remove unused externalized string
Change-Id: Ida47637f54afdb76513be9b04aae32107567d4e3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-09-07 01:19:06 +02:00
Yunjie Li ea9231b39d ReceivePack: Prevent pointing a branch to a non-commit object
Since commit c3b0dec509fe136c5417422f31898b5a4e2d5e02, Git has
disallowed writing a non-commit to refs/heads/* refs.  JGit still
allows that, which can put users in a bad situation.  For example,

	git push origin v1.0:master

pushes the tag object v1.0 to refs/heads/master, instead of the
intended commit object v1.0^{commit}.

Prevent that by validating that the target of the ref points to a
commit object when pushing to refs/heads/*.

Git performs the same check at a lower level (in the RefDatabase).  We
could do the same here, but for now let's start conservatively by
handling it in pushes first.

[jn: fleshed out commit message]

Change-Id: I8f98ae6d8acbcd5ef7553ec732bc096cb6eb7c4e
Signed-off-by: Yunjie Li <yunjieli@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
2019-09-06 12:18:17 -07:00
Matthias Sohn fdd63b183c Prepare 5.5.0-SNAPSHOT builds
Change-Id: I96bbefd698c74e450d05d21572d4769c6c5aaea6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 18:00:19 +02:00
Matthias Sohn 685f2f8ec4 JGit v5.5.0.201909041048-rc1
Change-Id: I77a8c73cfd0a27b1242eddf32da513ce0148260e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 16:47:57 +02:00
Matthias Sohn 4d78215673 Merge branch 'stable-5.5'
* stable-5.5:
  Prepare 5.4.4-SNAPSHOT builds
  JGit v5.4.3.201909031940-r
  Prepare 5.3.6-SNAPSHOT builds
  JGit v5.3.5.201909031855-r
  Prepare 5.1.12-SNAPSHOT builds
  JGit v5.1.11.201909031202-r
  Prepare 4.11.10-SNAPSHOT builds
  JGit v4.11.9.201909030838-r
  Bazel: Update bazlets to the latest master revision
  Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file
  BatchRefUpdate: repro racy atomic update, and fix it
  Delete unused FileTreeIteratorWithTimeControl
  Fix RacyGitTests#testRacyGitDetection
  Change RacyGitTests to create a racy git situation in a stable way
  Silence API warnings
  sshd: fix proxy connections with the DefaultProxyDataFactory
  sshd: support the HashKnownHosts configuration
  sshd: configurable server key verification
  sshd: allow setting a null ssh config
  sshd: simplify OpenSshServerKeyVerifier
  sshd: simplify ServerKeyLookup interface
  Use https in update site URLs

Change-Id: Icd21a8fcccffd56bfedbd037e48028308db6d13b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 02:43:03 +02:00
Matthias Sohn 8f742b9d30 Merge branch 'stable-5.4' into stable-5.5
* stable-5.4:
  Prepare 5.4.4-SNAPSHOT builds
  JGit v5.4.3.201909031940-r
  Prepare 5.3.6-SNAPSHOT builds
  JGit v5.3.5.201909031855-r
  Prepare 5.1.12-SNAPSHOT builds
  JGit v5.1.11.201909031202-r
  Prepare 4.11.10-SNAPSHOT builds
  JGit v4.11.9.201909030838-r
  Bazel: Update bazlets to the latest master revision
  Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file
  BatchRefUpdate: repro racy atomic update, and fix it
  Delete unused FileTreeIteratorWithTimeControl
  Fix RacyGitTests#testRacyGitDetection
  Change RacyGitTests to create a racy git situation in a stable way
  Silence API warnings

Change-Id: Icd6630db6458971f840c3ab4553e00f6c775ede0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 02:24:09 +02:00
Matthias Sohn 32116da0cd Prepare 5.4.4-SNAPSHOT builds
Change-Id: I64c03436c285bd8eb5e87abe560417402b60e695
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 01:48:25 +02:00
Matthias Sohn fb08804e91 JGit v5.4.3.201909031940-r
Change-Id: I48ff1d51122ff73e0561f1fcf52a532221810e5d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 01:40:09 +02:00
Matthias Sohn 7cdb01939e Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Prepare 5.3.6-SNAPSHOT builds
  JGit v5.3.5.201909031855-r
  Prepare 5.1.12-SNAPSHOT builds
  JGit v5.1.11.201909031202-r
  Prepare 4.11.10-SNAPSHOT builds
  JGit v4.11.9.201909030838-r
  Bazel: Update bazlets to the latest master revision
  Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file
  BatchRefUpdate: repro racy atomic update, and fix it
  Delete unused FileTreeIteratorWithTimeControl
  Fix RacyGitTests#testRacyGitDetection
  Change RacyGitTests to create a racy git situation in a stable way
  Silence API warnings

Change-Id: Icfd5a612055feeff04733c0d2c44837ab554a2c4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 01:28:15 +02:00
Matthias Sohn 927ae2f55b Prepare 5.3.6-SNAPSHOT builds
Change-Id: I4d57f8ea0ab1f8fbd73fd75861f2f751c4aba0a6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 01:03:41 +02:00
Matthias Sohn 2a3c8a86aa JGit v5.3.5.201909031855-r
Change-Id: I7f5dcebc2e5816c845fa63046c67bc2301926e2a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 00:54:34 +02:00
Matthias Sohn 4a3cd7f1b7 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Prepare 5.1.12-SNAPSHOT builds
  JGit v5.1.11.201909031202-r
  Prepare 4.11.10-SNAPSHOT builds
  JGit v4.11.9.201909030838-r
  Bazel: Update bazlets to the latest master revision
  Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file
  BatchRefUpdate: repro racy atomic update, and fix it
  Delete unused FileTreeIteratorWithTimeControl
  Fix RacyGitTests#testRacyGitDetection
  Change RacyGitTests to create a racy git situation in a stable way
  Silence API warnings

Change-Id: I7e88c7c7d202f1e3fb8e143277650aa5fefff439
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 00:49:42 +02:00
Matthias Sohn aa62f191d0 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Prepare 5.1.12-SNAPSHOT builds
  JGit v5.1.11.201909031202-r
  Prepare 4.11.10-SNAPSHOT builds
  JGit v4.11.9.201909030838-r
  Bazel: Update bazlets to the latest master revision
  Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file
  BatchRefUpdate: repro racy atomic update, and fix it
  Delete unused FileTreeIteratorWithTimeControl
  Fix RacyGitTests#testRacyGitDetection
  Change RacyGitTests to create a racy git situation in a stable way
  Silence API warnings

Change-Id: Iac5dc9683cea97db04d20f27c10f2e103d3ae7b5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-04 00:08:21 +02:00
Matthias Sohn c8e42ca3ba Prepare 5.1.12-SNAPSHOT builds
Change-Id: I353ac3f23024063722abc7340bc9a6df3c615741
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-03 22:56:39 +02:00
Matthias Sohn 002f1628c6 JGit v5.1.11.201909031202-r
Change-Id: I288acf670160b9bcd2d04f572a902b5838b4d4f8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-03 18:01:55 +02:00
Matthias Sohn 7aec793266 Merge branch 'stable-5.0' into stable-5.1
* stable-5.0:
  Prepare 4.11.10-SNAPSHOT builds
  JGit v4.11.9.201909030838-r
  Bazel: Update bazlets to the latest master revision
  Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file
  BatchRefUpdate: repro racy atomic update, and fix it
  Delete unused FileTreeIteratorWithTimeControl
  Fix RacyGitTests#testRacyGitDetection
  Change RacyGitTests to create a racy git situation in a stable way
  Silence API warnings

Change-Id: I172136a031ff0730e575327cafb3527c9650a71d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-03 17:40:19 +02:00
Matthias Sohn c31879ac4e Merge branch 'stable-4.11' into stable-5.0
* stable-4.11:
  Prepare 4.11.10-SNAPSHOT builds
  JGit v4.11.9.201909030838-r
  Bazel: Update bazlets to the latest master revision
  Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file
  BatchRefUpdate: repro racy atomic update, and fix it
  Delete unused FileTreeIteratorWithTimeControl
  Fix RacyGitTests#testRacyGitDetection
  Change RacyGitTests to create a racy git situation in a stable way
  Silence API warnings

Change-Id: Ifb6a4dbea2f48fd2ffa66eb737d61920aefedfbd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-03 15:59:39 +02:00
Matthias Sohn 261881055d Prepare 4.11.10-SNAPSHOT builds
Change-Id: Ic98bd87d96ce627d38e1ecc2c3cb28b517ab489e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-03 14:49:20 +02:00
Matthias Sohn 9a2deb2049 JGit v4.11.9.201909030838-r
Change-Id: Ie60468569074197d49e19cbd0ffaedfe88f3d74e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-03 14:37:49 +02:00
Matthias Sohn b0fd436c62 Merge branch 'stable-4.10' into stable-4.11
* stable-4.10:
  Bazel: Update bazlets to the latest master revision
  Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file
  BatchRefUpdate: repro racy atomic update, and fix it
  Delete unused FileTreeIteratorWithTimeControl
  Fix RacyGitTests#testRacyGitDetection
  Change RacyGitTests to create a racy git situation in a stable way
  Silence API warnings

Change-Id: If672b4f0c350f4e8ff7e1e706485cffd8137236d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-03 14:28:49 +02:00
Matthias Sohn b525036e58 Merge branch 'stable-4.9' into stable-4.10
* stable-4.9:
  BatchRefUpdate: repro racy atomic update, and fix it
  Delete unused FileTreeIteratorWithTimeControl
  Fix RacyGitTests#testRacyGitDetection
  Change RacyGitTests to create a racy git situation in a stable way
  Silence API warnings

Change-Id: Id5bf44645655fca40ad22bb1f1ad20a7c2e8f6db
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-03 14:20:37 +02:00
Han-Wen Nienhuys 0e3d4a273f BatchRefUpdate: repro racy atomic update, and fix it
PackedBatchRefUpdate was creating a new packed-refs list that was
potentially unsorted. This would be papered over when the list was
read back from disk in parsePackedRef, which detects unsorted ref
lists on reading, and sorts them. However, the BatchRefUpdate also
installed the new (unsorted) list in-memory in
RefDirectory#packedRefs.

With the timestamp granularity code committed to stable-5.1, we can
more often accurately decide that the packed-refs file is clean, and
will return the erroneous unsorted data more often. Unluckily timed
delays also cause the file to be clean, hence this problem was
exacerbated under load.

The symptom is that refs added by a BatchRefUpdate would stop being
visible directly after they were added. In particular, the Gerrit
integration tests uses BatchRefUpdate in its setup for creating the
Admin group, and then tries to read it out directly afterward.

The tests recreates one failure case. A better approach would be to
revise RefList.Builder, so it detects out-of-order lists and
automatically sorts them.

Fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=548716 and
https://bugs.chromium.org/p/gerrit/issues/detail?id=11373.

Bug: 548716
Change-Id: I613c8059964513ce2370543620725b540b3cb6d1
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-03 10:37:30 +02:00
Matthias Sohn 7e0cd90cf7 Silence API warnings
Change-Id: I27fd62de51ca0eedcc7e2e256487bda1e18bce8a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-09-03 02:55:37 +02:00
Thomas Wolf 2d34d0bd9c sshd: support the HashKnownHosts configuration
Add the constant, and implement hashing of known host names in
OpenSshServerKeyDatabase. Add a test verifying that the hashing
works.

Bug: 548492
Change-Id: Iabe82b666da627bd7f4d82519a366d166aa9ddd4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-09-02 21:30:27 +02:00
David Pursehouse 2f751c34e1 Merge changes I1217f5f2,Iba037e0e,I61e6c93c,I6304d1cb
* changes:
  dfs: Take size as long instead of int
  dfs: Read at the aligned position
  dfs: Add a position argument
  dfs: Move the deeply nested code to its own method
2019-08-30 07:09:51 -04:00
Jonathan Nieder 14ff64b587 Merge branch 'stable-5.5'
* stable-5.5:
  Return a new instance from openSystemConfig and openUserConfig

Change-Id: I3ba9fa8ceced6e9f883fc23afb0e2c812391beac
Signed-off-by: Jonathan Nieder <jrn@google.com>
2019-08-29 18:17:10 -07:00
Jonathan Nieder 66ac51781a Merge branch 'stable-5.4' into stable-5.5
* stable-5.4:
  Return a new instance from openSystemConfig and openUserConfig

Change-Id: If576513ebbd80c7f01b83be5ab2edd436f5739e3
Signed-off-by: Jonathan Nieder <jrn@google.com>
2019-08-29 18:16:52 -07:00
Jonathan Nieder 013f2621d0 Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Return a new instance from openSystemConfig and openUserConfig

Change-Id: I5f2f957ff27b7941ab29b2dc1c885fbf0093705a
Signed-off-by: Jonathan Nieder <jrn@google.com>
2019-08-29 18:16:39 -07:00
Jonathan Nieder 47a95d1aed Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Return a new instance from openSystemConfig and openUserConfig

Change-Id: I6491549ab13aad2a4c3f8444a090a94a378eccdb
Signed-off-by: Jonathan Nieder <jrn@google.com>
2019-08-29 18:16:29 -07:00
Jonathan Nieder 60283a58a7 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Return a new instance from openSystemConfig and openUserConfig

Change-Id: I93afa16b14e3e2d127705e3378fb703d6c329694
Signed-off-by: Jonathan Nieder <jrn@google.com>
2019-08-29 18:15:23 -07:00
Matthias Sohn af0296b42c Return a new instance from openSystemConfig and openUserConfig
Move the handling of cached user and system config to getSystemConfig
and getUserConfig methods and revert the implementation of
openSystemConfig and openUserConfig to the old stateless
implementation.

This ensures the open methods respect the passed-in parent config, which
may be different on each invocation. Additionally, returning a new
instance matches the behavior of the previous implementation of the
default system reader, which downstream callers may be depending on.

Move the implementation of the new caching methods getSystemConfig and
getUserConfig up to SystemReader. This avoids that we break the ABI for
subclasses of SystemReader.

Also see [1] which fixed a similar problem with Gerrit's custom
SystemReader.

[1] https://gerrit-review.googlesource.com/c/gerrit/+/225458

Change-Id: If54a2491932d8fc914d4649cb73c9e837c5b8ad0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-30 02:34:13 +02:00
Matthias Sohn 5e24753ab0 Prepare 5.6.0-SNAPSHOT builds
Change-Id: I9eceb7b1272b27b979144041c75eb09ab4eeca6b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-29 10:08:52 +02:00
Matthias Sohn 1cda44bb8f Merge branch 'stable-5.5'
* stable-5.5:
  Update Orbit to S20190827152740 for 2019-09 RC1
  Silence warnings for non-externalized strings
  Prepare 5.5.0-SNAPSHOT builds
  JGit v5.5.0.201908280940-m3

Change-Id: I8298387fac1899df3f2fdc808cef33a9a7c7b2ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-29 10:08:15 +02:00
Matthias Sohn cd9422f239 Silence warnings for non-externalized strings
These warnings were missed to address in a0048208 which introduced them.

Change-Id: Ia2d15fdce72c10378d020682b80fe7fc548c0d4c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-29 09:24:40 +02:00
Matthias Sohn d5a0d76ed0 Prepare 5.5.0-SNAPSHOT builds
Change-Id: Ib498303c8787a5fbee89377eaed332a5a6b4f3b0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-28 21:14:09 +02:00
Jonathan Tan f1f7b42882 DfsCachedPack: Add accessor for packfile object
In order to support implementations of CachedPackUriProvider (which need
to supply, among other things, the checksum of the packfile
corresponding to a CachedPack), in a004820858 ("UploadPack: support
custom packfile-to-URI mapping", 2019-08-20), the method getCheckSum()
was added to PackIndex. However, there is no way to access the PackIndex
from a DfsCachedPack.

Therefore, add an accessor for the DfsPackFile stored in the
DfsCachedPack. Now, a user who has a DfsCachedPack can use
DfsCachedPack#getPackFile then DfsPackFile#getPackIndex then
PackIndex#getCheckSum to obtain the checksum of a pack.

Change-Id: Ia010c016f6cac0f058ee20eff4c10f57338bfefc
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
2019-08-28 10:28:42 -07:00
Matthias Sohn e0ea41b500 JGit v5.5.0.201908280940-m3
Change-Id: I0920767979d7927bc18f3e395963aeebae5ea540
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-28 15:40:54 +02:00
Jonathan Tan f78446b56f Merge "RevWalk: Traverse all parents of UNINTERESTING commits" 2019-08-26 19:05:41 -04:00
Alex Spradlin a80df5380f RevWalk: Traverse all parents of UNINTERESTING commits
When firstParent is set, RevWalk traverses only the first parent of a
commit, even though that commit is UNINTERESTING. Since we want the
maximal UNINTERESTING set, we shouldn't prune any parents here. This
issue is apparent only when some of the commits being traversed are
unparsed, since walker.carryFlagsImpl() propagates the UNINTERESTING
flag to all parsed ancestors, masking the issue.

Therefore teach RevWalk to traverse all parents when a commit is
UNINTERESTING and not only the first parent. Since this issue is
masked by commit parsing, also test situations when the commits
involved are unparsed.

Signed-off-by: Alex Spradlin <alexaspradlin@google.com>
Change-Id: I95e2ad9ae8f1f50fbecae674367ee7e0855519b1
2019-08-26 15:53:42 -07:00
Matthias Sohn c1873b0604 Merge "Fix error occurring when SecurityManager is enabled" 2019-08-23 16:59:03 -04:00
Matthias Sohn ad5339a6b0 Merge branch 'stable-5.4'
* stable-5.4:
  Prepare 5.4.3-SNAPSHOT builds
  JGit v5.4.2.201908231537-r
  Prepare 5.3.5-SNAPSHOT builds
  JGit v5.3.4.201908231101-r
  Prepare 5.1.11-SNAPSHOT builds
  JGit v5.1.10.201908230655-r
  Use AtomicReferences to cache user and system level configs
  Fix copy-paste typo in CloneCommand#cleanup
  SystemReader: Use correct constructor of FileBasedConfig

Change-Id: I241dd1314f5535147ad641576a25f49cae6fe62d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 22:31:46 +02:00
Matthias Sohn 85a1d8bcf8 Prepare 5.4.3-SNAPSHOT builds
Change-Id: Iaf5140446dcf86a50bdb1a30860dfd624d3ec337
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 22:10:41 +02:00
Matthias Sohn 2c0f02244c JGit v5.4.2.201908231537-r
Change-Id: I1d808c63db81435173987c399c90bda7bc5c8d9d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 21:36:24 +02:00
Nail Samatov b9d2926df4 Fix error occurring when SecurityManager is enabled
It's expected that jgit should work without native git installation.
In such case Security Manager can be configured to deny access to the
files outside of git repository. JGit tries to find cygwin
installation. If Security manager restricts access to some folders
in PATH, it should be considered that those folders are absent
for jgit.
Also JGit tries to detect if symbolic links are supported by OS. If
security manager forbids creation of symlinks, it should be assumed
that symlinks aren't supported.

Bug: 550115
Change-Id: Ic4b243cada604bc1090db6cc1cfd74f0fa324b98
Signed-off-by: Nail Samatov <sanail@yandex.ru>
2019-08-23 20:38:26 +03:00
Matthias Sohn e6619980ed Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Prepare 5.3.5-SNAPSHOT builds
  JGit v5.3.4.201908231101-r
  Prepare 5.1.11-SNAPSHOT builds
  JGit v5.1.10.201908230655-r
  Use AtomicReferences to cache user and system level configs
  Fix copy-paste typo in CloneCommand#cleanup
  SystemReader: Use correct constructor of FileBasedConfig

Change-Id: I4422632766fc5554a20f75346c5480b7fb611484
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 17:59:49 +02:00
Matthias Sohn f30382b191 Prepare 5.3.5-SNAPSHOT builds
Change-Id: Ic0b9dfcac814ac7584e5eb19105f46344a10465a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 17:44:04 +02:00
Matthias Sohn 06309fdc43 JGit v5.3.4.201908231101-r
Change-Id: Ia98f47d9a10d6b8cccca6b697230dad4f350d720
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 17:01:29 +02:00
Matthias Sohn 6dfdfe1f67 Merge branch 'stable-5.2' into stable-5.3
* stable-5.2:
  Prepare 5.1.11-SNAPSHOT builds
  JGit v5.1.10.201908230655-r
  Use AtomicReferences to cache user and system level configs
  Fix copy-paste typo in CloneCommand#cleanup

Change-Id: I3ababc0f9b540cf1785925395d32a85d30aed40d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 17:00:11 +02:00
Matthias Sohn d999d12ad0 Merge branch 'stable-5.1' into stable-5.2
* stable-5.1:
  Prepare 5.1.11-SNAPSHOT builds
  JGit v5.1.10.201908230655-r
  Use AtomicReferences to cache user and system level configs
  Fix copy-paste typo in CloneCommand#cleanup

Change-Id: Ie383633de334e65901ed4c6deb2d59cfcce98e16
2019-08-23 16:00:38 +02:00
Matthias Sohn 418722df34 Prepare 5.1.11-SNAPSHOT builds
Change-Id: I8608580424d0e523dcace63f83ae530ba78dbb15
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 15:55:45 +02:00
Matthias Sohn 1c44bf8caf JGit v5.1.10.201908230655-r
Change-Id: I68d15ebd6054bdeaf62e14cddb87724828db7943
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 13:38:56 +02:00
Matthias Sohn d67fe38915 Use AtomicReferences to cache user and system level configs
This ensures that only one instance of user and one instance of system
config is set.

Change-Id: Idd00150f91d2d40af79499dd7bf8ad5940f87c4e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-23 05:07:05 -04:00
Adrien Bustany 28553c189c Fix copy-paste typo in CloneCommand#cleanup
deleteChildren was called on directory instead of gitDir, leading to a
potential null pointer exception if the git directory existed initially.

Bug: 550340
Change-Id: Iafc3b2961253a99862a59e81c7371f7bc564b412
Signed-off-by: Adrien Bustany <adrien-xx-eclipse@bustany.org>
2019-08-23 08:45:55 +09:00
David Pursehouse c2a5b7fdcf SystemReader: Use correct constructor of FileBasedConfig
The merge done in change If0c5010a2 resolved a conflict incorrectly
and reverted the fix that was done in change Id0bcdc93b.

Change-Id: I0f5fde33d1f366817f2b966eb42535f7bd3b063e
Reported-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-08-22 19:23:55 +09:00
Matthias Sohn 1553c94223 Merge branch 'stable-5.4'
* stable-5.4:
  Prepare 5.4.2-SNAPSHOT builds
  JGit v5.4.1.201908211225-r
  Prepare 5.3.4-SNAPSHOT builds
  JGit v5.3.3.201908210735-r
  Add missing @since tag on FileTreeIterator#getLastModifiedInstant
  Prepare 5.1.10-SNAPSHOT builds
  JGit v5.1.9.201908210455-r
  Avoid sign extension when comparing mtime with Instant#getEpochSecond
  Fix deprecation in DirCache caused by Instant based DirCacheEntry

Change-Id: I63156d6b73044d5d8820869a397a0aa94e607b50
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-21 22:39:47 +02:00
Matthias Sohn 2eb83f4b4a Prepare 5.4.2-SNAPSHOT builds
Change-Id: I5b2fde2d69ef1cc11b085874ab783ba48e070470
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-21 18:26:36 +02:00
Matthias Sohn 0af59e1212 JGit v5.4.1.201908211225-r
Change-Id: Ifa99b930bd20a9bc10696c414c73ebde0cd4b0c8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-21 18:17:59 +02:00
Matthias Sohn 5c93bbd344 Merge branch 'stable-5.3' into stable-5.4
* stable-5.3:
  Prepare 5.3.4-SNAPSHOT builds
  JGit v5.3.3.201908210735-r
  Add missing @since tag on FileTreeIterator#getLastModifiedInstant
  Prepare 5.1.10-SNAPSHOT builds
  JGit v5.1.9.201908210455-r
  Avoid sign extension when comparing mtime with Instant#getEpochSecond
  Fix deprecation in DirCache caused by Instant based DirCacheEntry

Change-Id: Ic3c8d3adf522b73f87c713538a14697eb690f508
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-21 18:16:23 +02:00
Matthias Sohn bbf3da1aac Prepare 5.3.4-SNAPSHOT builds
Change-Id: I1ccfeb28e87d13b25a8892947e62f1151130b6a6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-21 17:45:59 +02:00
Matthias Sohn e9fcf1932e JGit v5.3.3.201908210735-r
Change-Id: I799859e47616af0ac5ee3a982cb9350d141681d7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-08-21 13:30:43 +02:00