Commit Graph

7737 Commits

Author SHA1 Message Date
Matthias Sohn 5c5f7c6b14 Update EDL 1.0 license headers to new short SPDX compliant format
This is the format given by the Eclipse legal doc generator [1].

[1] https://www.eclipse.org/projects/tools/documentation.php?id=technology.jgit

Bug: 548298
Change-Id: I8d8cabc998ba1b083e3f0906a8d558d391ffb6c4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-01-04 01:10:05 +01:00
Matthias Sohn c2c6d6d1be Update spring-boot-maven-plugin to 2.1.5.RELEASE
Change-Id: If16a72a1270eb57bc1fb27b18b8c396453dbbe60
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-01-03 15:57:30 -05:00
Thomas Wolf d661b9f43a TLS support on IBM JDKs
SSLContext.getInstance("TLS") by default behaves differently on IBM
JDK than on Oracle or OpenJDK.[1] On IBM JDK one gets sockets that
have only TLSv1 enabled, which makes HTTPS connections fail since most
servers refuse this old protocol version. On Oracle JDK/OpenJDK, one
gets sockets with all available protocol versions enabled.

Explicitly enable all available TLS protocol versions to make
HTTPS connections work also on IBM JDK.

[1] https://www.ibm.com/support/knowledgecenter/en/SSYKE2_8.0.0/com.ibm.java.security.component.80.doc/security-component/jsse2Docs/matchsslcontext_tls.html#matchsslcontext_tls

Bug: 558709
Change-Id: I5ffc57a78e67a6239b9dad54840a49a8ed28930a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2020-01-03 20:48:25 +01:00
Matthias Sohn 9e6f09c700 Merge branch 'stable-5.6'
* stable-5.6:
  Hooks: avoid problems with backslashes in paths

Change-Id: Ia9e4aca11de5a465b60898a37441a17133f6355b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-26 00:19:20 +01:00
David Pursehouse a586bfc407 Upgrade maven-source-plugin to 3.2.1
Change-Id: I01b0e6cc71f841680bc4116502837af2519379f9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-12-25 11:14:15 +00:00
David Pursehouse cff427bd9a Upgrade ecj to 3.20.0
Change-Id: Ic72d05567d4c90f3d720a166afe99148fb003592
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-12-25 11:13:23 +00:00
Thomas Wolf 2323d7a1ef Hooks: avoid problems with backslashes in paths
Calling sh -c with a script path containing backslashes may fail since
the shell may try to process them as escape characters.

Instead of calling

  sh.exe -c 'C:\path\script "$@"' 'C:\path\script' other args

call

  sh.exe -c '$0 "$@"' 'C:\path\script' other args

which avoids this escape processing.

Note that this is not specific to Windows. If the path or the script
name contain backslashes, this also occurs on Unix.

Bug: 558577
Change-Id: I47d63db6f8644f956c55c42b07dbcad7d7f305aa
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-12-24 13:31:23 +01:00
Matthias Sohn eeca0196ab Update jetty to 9.4.24.v20191120
Change-Id: I6b3dbdfaf344efd174c0786902170f349b1bc8ff
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-23 00:47:25 +01:00
Matthias Sohn 8669d6df18 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>
2019-12-18 15:51:38 +01:00
Matthias Sohn 3c0c381194 Add dependency to enable site generation for benchmark module
Change-Id: Iae4524ddc730d57993e9c6d6807282e4b07d1336
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-18 15:51:21 +01:00
Lars Vogel ccd68dc1dc Using StringBuilder in StringUtils#capitalize method
StringBuffer is synchronized which is slower and should be replaced with
StringBuilder according to its Javadoc.

Change-Id: If4d4a5a49da289ded34bbec97132ab7636b937cc
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
2019-12-18 00:18:41 +01:00
Matthias Sohn e3922b590b 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>
2019-12-17 10:48:40 +01:00
Matthias Sohn 2db0c6bb7a Add resource preferences for top level jgit project
Define resource preferences for the root directory of the jgit
repository imported as an Eclipse project. This allows to work on files
in the root folder inside Eclipse workspace.

Change-Id: I1885841fd612a646b0b9a31f001ced5ca112e90d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-16 11:20:12 +01:00
Matthias Sohn c2a3ce7965 pgm: add option if reflogs should be written when converting to reftable
Change-Id: Ie1c38121005965e63015d9a2af26a1caa88d73fa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-15 10:15:49 +01:00
Matthias Sohn dbe915def1 pgm: add option to configure if convert-ref-storage should create backup
Change-Id: I926f116797508a5982961dfd30c2f765d9536eee
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-15 10:15:49 +01:00
Matthias Sohn 83f90a274c Set config "extensions" option when converting ref storage format
When converting to reftable format the option extensions.refStorage must
be set to "reftable" [1]. When converting back to refdir format this
config option needs to be removed.

