]> source.dussan.org Git - jgit.git/log
jgit.git
4 years agoRemove unused imports 52/166552/1
Matthias Sohn [Sun, 19 Jul 2020 10:00:35 +0000 (12:00 +0200)]
Remove unused imports

Change-Id: I7c44e3603df2dd368cb7c0ba0072413b887b6903
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoPrepare 5.1.14-SNAPSHOT builds 77/157477/1
Matthias Sohn [Tue, 11 Feb 2020 10:12:20 +0000 (11:12 +0100)]
Prepare 5.1.14-SNAPSHOT builds

Change-Id: Ic7d6f1a6c3123af1a1fa782f052b0cea3b6f28c6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoJGit v5.1.13.202002110435-r 75/157475/1 v5.1.13.202002110435-r
Matthias Sohn [Tue, 11 Feb 2020 09:30:36 +0000 (10:30 +0100)]
JGit v5.1.13.202002110435-r

Change-Id: Iedc8699ad1a24efe7ddb47ae919c75b9d36141d4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoFix string format parameter for invalidRefAdvertisementLine 18/156918/1
David Pursehouse [Thu, 30 Jan 2020 23:38:24 +0000 (08:38 +0900)]
Fix string format parameter for invalidRefAdvertisementLine

The externalized error message added in f4fc640 ("BasePackConnection:
Check for expected length of ref advertisement", Dec 18, 2019) uses a
malformed string format. Since there is only one formatting argument,
it should be referenced with '{0}' rather than '{1}'.

Change-Id: Ibda864dfb0bb902fe07ae4bba73117b212046e8a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoWindowCache: add metric for cached bytes per repository 73/155173/7
Matthias Sohn [Fri, 3 Jan 2020 17:16:42 +0000 (18:16 +0100)]
WindowCache: add metric for cached bytes per repository

Since ObjectDatabase and PackFile don't know their repository use the
packfile's grand-grand-parent directory as an identifier for the
repository the packfile resides in.

Remove metric for a repository if the number of cached bytes for the
repository drops to 0 in order to ensure the map of cached bytes per
repository doesn't contain repositories which have no data cached in the
WindowCache.

Change-Id: I969ab8029db0a292e7585cbb36ca0baa797da20b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agopgm daemon: fallback to user and system config if no config specified 83/156683/2
Matthias Sohn [Mon, 27 Jan 2020 22:00:57 +0000 (23:00 +0100)]
pgm daemon: fallback to user and system config if no config specified

If a config file is passed via option --config-file then use only the
options defined in that file. This helps to concisely configure the
daemon without side effects from global and system level git configs.

Otherwise fallback to user and system level configs.

Change-Id: I242de248f257579874ad0bfe4882a22502353b1f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoWindowCache: add option to use strong refs to reference ByteWindows 49/155149/5
Matthias Sohn [Fri, 13 Dec 2019 00:18:12 +0000 (01:18 +0100)]
WindowCache: add option to use strong refs to reference ByteWindows

Java GC evicts all SoftReferences when the used heap size comes close to
the maximum heap size. This means peaks in heap memory consumption can
flush the complete WindowCache which was observed to have negative
impact on performance of upload-pack in Gerrit.

Hence add a boolean option core.packedGitUseStrongRefs to allow using
strong references to reference packfile pages cached in the WindowCache.

If this option is set to true Java gc can no longer flush the
WindowCache to free memory if the used heap comes close to the maximum
heap size. On the other hand this provides more predictable performance.

Bug: 553573
Change-Id: I9de406293087ab0fa61130c8e0829775762ece8d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoReplace usage of ArrayIndexOutOfBoundsException in treewalk 32/155532/3
Patrick Hiesel [Thu, 9 Jan 2020 09:23:12 +0000 (10:23 +0100)]
Replace usage of ArrayIndexOutOfBoundsException in treewalk

Using exceptions during normal operations - for example with the
desire of expanding an array in the failure case - can have a
severe performance impact. When exceptions are instantiated,
a stack trace is collected. Generating stack trace can be expensive.

Compared to that, checking an array for length - even if done many
times - is cheap since this is a check that can run in just a
handful of CPU cycles.

Change-Id: Ifaf10623f6a876c9faecfa44654c9296315adfcb
Signed-off-by: Patrick Hiesel <hiesel@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoAdd config constants for WindowCache configuration options 48/155148/2
Matthias Sohn [Thu, 2 Jan 2020 23:52:37 +0000 (00:52 +0100)]
Add config constants for WindowCache configuration options

Change-Id: Icc5265f87ae58aa1e667ed1827075c4a30f75c32
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoFix unclosed resource warning in SmartOutputStream 12/155212/2
Matthias Sohn [Sat, 4 Jan 2020 16:03:52 +0000 (17:03 +0100)]
Fix unclosed resource warning in SmartOutputStream

Change-Id: Ia4b96ae1c2cc9357802487384ee32a80ed40334b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoJschConfigSessionFactory: fix boxing warning 11/155211/2
Matthias Sohn [Sat, 4 Jan 2020 15:06:54 +0000 (16:06 +0100)]
JschConfigSessionFactory: fix boxing warning

Change-Id: I1735033c56b444a9a7160cb7df89292a228d5b34
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoSshSupport#runSshCommand: don't throw exception in finally block 10/155210/2
Matthias Sohn [Sat, 4 Jan 2020 14:44:19 +0000 (15:44 +0100)]
SshSupport#runSshCommand: don't throw exception in finally block

The CommandFailedException which was thrown in finally block is silently
discarded [1]. Refactor this method to throw the exception after the
finally block.

This fixes the warning "Null comparison always yields false: The
variable failure can only be null at this location".

[1] https://wiki.sei.cmu.edu/confluence/display/java/ERR04-J.+Do+not+complete+abruptly+from+a+finally+block
https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.20.2

Change-Id: Idbfc303d9c9046ab9a43e0d4c6d65d325bdaf0ed
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoDon't override already managed maven-compiler-plugin version 09/155209/1
Matthias Sohn [Sat, 4 Jan 2020 12:15:37 +0000 (13:15 +0100)]
Don't override already managed maven-compiler-plugin version

Change-Id: Ie2cb178cf8d805aadc76a2096bcdde95a146d07c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoRemove unused import from CreateFileSnapshotBenchmark 08/155208/1
Matthias Sohn [Sat, 4 Jan 2020 12:11:06 +0000 (13:11 +0100)]
Remove unused import from CreateFileSnapshotBenchmark

Change-Id: Iad0bcc01ada4252e9ab4f60d4375f98f084f6a5f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoRemove duplicate ignore_optional_problems entry in .classpath 07/155207/1
Matthias Sohn [Sat, 4 Jan 2020 12:10:00 +0000 (13:10 +0100)]
Remove duplicate ignore_optional_problems entry in .classpath

Change-Id: I326377c90af59ecaada7f5185a638726a8e909b7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoUpdate maven-site-plugin used by benchmark module to 3.8.2 69/154769/1
Matthias Sohn [Wed, 18 Dec 2019 14:50:35 +0000 (15:50 +0100)]
Update maven-site-plugin used by benchmark module to 3.8.2

The benchmark module currently has no parent, adjust the version used
here to the one used by all the other jgit Maven modules.

Change-Id: I8807a694fe23f8f131d1d22a58a3e18874d756cc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoAdd dependency to enable site generation for benchmark module 68/154768/1
Matthias Sohn [Wed, 18 Dec 2019 14:49:18 +0000 (15:49 +0100)]
Add dependency to enable site generation for benchmark module

Change-Id: Iae4524ddc730d57993e9c6d6807282e4b07d1336
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoIgnore warnings for generated source code in org.eclipse.jgit.benchmark 38/154638/1
Matthias Sohn [Mon, 16 Dec 2019 14:22:08 +0000 (15:22 +0100)]
Ignore warnings for generated source code in org.eclipse.jgit.benchmark

The source code in the folder .apt_generated is generated by the JMH
code generator, so there's no point in raising any warnings as this
could only be fixed in the upstream code generator.

Change-Id: I882888e7bf924f9ae74182598fcb91671a5c9818
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoFix MBean registration 94/154494/1
Matthias Sohn [Fri, 13 Dec 2019 16:32:51 +0000 (17:32 +0100)]
Fix MBean registration

Change-Id: I6f6b8641f6c3e8ab9f625594085014272305656a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoEnhance WindowCache statistics 01/153601/6
Matthias Sohn [Sat, 30 Nov 2019 02:38:13 +0000 (03:38 +0100)]
Enhance WindowCache statistics

Add the following statistics
- cache hit count and hit ratio
- cache miss count and miss ratio
- count of successful and failed loads
- rate of failed loads
- load, eviction and request count
- average and total load time

Use LongAdder instead of AtomicLong to implement counters in order to
improve scalability.

Optionally expose these metrics via JMX, they are registered with the
platform MBean server if the config option jmx.WindowCacheStats = true
in the user or system level git config.

Bug: 553573
Change-Id: Ia2d5246ef69b9c2bd594a23934424bc5800774aa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoBazel: Use java_plugin and java_binary from @rules_java in jmh.bzl 64/153364/2
David Pursehouse [Tue, 26 Nov 2019 03:17:52 +0000 (12:17 +0900)]
Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl

Change-Id: I80456f74bc17a1ebb0248fce8050a4cb07bf18f1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoBazel: Add missing newlines at end of BUILD files 63/153363/2
David Pursehouse [Tue, 26 Nov 2019 03:16:47 +0000 (12:16 +0900)]
Bazel: Add missing newlines at end of BUILD files

Change-Id: I11afc45141da988e28382898246995f6b45eb09c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoFix benchmark pom.xml to include distribution managment config 64/152164/2
Matthias Sohn [Wed, 6 Nov 2019 16:49:48 +0000 (17:49 +0100)]
Fix benchmark pom.xml to include distribution managment config

Also fix indentation.

Change-Id: I6d223c493d537bb8aac23c7ddf0a602aff22a3c2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoRun JMH benchmarks using bazel 23/147023/12
Matthias Sohn [Sun, 4 Aug 2019 17:04:41 +0000 (19:04 +0200)]
Run JMH benchmarks using bazel

The benchmarks can be built and run using bazel by running:

$ bazel run //org.eclipse.jgit.benchmarks:benchmarks

Change-Id: I6679750eaa0f2be30ed9d45036e013b0ea4fcc86
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoBenchmark for creating files and FileSnapshots 71/147171/7
Matthias Sohn [Wed, 7 Aug 2019 09:51:30 +0000 (11:51 +0200)]
Benchmark for creating files and FileSnapshots

Change-Id: I953fd8b6b9743b0b9cada244331253eb2121784d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoImplement benchmark for looking up FileStore of a given Path 66/147066/7
Matthias Sohn [Mon, 5 Aug 2019 14:26:20 +0000 (16:26 +0200)]
Implement benchmark for looking up FileStore of a given Path

Results on Mac OS 10.14.6 using APFS:

Result "org.eclipse.jgit.benchmarks.LookupFileStoreBenchmark.testLookupFileStore":
  44583.277 ±(99.9%) 2666.096 ns/op [Average]
  (min, avg, max) = (43707.073, 44583.277, 45320.685), stdev = 692.377
  CI (99.9%): [41917.181, 47249.373] (assumes normal distribution)

Secondary result
"org.eclipse.jgit.benchmarks.LookupFileStoreBenchmark.testLookupFileStore:·stack":
Stack profiler:

....[Thread state
distributions]........................................................
100.0%         RUNNABLE

....[Thread state:
RUNNABLE].............................................................
 42.5%  42.5% sun.nio.fs.UnixNativeDispatcher.realpath0
 37.9%  37.9% sun.nio.fs.UnixNativeDispatcher.stat0
 11.0%  11.0% sun.nio.fs.BsdNativeDispatcher.getfsstat
  7.6%   7.6% sun.nio.fs.BsdNativeDispatcher.fsstatEntry
  0.7%   0.7% sun.nio.fs.BsdNativeDispatcher.endfsstat
  0.1%   0.1% sun.nio.fs.UnixPath.initOffsets
  0.0%   0.0% sun.nio.fs.UnixFileAttributes.get
  0.0%   0.0% java.util.zip.Inflater.inflateBytes
  0.0%   0.0% sun.misc.Unsafe.compareAndSwapInt
  0.0%   0.0% sun.nio.fs.BsdFileStore.findMountEntry

This shows that FS.attrCacheByPath should be useful to reduce overhead
of looking up the FileStore of a given file.

Change-Id: I7213086b42e0453f0ee149660d507dac2a4644cc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoJMH benchmark for SimpleLruCache 22/147022/10
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:

$ java -jar org.eclipse.jgit.benchmarks/target/benchmarks.jar

or in Eclipse by running the main method of the SimpleLruCacheBenchmark
class.

[1] https://openjdk.java.net/projects/code-tools/jmh/
[2] http://alblue.bandlem.com/Page/3/index.html
[3] https://eclip.se/532029

CQ: 20517
CQ: 20518
Change-Id: Idca8a9e0980f0b8a9c741c4c9e97d03c62f07c8d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoRemove unused API problem filters 48/151948/1
Matthias Sohn [Mon, 4 Nov 2019 12:28:23 +0000 (13:28 +0100)]
Remove unused API problem filters

Change-Id: I0ae0fd4919b7ccc5218c6eb0fab22350bb9c9714
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoSilence API errors for new API added since 5.1.0 47/151947/1
Matthias Sohn [Mon, 4 Nov 2019 12:25:37 +0000 (13:25 +0100)]
Silence API errors for new API added since 5.1.0

Change-Id: I92a7c1b0319d61aeb25f58048bd07c144068c3db
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoBazel: Bump bazel version to 1.0.0 24/150924/2
David Pursehouse [Fri, 11 Oct 2019 00:41:43 +0000 (09:41 +0900)]
Bazel: Bump bazel version to 1.0.0

Change-Id: I607915af0556efe8b2fb640e9387029b755d1a7f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoPrepare 5.1.13-SNAPSHOT builds 62/150462/1
Matthias Sohn [Tue, 1 Oct 2019 22:40:49 +0000 (00:40 +0200)]
Prepare 5.1.13-SNAPSHOT builds

Change-Id: Ic1dca14924f49ad07eb5cd0570ce7ece9f319d0d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.1.12.201910011832-r 61/150461/1 v5.1.12.201910011832-r
Matthias Sohn [Tue, 1 Oct 2019 22:32:04 +0000 (00:32 +0200)]
JGit v5.1.12.201910011832-r

Change-Id: I69fef9b2cdc18bbf1c8b9b290fb3d190684be13c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoDo not rely on ArrayIndexOutOfBoundsException to detect end of input 54/150254/1
Saša Živkov [Fri, 27 Sep 2019 13:58:10 +0000 (15:58 +0200)]
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

5 years agoWorkingTreeIterator: handle different timestamp resolutions 40/149440/6
Thomas Wolf [Thu, 12 Sep 2019 19:05:19 +0000 (21:05 +0200)]
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>
5 years agoFix WorkingTreeIterator.compareMetadata() for CheckStat.MINIMAL 66/149266/1
Matthias Sohn [Tue, 10 Sep 2019 14:08:45 +0000 (16:08 +0200)]
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>
5 years agoFormat BUILD files with buildifier 23/149123/1
David Pursehouse [Sun, 8 Sep 2019 13:30:19 +0000 (22:30 +0900)]
Format BUILD files with buildifier

Using buildifier from master branch and the command:

$ buildifier -r -lint fix -warnings all .

Change-Id: I19c8ff183081093cb73bed7221a78a91b6cba4dc
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBazel: Fix warning about deprecated lib.bzl 98/149098/3
David Pursehouse [Sat, 7 Sep 2019 06:28:32 +0000 (15:28 +0900)]
Bazel: Fix warning about deprecated lib.bzl

Change-Id: Ifdbaaf9ec020a621070eea351f791a819d554012
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoFormat lib/BUILD with buildifier 85/149085/4
David Pursehouse [Sat, 7 Sep 2019 00:32:19 +0000 (09:32 +0900)]
Format lib/BUILD with buildifier

Change-Id: I4f0ad64371b160b67797f49b9fde521e5dea9396
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBazel: Add fixes for --incompatible_load_java_rules_from_bzl 33/148933/7
David Pursehouse [Thu, 5 Sep 2019 00:46:59 +0000 (09:46 +0900)]
Bazel: Add fixes for --incompatible_load_java_rules_from_bzl

Change-Id: I24746335db132bf20f400cb3db400737596d4542
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBazel: Bump minimum supported version to 0.29.0 96/148996/5
David Ostrovsky [Thu, 5 Sep 2019 20:07:46 +0000 (22:07 +0200)]
Bazel: Bump minimum supported version to 0.29.0

Change-Id: I069e56deb964624791bb0aa3ae095629adfe3bbb
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
5 years agoBazel: Bump skylib library version to 0.8.0 97/149097/3
David Ostrovsky [Sat, 8 Jun 2019 15:31:33 +0000 (17:31 +0200)]
Bazel: Bump skylib library version to 0.8.0

Change-Id: I2089899c9f197b2c93b93390fdd55f6fe11e5ce4
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
5 years agoUse bazelisk to switch between used bazel version 99/149099/2
David Ostrovsky [Sat, 8 Jun 2019 15:33:28 +0000 (17:33 +0200)]
Use bazelisk to switch between used bazel version

Bazelisk is utility to switch to the right Bazel version, that we
used to have with Buck build tool: [1].

Bazelisk will download the right Bazel version only once and will use
it in subsequent calls:

  $ bazelisk build :release
  2019/06/06 16:22:15 Downloading \
  https://releases.bazel.build/0.26.1/release/bazel-0.26.1-linux-x86_64...

Bazelisk is storing the binaries in user's cache directory: [2], e.g.
on Linux OS:

  $ ls -1 ~/.cache/bazelisk/bin
  bazel-0.26.1-linux-x86_64

* [1] https://github.com/bazelbuild/bazelisk
* [2] https://golang.org/pkg/os/#UserCacheDir

Change-Id: Ia9180fb75f8cc17a0a0232622cf33a13bfad6b60
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
5 years agoBazel: Require minimum bazel version 0.17.1 96/149096/3
David Pursehouse [Wed, 10 Oct 2018 01:53:35 +0000 (10:53 +0900)]
Bazel: Require minimum bazel version 0.17.1

Check the bazel version using the checker from bazel_skylib, and
require at least version 0.17.1 which is the minimum version that
does not suffer from the Java API mismatch issue [1].

The implementation is borrowed from the Gerrit project.

[1] https://github.com/bazelbuild/bazel/issues/6027

Change-Id: I224250088a1f5072fcaa3ec81228f4d2cb8cb389
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoFix wrong placeholder index in error message packInaccessible 05/149005/4
Matthias Sohn [Thu, 5 Sep 2019 22:52:48 +0000 (00:52 +0200)]
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>
5 years agoJGitText: Remove unused externalized strings 09/149009/3
David Pursehouse [Fri, 6 Sep 2019 02:06:33 +0000 (11:06 +0900)]
JGitText: Remove unused externalized strings

Change-Id: I995d7a1b6ab2866221eee9f5cb828b97192daf4a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoRepoText: Remove unused externalized string 07/149007/3
David Pursehouse [Fri, 6 Sep 2019 01:04:42 +0000 (10:04 +0900)]
RepoText: Remove unused externalized string

Change-Id: Ida47637f54afdb76513be9b04aae32107567d4e3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoCLI: Remove unused externalized strings 06/149006/3
David Pursehouse [Fri, 6 Sep 2019 00:20:55 +0000 (09:20 +0900)]
CLI: Remove unused externalized strings

Change-Id: Id44117dd72b0e71e9bf0046a3c965eeae64cf3ea
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoPrepare 5.1.12-SNAPSHOT builds 49/148849/1
Matthias Sohn [Tue, 3 Sep 2019 20:56:39 +0000 (22:56 +0200)]
Prepare 5.1.12-SNAPSHOT builds

Change-Id: I353ac3f23024063722abc7340bc9a6df3c615741
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.1.11.201909031202-r 21/148821/1 v5.1.11.201909031202-r
Matthias Sohn [Tue, 3 Sep 2019 16:01:55 +0000 (18:01 +0200)]
JGit v5.1.11.201909031202-r

Change-Id: I288acf670160b9bcd2d04f572a902b5838b4d4f8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.0' into stable-5.1 06/148806/2
Matthias Sohn [Tue, 3 Sep 2019 14:02:44 +0000 (16:02 +0200)]
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>
5 years agoMerge branch 'stable-4.11' into stable-5.0 97/148797/2 stable-5.0
Matthias Sohn [Tue, 3 Sep 2019 13:54:54 +0000 (15:54 +0200)]
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>
5 years agoPrepare 4.11.10-SNAPSHOT builds 94/148794/1 stable-4.11
Matthias Sohn [Tue, 3 Sep 2019 12:49:20 +0000 (14:49 +0200)]
Prepare 4.11.10-SNAPSHOT builds

Change-Id: Ic98bd87d96ce627d38e1ecc2c3cb28b517ab489e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v4.11.9.201909030838-r 87/148787/1 v4.11.9.201909030838-r
Matthias Sohn [Tue, 3 Sep 2019 12:37:49 +0000 (14:37 +0200)]
JGit v4.11.9.201909030838-r

Change-Id: Ie60468569074197d49e19cbd0ffaedfe88f3d74e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-4.10' into stable-4.11 86/148786/1
Matthias Sohn [Tue, 3 Sep 2019 12:23:29 +0000 (14:23 +0200)]
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>
5 years agoMerge branch 'stable-4.9' into stable-4.10 80/148780/2 stable-4.10
Matthias Sohn [Tue, 3 Sep 2019 12:21:04 +0000 (14:21 +0200)]
Merge branch 'stable-4.9' into stable-4.10

* stable-4.9:
  Bazel: Update bazlets to the latest master revision
  Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file

Change-Id: I8bb74aacc1c010cfed9a0c8acffb520724f0e395
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-4.9' into stable-4.10 79/148779/2
Matthias Sohn [Tue, 3 Sep 2019 11:24:28 +0000 (13:24 +0200)]
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>
5 years agoBazel: Update bazlets to the latest master revision 78/148778/1 stable-4.9
David Pursehouse [Tue, 3 Sep 2019 11:35:47 +0000 (20:35 +0900)]
Bazel: Update bazlets to the latest master revision

The latest revision includes various fixes to allow the build
to work with recent versions of Bazel.

Change-Id: I72c100b99762010946d9b2784286af560bbdf185
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBazel: Remove FileTreeIteratorWithTimeControl from BUILD file 77/148777/1
David Pursehouse [Tue, 16 Jul 2019 02:19:09 +0000 (11:19 +0900)]
Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file

FileTreeIteratorWithTimeControl was deleted in a024759, but was
not removed from the BUILD file, thus causing the bazel build to
fail.

Change-Id: I892c0ffcac947298d0d6009374ee2c5d9afefb66
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
(cherry picked from commit e54fde8616f53a6fab5201db4a0c7e67dd0145c5)

5 years agoBatchRefUpdate: repro racy atomic update, and fix it 06/148706/8
Han-Wen Nienhuys [Sat, 31 Aug 2019 19:33:58 +0000 (21:33 +0200)]
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>
5 years agoDelete unused FileTreeIteratorWithTimeControl 65/148765/1
Matthias Sohn [Thu, 11 Jul 2019 08:00:23 +0000 (10:00 +0200)]
Delete unused FileTreeIteratorWithTimeControl

The only usage of this test iterator was removed in df637928d. Hence
delete this iterator and associated test.

Change-Id: I47710133ec3edc675c21db210960c024982668c6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit a024759cf5bf1cd6b9beb4f790d484943761a7e1)

5 years agoFix RacyGitTests#testRacyGitDetection 64/148764/1
Matthias Sohn [Tue, 18 Jun 2019 09:32:59 +0000 (11:32 +0200)]
Fix RacyGitTests#testRacyGitDetection

This test case assumed file system timestamp resolution of 1 second. On
filesystems with a finer resolution this test fails since the index
entry is only smudged if the file index entry's lastModified and the
lastModified of the git index itself are within the same filesystem
timer tick. Fix this by ensuring that these timestamps are identical
which should work for any filesystem timer resolution.

Bug: 548188
Change-Id: Id84d59e1cfeb48fa008f8f27f2f892c4f73985de
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
(cherry picked from commit 1159f9dd7c80a53c2509cd75d997a6afed37f9a6)

5 years agoChange RacyGitTests to create a racy git situation in a stable way 63/148763/1
Masaya Suzuki [Mon, 24 Dec 2018 03:31:10 +0000 (19:31 -0800)]
Change RacyGitTests to create a racy git situation in a stable way

By using File#setLastModified, we can create a racy git situation
stably.

Tested with --runs_per_test=100

Bug: 526111
Change-Id: I60b3632d353e19f335668325aa603640be423f58
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
(cherry picked from commit df637928d2ef4b9ee06af7e37344c7848f870ce4)