Introduce constants for refStorage config options, also for the
"reftree" format.

[1] https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/master/Documentation/technical/reftable.md#Version-1

Change-Id: I190222fa5edc1ad7309daa9be17ca934ff7971e3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-15 10:15:46 +01:00
Matthias Sohn 57f22d6db1 Externalize error message in FileRepository#convertRefStorage
Change-Id: I5d3acaa883ee7eb8d244b55b3e708cbe018690c6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-14 22:10:12 +01:00
Matthias Sohn ecba5e48bb Fix indentation in ConvertRefStorage
Change-Id: Icd007b035e728f641c70cda68befa11a6197003f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-14 22:05:16 +01:00
Carsten Hammer 74bc50125d Replace chain of if statements with switch
and switch over strings where possible. Sometimes if statements are
chained and form a series of comparisons against constants. Using switch
statements improves readability.

Bug: 545856
Change-Id: Iacb78956ee5c20db4d793e6b668508ec67466606
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-14 20:42:03 +01:00
Matthias Sohn 549c3acc5f Fix MBean registration
Change-Id: I6f6b8641f6c3e8ab9f625594085014272305656a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-13 17:32:51 +01:00
David Pursehouse 1b3a555f66 Merge "Update API baseline for 5.7 to 5.6.0.201912101111-r" 2019-12-12 02:55:08 -05:00
Lars Vogel de234106b4 Minor - Removes unnecessary whitespace in ReftableReader
Change-Id: Id0c3463d1b03e258d8633298828ef7cfcd44e13f
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
2019-12-11 15:36:52 -05:00
Matthias Sohn 527b9ed36c Update API baseline for 5.7 to 5.6.0.201912101111-r
Change-Id: I93280812f8db8fdd91dfcd9e4faa13ed4d6e464c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-11 14:43:37 +01:00
Matthias Sohn 5959ab1116 Merge branch 'stable-5.6'
* stable-5.6:
  Prepare 5.6.1-SNAPSHOT builds
  JGit v5.6.0.201912101111-r

Change-Id: I7824278560d828e1c6e2d540e3372e19507a39c0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-11 14:41:04 +01:00
Matthias Sohn 4cb80f897f Prepare 5.6.1-SNAPSHOT builds
Change-Id: Iaa72d2ea6764ccd4fb6a124b51d89fe6492c602d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-11 02:04:21 +01:00
Matthias Sohn 9710c6292a JGit v5.6.0.201912101111-r
Change-Id: Icbb3b46f9d04e45da53936860e07e69fde12971c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-10 17:35:05 +01:00
Yunjie Li ba7f9c0612 Change the wildcard import to explicit ones.
Change-Id: Ia7bc1c4b6b82c127e1e4e0e657f69d249684e8e6
Signed-off-by: Yunjie Li <yunjieli@google.com>
2019-12-09 14:39:50 -08:00
Matthias Sohn 13e54b0872 Merge branch 'master' into next
* master:
  Add ability to redirect stderr from git hooks
  Add possibility to get pure stderr output from AbortedByHookException
  Fix API check errors introduced in ReceivePack in 945d43d5
  Cleanup CommitAndLogCommandTest
  CLI: Add support for excluding paths from Git log command
  ReceivePack: Moves connectivity check to separate class
  Upgrade error_prone_core to 2.3.4
  Suppress API error for RefDatabase.hasFastTipsWithSha1()
  Remove API filters which became obsolete after bumping version to 5.7.0
  ReftableTest: Clean up boxing warnings on usage of String.format
  Add missing @since tag for ReceivePack#receiveWithExceptionPropagation
  MergedReftable: Remove unnecessary semicolon
  Prepare 5.7.0-SNAPSHOT builds
  Introduce RefDatabase#hasFastTipsWithSha1
  Update Orbit to R20191126223242 for 2019-12
  Prepare 5.6.0-SNAPSHOT builds
  JGit v5.6.0.201912041214-rc1
  server: Add a custom error handler
  transport: Add methods that do not handle exceptions
  transport: Let users specify an error handler for unpacking a pack file
  ReceivePack: Use try-with-resources for PostReceiveHook
  transport: Consolidate status reporting code
  transport: Add ReceiveCommandErrorHandler
  transport: Move exception handler to the caller
  transport: Move handling code to the caller side
  UploadPackServlet: Use uploadWithExceptionPropagation
  GitSmartHttpTools: Do not use sideband when sending an error
  Prepare 5.6.0-SNAPSHOT builds
  JGit v5.6.0.201911271000-m3
  ReceivePack: Open visibility for some methods
  JGit pgm: Format blame output to match canonical git
  Make blame work correctly on merge conflicts
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files
  Upgrade maven-enforcer-plugin to 3.0.0-M3
  Add missing license header to ReftableDatabase
  Add missing license header to UploadPackRefSortingForReachabilityTest
  [spotbugs] Fix potential NPE in FSTest
  Remove unused import in CreateFileSnapshotBenchmark
  RepositoryCache: don't require HEAD in git repositories
  FileRepository: cleanup refs outside refs/ on reftable conversion
  Update Orbit to S20191118194249 for 2019-12 M3
  Silence API error for new method in ReachabilityChecker
  UploadPackTest: Fix unused parameter in checkUnadvertisedIfUnallowed
  BitmappedReachabilityChecker: Use only one bitmap for the whole check
  checkNotAdvertisedWants: Be lazy converting Ref to RevCommit
  ReachabilityChecker: Receive a Stream instead of a Collection
  UploadPack: Prioritize references for non-advertised wants checks
  ReceivePack: Fix name hiding of 'atomic' member
  ReceivePack: Remove unnecessarily nested else-clause

Change-Id: I812a8e2cc7ce7f94752722bb257d545ef62a476b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-09 10:24:42 +01:00
Matthias Sohn 23c5ebff79 Merge branch 'stable-5.6'
* stable-5.6:
  Add ability to redirect stderr from git hooks
  Add possibility to get pure stderr output from AbortedByHookException

Change-Id: Ifc02675542dad6ced25fdd8b9fae80b5736db688
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-09 10:15:05 +01:00
Tim Neumann 23125abc20 Add ability to redirect stderr from git hooks
This will change the behavior in the CLI to resemble that of C-Git more
closely by printing the stderr of the hooks to the CLI stderr
independently of the exit code of the hook.

This is also useful for the corresponding EGIT-Change, which will add
the ability to show the hook output in eclipse.
With this also the stderr can be shown even if the exit code is 0.

Bug: 553471
Change-Id: Ie7bc503fe39e270e9b93dd1108b5879f02a12b4c
Signed-off-by: Tim Neumann <Tim.Neumann@advantest.com>
2019-12-09 00:56:40 +01:00
Tim Neumann d1bdfcd0a8 Add possibility to get pure stderr output from AbortedByHookException
This is a preparation for the corresponding EGit change to remove
redundant output in the aborted by commit hook popup.

Bug: 553469
Change-Id: Id5f39a4df659fafc9d951668e6f53fed4380de9d
Signed-off-by: Tim Neumann <Tim.Neumann@advantest.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-09 00:55:09 +01:00
Matthias Sohn 42f0c7c9cb 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>
2019-12-08 01:09:24 +01:00
David Pursehouse 8a633bde8a Merge branch 'stable-5.6'
* stable-5.6:
  Cleanup CommitAndLogCommandTest
  CLI: Add support for excluding paths from Git log command

Change-Id: I2f48e16640ab1b13f0c32779422add3162260c50
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-12-06 10:20:07 +09:00
Matthias Sohn c42f314b6d Fix API check errors introduced in ReceivePack in 945d43d5
- add missing @since tag on new field connectivityChecker
- suppress warning for this added field which may affect subclasses
which is ok

Change-Id: Id6c22258efd10fa3847290f3dcfa42893b6ae882
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-05 23:34:40 +01:00
Matthias Sohn 02dc0ca688 Cleanup CommitAndLogCommandTest
- if a test can throw different exceptions declare it throws Exception
- fix code formatting

Change-Id: I55d63918f3163b31f2297d6217d5855108dd43b5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-05 22:48:55 +01:00
John Tipper 5bf226d50c CLI: Add support for excluding paths from Git log command
Git log supports the exclude pathspec, which allows for excluding paths
from the log command. JGit only supports adding paths to the log
command. See the following StackOverflow question for details:
https://stackoverflow.com/questions/59143934/java-jgit-how-to-get-git-
commits-not-affecting-certain-directories
This commit adds an excludePath() method to the log command. It does not
yet support regex or glob wildcards.

Change-Id: I8cd59950b87850b55a15c7e2ea5470145c9aae28
Signed-off-by: John Tipper <john_tipper@hotmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-05 22:38:12 +01:00
Demetr Starshov 945d43d507 ReceivePack: Moves connectivity check to separate class
Move all connectivity check to separate classes. Set default to be
FullConnectivityChecker i.e. checker which will check connectivity
from all advertised refs. Add ability to set other connectivity
checker which can use different approach.