5 years agoSilence API warnings 42/148742/2
Matthias Sohn [Mon, 2 Sep 2019 23:27:02 +0000 (01:27 +0200)]
Silence API warnings

Change-Id: I27fd62de51ca0eedcc7e2e256487bda1e18bce8a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoReturn a new instance from openSystemConfig and openUserConfig 73/148373/4
Matthias Sohn [Mon, 26 Aug 2019 20:43:11 +0000 (22:43 +0200)]
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>
5 years agoPrepare 5.1.11-SNAPSHOT builds 31/148231/1
Matthias Sohn [Fri, 23 Aug 2019 13:47:03 +0000 (15:47 +0200)]
Prepare 5.1.11-SNAPSHOT builds

Change-Id: I8608580424d0e523dcace63f83ae530ba78dbb15
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.1.10.201908230655-r 18/148218/2 v5.1.10.201908230655-r
Matthias Sohn [Fri, 23 Aug 2019 10:52:08 +0000 (12:52 +0200)]
JGit v5.1.10.201908230655-r

Change-Id: I68d15ebd6054bdeaf62e14cddb87724828db7943
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUse AtomicReferences to cache user and system level configs 12/148112/6
Matthias Sohn [Thu, 22 Aug 2019 08:23:50 +0000 (10:23 +0200)]
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>
5 years agoFix copy-paste typo in CloneCommand#cleanup 48/148148/3
Adrien Bustany [Thu, 22 Aug 2019 15:11:45 +0000 (17:11 +0200)]
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>
5 years agoAdd missing @since tag on FileTreeIterator#getLastModifiedInstant 37/148037/1
Matthias Sohn [Wed, 21 Aug 2019 09:52:20 +0000 (11:52 +0200)]
Add missing @since tag on FileTreeIterator#getLastModifiedInstant

Change-Id: I809399e6a71e0079d2f0007b0d3f00b531d451bb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 5.1.10-SNAPSHOT builds 36/148036/2
Matthias Sohn [Wed, 21 Aug 2019 09:36:51 +0000 (11:36 +0200)]
Prepare 5.1.10-SNAPSHOT builds

Change-Id: If10afc8e663299a15db8c5fd0574fb51bf7e7ae9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.1.9.201908210455-r 29/148029/1 v5.1.9.201908210455-r
Matthias Sohn [Wed, 21 Aug 2019 08:52:10 +0000 (10:52 +0200)]
JGit v5.1.9.201908210455-r

Change-Id: Iaade207292acb8b27e01aca7e1af97ad7db1e854
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoAvoid sign extension when comparing mtime with Instant#getEpochSecond 14/148014/1
Matthias Sohn [Tue, 20 Aug 2019 22:29:45 +0000 (00:29 +0200)]
Avoid sign extension when comparing mtime with Instant#getEpochSecond

Ensure we use the same type when comparing seconds since the epoch.

This does not prevent that in 2038 timestamps in seconds since the epoch
stored in a 32 bit integer will overflow. Integer.MAX_VALUE translates
to 2038-01-19T03:14:07Z. After this date we'll have an issue since we
store seconds since the epoch in a 32 bit integer in some places.