Signed-off-by: Demetr Starshov <dstarshov@google.com>
Change-Id: Ibb107dbfbdde8ad109be25b5ecf42be7660ef736
2019-12-05 11:46:36 -08:00
David Pursehouse 97844038d9 Upgrade error_prone_core to 2.3.4
Change-Id: I7e91acc4d094d92cac41d5044268dfc2208bb663
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-12-05 09:46:56 +01:00
David Pursehouse f350e889d6 Merge branch 'stable-5.6'
* stable-5.6:
  ReftableTest: Clean up boxing warnings on usage of String.format
  MergedReftable: Remove unnecessary semicolon

Change-Id: Id35406acfdd91c3ddf17ce4e1023395f774774f2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-12-05 10:46:44 +09:00
Matthias Sohn a4ad83c96c Suppress API error for RefDatabase.hasFastTipsWithSha1()
This method was added in stable-5.6 after 5.6 RC1 was tagged. It's shown
as an API error when using 5.6.0 RC1 as the API baseline for master.
This suppression can be removed when 5.6 is released which will serve as
the API baseline for 5.7.

Change-Id: Ic6359fe59ed2d2a9431583b0854ec86bbac76880
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-05 01:56:31 +01:00
Matthias Sohn 1cb37e89d2 Remove API filters which became obsolete after bumping version to 5.7.0
Change-Id: I00b8d3e2e1023794f24d9447e3b0214c50353838
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-05 01:55:04 +01:00
David Pursehouse b24ec8f715 ReftableTest: Clean up boxing warnings on usage of String.format
Passing int as an argument to String.format causes a warning:

  The expression of type int is boxed into Integer

Most of these are already suppressed, but there are a couple that are
not. Add suppressions for those.

For the existing ones, move the suppression scope from the method to
the actual usage. Where necessary extract the usage out to a local
variable.

Change-Id: I7a7ff6dec49467e4b5c58d27a231c74e6e1c5437
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-12-05 09:54:14 +09:00
Matthias Sohn e2c12c3910 Add missing @since tag for ReceivePack#receiveWithExceptionPropagation
Change-Id: Ie64abc3e5bcf6dbaecfa8f2cb50796703ebd1f39
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-05 01:51:29 +01:00
David Pursehouse 62d16a9146 MergedReftable: Remove unnecessary semicolon
Change-Id: I67d2b8ba3cd8f94363cea864918c8ed6026f2d18
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2019-12-05 09:42:52 +09:00
Matthias Sohn f487a9eb2e Prepare 5.7.0-SNAPSHOT builds
Change-Id: I7efa0cd08dee711d6fefc3e6bb478a3cb11fe85c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-05 01:32:59 +01:00
Matthias Sohn 08d4c63b6d Merge branch 'stable-5.6'
* stable-5.6:
  Introduce RefDatabase#hasFastTipsWithSha1
  Update Orbit to R20191126223242 for 2019-12
  Prepare 5.6.0-SNAPSHOT builds
  JGit v5.6.0.201912041214-rc1
  Prepare 5.6.0-SNAPSHOT builds
  JGit v5.6.0.201911271000-m3

Change-Id: Id33b054131bbcd27a0ae7200f564775049698d2c
2019-12-05 01:31:32 +01:00
Han-Wen Nienhuys 5185d288c1 Introduce RefDatabase#hasFastTipsWithSha1
The reftable format supports fast inverse (SHA1 => ref) queries.

If the ref database does not support fast inverse queries, it may be
advantageous to build a complete SHA1 to ref map in advance for
multiple uses. To let applications decide, this function indicates
whether the inverse map is available.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: Idaf7e01075906972ec21332cade285289619c2b3
2019-12-04 23:35:32 +01:00
Matthias Sohn 3198df1860 Update Orbit to R20191126223242 for 2019-12
Change-Id: I205d4f4a529f34c15a1afb4c791088a8e22986f0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-04 22:41:13 +01:00
Matthias Sohn 473527e42c Prepare 5.6.0-SNAPSHOT builds
Change-Id: I5e737ff7f262fdd43fc975a0b3594c8b33919663
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-04 22:13:56 +01:00
Matthias Sohn a7e454bc51 JGit v5.6.0.201912041214-rc1
Change-Id: I5ed21fbc5f83096bf0b79f2aa751db415cbcc7e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-12-04 18:14:43 +01:00