Bug: 319142
Change-Id: If0c03003d40b480f044686e2f7a2f62c9f4e2fe1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFix deprecation in DirCache caused by Instant based DirCacheEntry 96/147996/2
Michael Keppler [Tue, 20 Aug 2019 14:09:12 +0000 (16:09 +0200)]
Fix deprecation in DirCache caused by Instant based DirCacheEntry

Replace the two int variables smudge_s and smudge_ns by an Instant and
use the new method DirCacheEntry.mightBeRacilyClean(Instant).

Change-Id: Id70adbb0856a64909617acf65da1bae8e2ae934a
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFix NPE in RebaseTodoFile#parseComments 64/147864/10
Matthias Sohn [Fri, 16 Aug 2019 22:20:01 +0000 (00:20 +0200)]
Fix NPE in RebaseTodoFile#parseComments

Change-Id: I5487f3c2609eaf2a0ddf71ebb2f6c9701fb7600c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFix NPE in ObjectIdOwnerMap#get 63/147863/8
Matthias Sohn [Fri, 16 Aug 2019 22:18:50 +0000 (00:18 +0200)]
Fix NPE in ObjectIdOwnerMap#get

Change-Id: I3812961a27ac410d610ef50c73a28f21bb05ae79
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFix NPE in CommitOnlyTest#getHead 62/147862/8
Matthias Sohn [Fri, 16 Aug 2019 22:17:51 +0000 (00:17 +0200)]
Fix NPE in CommitOnlyTest#getHead

Change-Id: I05abd00d151cf9834d1a097dd16dc280b62a7edd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFileUtils#lastModifiedInstant should not log error if path doesn't exist 61/147861/8
Matthias Sohn [Fri, 16 Aug 2019 22:16:32 +0000 (00:16 +0200)]
FileUtils#lastModifiedInstant should not log error if path doesn't exist

Change-Id: Id8447735beb24becb41612d3d29d5351f8273d22
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoCache user global and system-wide git configurations 53/147753/11
Matthias Sohn [Wed, 14 Aug 2019 23:25:28 +0000 (01:25 +0200)]
Cache user global and system-wide git configurations

So far the git configuration and the system wide git configuration were
always reloaded when jgit accessed these global configuration files to
access global configuration options which are not in the context of a
single git repository. Cache these configurations in SystemReader and
only reload them if their file metadata observed using FileSnapshot
indicates a modification.

Change-Id: I092fe11a5d95f1c5799273cacfc7a415d0b7786c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoAvoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock 22/147522/5
Matthias Sohn [Sun, 11 Aug 2019 00:43:02 +0000 (02:43 +0200)]
Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock

FS determines FileStore attributes in a background thread and tries to
save the results to the global git configuration. This competed with
LocalDiskRepositoryTestCase#setup trying to save changes to the same
file requiring the same lock. This frequently led to one of the threads
failing to acquire the lock.

Fix this by first initiating determination of FileStore attributes which
then uses a MockSystemReader not using a userConfig stored to disk which
avoids this race for the lock.

Change-Id: I30fcd96bc15100f8ef9b2a9eb3320bb5ace97c67
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoAdd missing dependencies for running FS_POSIXTest in Eclipse 52/147752/2
Matthias Sohn [Wed, 14 Aug 2019 11:25:16 +0000 (13:25 +0200)]
Add missing dependencies for running FS_POSIXTest in Eclipse

Change-Id: I35fcdfab55ff02943f6185b232e01ce9cfe151a9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFix javadoc for SystemReader#getInstance 54/147754/3
Matthias Sohn [Wed, 14 Aug 2019 23:36:41 +0000 (01:36 +0200)]
Fix javadoc for SystemReader#getInstance

The existing javadoc was copied from another method and not adapted.

Change-Id: I39a7e5d719b2c379de9bd1a4710a55a73700c6f0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoImprove retry handling when saving FileStoreAttributes fails 73/147573/4
Matthias Sohn [Mon, 12 Aug 2019 15:40:39 +0000 (17:40 +0200)]
Improve retry handling when saving FileStoreAttributes fails

- fix handling of interrupts in FileStoreAttributes#saveToConfig
- increase retry wait time to 100ms
- don't wait after last retry
- dont retry if failure is caused by another exception than
LockFailedException

Change-Id: I108c012717d2bcce71f2c6cb9cf0879de704ebc2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge "Ensure FSTest uses MockSystemReader" into stable-5.1
David Pursehouse [Mon, 12 Aug 2019 23:37:11 +0000 (19:37 -0400)]
Merge "Ensure FSTest uses MockSystemReader" into stable-5.1

5 years agoEnsure FSTest uses MockSystemReader 76/147576/1
Matthias Sohn [Mon, 12 Aug 2019 22:26:25 +0000 (00:26 +0200)]
Ensure FSTest uses MockSystemReader

Tests shall not modify ~/.gitconfig. When running tests with bazel this
test failed since bazel isolates tests in a sandbox.

Change-Id: I7dd092afd14972da58a95eb7c200d353f0959fa1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMake supportsAtomicCreateNewFile return true as default 74/140274/10
Vishal Devgire [Tue, 9 Apr 2019 07:31:36 +0000 (13:01 +0530)]
Make supportsAtomicCreateNewFile return true as default

The method org.eclipse.jgit.util.FS.supportsAtomicCreateNewFile()
should default to true as mentioned in docs [1]

org.eclipse.jgit.util.FS_POSIX.supportsAtomicCreateNewFile() method
will set the value to false if the git config
core.supportsatomiccreatenewfile is not set.

It should default to true if the configuration is undefined.

[1]
https://github.com/eclipse/jgit/blob/4169a95a65683e39e7a6a8f2b11b543e2bc754db/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java#L372

Bug: 544164
Change-Id: I16ccf989a89da2cf4975c200b3228b25ba4c0d55
Signed-off-by: Vishal Devgire <vishaldevgire@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate orbit to R20190602212107-2019-06 to enable backports from master 39/147539/2
Matthias Sohn [Mon, 12 Aug 2019 10:02:59 +0000 (12:02 +0200)]
Update orbit to R20190602212107-2019-06 to enable backports from master

update
- org.apache.httpcomponents.httpclient to 4.5.6.v20190503-0009
- org.apache.httpcomponents.httpcore to 4.4.10.v20190123-2214
- com.jcraft.jsch" version to 0.1.55.v20190404-1902
- org.mockito to 2.23.0.v20190527-1420
  add its dependencies
    - net.bytebuddy.byte-buddy 1.9.0.v20181107-1410
    - net.bytebuddy.byte-buddy-agent 1.9.0.v20181106-1534
- org.objenesis to 2.6.0.v20180420-1519

CQ: 18303 (objenesis)
CQ: 18703 (httpclient)
CQ: 18704 (httpcore)
CQ: 19588 (jsch)
CQ: 20214 (mockito)
CQ: 20215 (butebuddy)
CQ: 20216 (bytebuddy-agent)
Change-Id: I8d76375de867e32b7818449f843b7c053a717b5e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoHandle InvalidPathException in FS_POSIX#createNewFileAtomic 42/147542/1
Matthias Sohn [Mon, 12 Aug 2019 10:18:16 +0000 (12:18 +0200)]
Handle InvalidPathException in FS_POSIX#createNewFileAtomic

Bug: 547400
Change-Id: Ic3541e360a2968ba3532a3d3fa4828b0d0463c02
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoEnsure root cause of lock creation failures is logged 24/147524/3
Matthias Sohn [Mon, 12 Aug 2019 05:14:54 +0000 (07:14 +0200)]
Ensure root cause of lock creation failures is logged

Change-Id: I91cdf1e085a29c0aabd6d22c6ebe848b2d75f42c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoImplement toString in MockSystemReader and MockConfig 73/147473/2
Matthias Sohn [Sat, 10 Aug 2019 21:46:50 +0000 (23:46 +0200)]
Implement toString in MockSystemReader and MockConfig

This helps when debugging.

Change-Id: I3d72e1ea207ba60be77a7a9a840abb71ade1271c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoLocalDiskRefTreeDatabaseTest shall use MockSystemReader 72/147472/2
Matthias Sohn [Sat, 10 Aug 2019 21:45:43 +0000 (23:45 +0200)]
LocalDiskRefTreeDatabaseTest shall use MockSystemReader

It missed to call the setup() method of its super class which prepares
the MockSystemReader

Change-Id: I39858749f8d0115fc6ac7edc8847ffb2bbc85c33
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoEnsure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader 71/147471/2
Matthias Sohn [Sat, 10 Aug 2019 21:44:39 +0000 (23:44 +0200)]
Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader

FS#getFileStoreAttributes used the real userConfig and not the mocked
one. This led to test errors when running tests with Bazel since it
sandboxes tests which prevents they can write to ~/.gitconfig.

Fix this by first preparing the MockedSystemReader and the mocked config
before calling FS#getFileStoreAttributes.

Also fix ConfigTest which broke due to this change since it inherits
from LocalDiskRepositoryTestCase and calls its setup method which was
changed here. We can no longer assert by comparing plain text since FS
adds FileStoreAttributes to the mocked userConfig. Also the default
options seen by this test changed since we now use a mocked config.

Change-Id: I76bc7c94953fe979266147d3b309a68dda9d4dfe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoEnsure we use MockSystemReader in tests 70/147470/2
Matthias Sohn [Sat, 10 Aug 2019 21:34:58 +0000 (23:34 +0200)]
Ensure we use MockSystemReader in tests

If we use the default system reader FileStoreAttributes cannot persist
attributes in userConfig when tests run in Bazel due to sandboxing.
Hence we need to ensure that all tests use MockSystemReader (and
especially a mocked userConfig).

Change-Id: Ic1ad8e2ec5a150c5433434a5f6667d6c4674c87d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoOverride FileBasedConfig's save method in MockConfig 69/147469/2
Matthias Sohn [Sat, 10 Aug 2019 21:48:42 +0000 (23:48 +0200)]
Override FileBasedConfig's save method in MockConfig

This ensures we don't try to persist MockConfig using its superclasses
save() method which fails with an NPE since MockConfig has no backing
file.

Change-Id: Ifba2d24c9438bb30d3828ed31a4c131f940b45eb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRemove FileBasedConfig.load(boolean) introduced in d45219ba 68/147468/2
Matthias Sohn [Sat, 10 Aug 2019 21:28:07 +0000 (23:28 +0200)]
Remove FileBasedConfig.load(boolean) introduced in d45219ba

We can't add this method to the super class StoredConfig since that
abstracts from filesystem storage. MockSystemReader.MockConfig is a
StoredConfig and is also used by tests for dfs based storage. Hence
remove this leaky abstraction.

This implies we always use the fallback FileStoreAttributes which means
a config file modification is considered racy within the first 2
seconds. This should not be an issue since typically configs change
rarely and re-reading a config within the racy period is relatively
cheap since configs are small.

Change-Id: Ia2615addc24a7cadf3c566ee842c6f4f07e159a5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoDisable debug log for FS in org.eclipse.jgit.test 67/147467/1
Matthias Sohn [Sat, 10 Aug 2019 18:32:07 +0000 (20:32 +0200)]
Disable debug log for FS in org.eclipse.jgit.test

This was enabled unintentionally in 06fc6c7c and spams the test logs. We
can enable this when needed.

Change-Id: I9f3042c0e285ff236be65fcc02bdcfdb90efc3af
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoBazel: enable logging for tests in org.eclipse.jgit.test 99/147399/2
Matthias Sohn [Fri, 9 Aug 2019 22:51:30 +0000 (00:51 +0200)]
Bazel: enable logging for tests in org.eclipse.jgit.test

- use slf4j-simple for logging in test runs
- for log configuration see
https://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html

Change-Id: I9f0a532644b31162c867cd0d63f083296eaf6be5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoLockFile: log exception if creation of lock file failed 98/147398/1
Matthias Sohn [Fri, 9 Aug 2019 22:39:16 +0000 (00:39 +0200)]
LockFile: log exception if creation of lock file failed

Change-Id: I4de75d12ec9e61193494916307289378cdb6220e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoStop using deprecated Constants.CHARACTER_ENCODING 24/147324/1
David Pursehouse [Fri, 9 Aug 2019 03:11:41 +0000 (12:11 +0900)]
Stop using deprecated Constants.CHARACTER_ENCODING

Change-Id: I105b8a05bc64f249879a0795a059958553cc60c6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoFix OpenSshConfigTest#config 44/147244/1
Matthias Sohn [Thu, 8 Aug 2019 08:10:12 +0000 (10:10 +0200)]
Fix OpenSshConfigTest#config

- use FS.DETECTED instead of db.getFS() since the ssh config is
typically in a different place than the repository, the same is used in
OpenSshConfig
- reduce unnecessary repeated writes by introducing wait for one tick of
the file time resolution

Change-Id: Ifac915e97ff420ec5cf8e2f162e351f9f51b6b14
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFileSnapshot: fix bug with timestamp thresholding 66/146866/13
Han-Wen Nienhuys [Wed, 31 Jul 2019 15:27:47 +0000 (17:27 +0200)]
FileSnapshot: fix bug with timestamp thresholding

Increase the safety factor to 2.5x for extra safety if max of measured
timestamp resolution and measured minimal racy threshold is < 100ms, use
1.25 otherwise since for large filesystem resolution values the
influence of finite resolution of the system clock should be negligible.

Before, not yet using the newly introduced minRacyThreshold measurement,
the threshold was 1.1x FS resolution, and we could issue the
following sequence of events,

  start
  create-file
  read-file (currentTime)
  end

which had the following timestamps:

  create-file 1564589081998
  start 1564589082002
  read 1564589082003
  end 1564589082004

In this case, the difference between create-file and read is 5ms,
which exceeded the 4ms FS resolution, even though the events together
took just 2ms of runtime.

Reproduce with:
  bazel test --runs_per_test=100 \
    //org.eclipse.jgit.test:org_eclipse_jgit_internal_storage_file_FileSnapshotTest

The file system timestamp resolution is 4ms in this case.

This code assumes that the kernel and the JVM use the same clock that
is synchronized with the file system clock. This seems plausible,
given the resolution of System.currentTimeMillis() and the latency for
a gettimeofday system call (typically ~1us), but it would be good to
justify this with specifications.

Also cover a source of flakiness: if the test runs under extreme load,
then we could have

  start
  create-file
  <long delay>
  read
  end

which would register as an unmodified file. Avoid this by skipping the
test if end-start is too big.

[msohn]:
- downported from master to stable-5.1
- skip test if resolution is below 10ms
- adjust safety factor to 1.25 for resolutions above 100ms

Change-Id: I87d2cf035e01c44b7ba8364c410a860aa8e312ef
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>