]> source.dussan.org Git - jgit.git/log
jgit.git
5 years agoFileSnapshot#toString: Suppress ReferenceEquality warnings 43/144143/2
David Pursehouse [Sun, 16 Jun 2019 04:33:30 +0000 (13:33 +0900)]
FileSnapshot#toString: Suppress ReferenceEquality warnings

Reference comparison with EMPTY and MISSING_FILE is intended; these
are static instances used as markers, and will always be the same
instances.

Change-Id: Ic27f5b797bdb9370cf8f6b3b7bb3f1523d4a454c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBlame: Suppress ReferenceEquality warning for RevCommit instances 85/143785/4
David Pursehouse [Wed, 12 Jun 2019 04:02:07 +0000 (13:02 +0900)]
Blame: Suppress ReferenceEquality warning for RevCommit instances

Reference comparison of the RevCommit objects is OK; BlameGenerator uses
a single RevWalk which caches the RevCommits, so if a given commit is
cached the RevWalk will always return the same instance.

Factor the comparison out to a method, and suppress the warning with an
explanatory comment.

Change-Id: I5a148001dba7749ac15119aed388adb12b6f51ad
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agopgm: add missing optional dependency to org.tukaani:xz 64/144164/1
Matthias Sohn [Sun, 16 Jun 2019 18:45:47 +0000 (20:45 +0200)]
pgm: add missing optional dependency to org.tukaani:xz

Otherwize the jgit command line does not support the xz archive format.

Change-Id: I64897e658e4ed761614948b9d432f26e83034f15
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoNetscapeCookieFile: Make hash static and group overloaded write 21/143821/4
Ivan Frade [Wed, 12 Jun 2019 08:23:09 +0000 (10:23 +0200)]
NetscapeCookieFile: Make hash static and group overloaded write

Issues reported by downstream analyzers.

The "hash" method can be static.

It is a good practice to group overloaded methods. Move the write(URL)
method with the other writes.

Change-Id: Ia42c0d7081333edcb77e58d5e627929d29672490
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoNetscapeCookieFile: Javadoc fixes 20/143820/4
Ivan Frade [Wed, 12 Jun 2019 08:18:10 +0000 (10:18 +0200)]
NetscapeCookieFile: Javadoc fixes

Downstream analyzers reported empty fields in the javadoc. I corrected
few more details:

* Fill empty javadoc fields.
* Use <p> to separate description paragraphs.
* End description paragraphs with a period.
* Remove period at the end of field descriptions.

Change-Id: I749e4b821fc855999caddc442ac788fa514386ea
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoConfig: Handle reference-equality warning (and empty javadoc) 19/143819/5
Ivan Frade [Wed, 12 Jun 2019 07:50:38 +0000 (09:50 +0200)]
Config: Handle reference-equality warning (and empty javadoc)

Reported by downstream analyzers. Suppress the warning on reference
equality for isMissing and fill an empty javadoc field.

Change-Id: I3494423daf2a53ca10e0a9c66553f00204c35396
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoError Prone: Increase severity of ShortCircuitBoolean to ERROR 91/143791/3
David Pursehouse [Wed, 12 Jun 2019 05:23:42 +0000 (14:23 +0900)]
Error Prone: Increase severity of ShortCircuitBoolean to ERROR

Change-Id: Ib3f1b8b37160e2bd715dfc81a845e4c6fcfea2c5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoObjectWalk: Prefer boolean operators over logical operators in comparisons 90/143790/3
David Pursehouse [Wed, 12 Jun 2019 05:21:39 +0000 (14:21 +0900)]
ObjectWalk: Prefer boolean operators over logical operators in comparisons

Using the | and & operators in boolean conditions results in a warning
from Error Prone:

  [ShortCircuitBoolean]
  Prefer the short-circuiting boolean operators && and || to & and |.
  see https://errorprone.info/bugpattern/ShortCircuitBoolean

Change-Id: I182f986263b8b9ac189907f4bd1662b4092a52d8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBasePackFetchConnection: Prefer boolean operators over logical operators in comparisons 87/143787/3
David Pursehouse [Wed, 12 Jun 2019 04:12:52 +0000 (13:12 +0900)]
BasePackFetchConnection: Prefer boolean operators over logical operators in comparisons

Using the | and & operators in boolean conditions results in a warning
from Error Prone:

  [ShortCircuitBoolean]
  Prefer the short-circuiting boolean operators && and || to & and |.
  see https://errorprone.info/bugpattern/ShortCircuitBoolean

Change-Id: I6cccca3fdd28bf93b302a9b8a66e68ac912cb60d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoPackWriter: Prefer boolean operators over logical operators in comparisons 86/143786/3
David Pursehouse [Wed, 12 Jun 2019 04:10:32 +0000 (13:10 +0900)]
PackWriter: Prefer boolean operators over logical operators in comparisons

Using the | and & operators in boolean conditions results in a warning
from Error Prone:

  [ShortCircuitBoolean]
  Prefer the short-circuiting boolean operators && and || to & and |.
  see https://errorprone.info/bugpattern/ShortCircuitBoolean

Change-Id: I4275c60306e43c74030c4465ba02cb853ad444e1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoPrepare 5.4.1-SNAPSHOT builds 59/143859/1
Matthias Sohn [Wed, 12 Jun 2019 15:35:11 +0000 (17:35 +0200)]
Prepare 5.4.1-SNAPSHOT builds

Change-Id: I8620d03c1cd5c1d0ad04e7607553e9aa18def9bb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.4.0.201906121030-r 40/143840/1 v5.4.0.201906121030-r
Matthias Sohn [Wed, 12 Jun 2019 14:29:11 +0000 (16:29 +0200)]
JGit v5.4.0.201906121030-r

Change-Id: Ie68828af68d07cf8e3fe778d39436f539f1c73d0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.4.0.201906120450-r 09/143809/1
Matthias Sohn [Wed, 12 Jun 2019 08:50:14 +0000 (10:50 +0200)]
JGit v5.4.0.201906120450-r

Change-Id: Iea17cba848d4e53d69d34e952a2476c375721aa4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoIncrease severity of OperatorPrecedence to ERROR, and fix instances 79/143779/1
David Pursehouse [Wed, 12 Jun 2019 00:06:46 +0000 (09:06 +0900)]
Increase severity of OperatorPrecedence to ERROR, and fix instances

Fix all remaining instances of the OperatorPrededence warning, by adding
parentheses to make the precedence explicit.

Change-Id: Ib296dfed09f9be042d0ff0f7fad8214e4dd766b4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge branch 'master' into stable-5.4 70/143770/2
Matthias Sohn [Tue, 11 Jun 2019 21:09:19 +0000 (23:09 +0200)]
Merge branch 'master' into stable-5.4

* master:
  Handle missing "ours" stage in WorkingTreeIterator.hasCrLfInIndex()
  Config: Add helper method to check for empty value
  ErrorProne: Increase severity of FutureReturnValueIgnored to ERROR
  FS_Win32: Add missing parentheses on if-blocks
  Upgrade spotbugs to 3.1.12
  Abbreviated{Long}ObjectId: Make operator precedence explicit
  GC: Update TODO comments
  FS_POSIX: Fix reference comparison of Boolean.FALSE
  Increase bazel timeout for long running tests
  Use bazelisk to switch between used bazel version
  Bump minimum Bazel version to 0.26.1
  Bazel: Bump skylib library version to 0.8.0
  Retry loading config when locked by another process
  Make pull --rebase on an unborn branch do a checkout
  Warn if configured cookie file is missing
  Handle escaped CR-LF in git config files
  DescribeCommand: use glob match instead of path match
  Fix off-by-one error in RebaseTodoFile when reading a todo file
  Consistently use "!isEmpty()" to detect non-empty list
  TransportHttp: Check for non-empty list with "!isEmpty()" rather than
    "size() > 0"
  TransportHttp: Fix comparison of size with ">= 0"
  NetscapeCookieFileTest: Split HttpCookiesMatcher to own class
  Bazel: Add missing dependency on mockito for TransportHttpTest
  Determine hard-linking and nlink support per FileStore
  Support reading and writing cookies.
  Repository: Add getIdentifier() method to avoid instanceof operator
  Update to Orbit R20190602212107
  PacketLineIn: Deprecate the END constant
  PacketLineIn: Add an iterator over strings in the input stream
  Replace most usages of PacketLineIn.END with PacketLineIn.end()
  PacketLineIn: Deprecate DELIM constant
  Replace trivial reference comparison of PacketLineIn.{DELIM,END}
  PacketLineIn: Rename isDelim to isDelimiter
  ProtocolV2ParserTest: Fix typo in comment
  Upgrade Bouncy Castle to 1.61
  Update to Orbit R20190531194818 and rollback update to Ant 1.10.6
  cli: Add the --always option to describe
  DescribeCommand: Support the "always" option
  cli: Add the --tags option to describe
  DescribeCommand: Consistenly omit the default value
  Remove excess blank line in FileUtilsTest
  PacketLineIn: Add helper methods to check for END and DELIM
  UploadPackTest: Rename variable to avoid hiding class member
  UploadPackTest: Add missing <> operator on instantiation of ArrayList
  BitmapCalculator: javadoc fixes
  RevWalkUtils: add progress callback to findBranchesReachableFrom
  Upgrade maven-source-plugin to 3.1.0
  Upgrade maven-jar-plugin to 3.1.2
  Upgrade jacoco-maven-plugin to 0.8.4
  BitmapCalculator and its test: add missing license header
  RevWalk: new method createReachabilityChecker()

Change-Id: I4d76c7c0dbe6411c842f3468b709f7df51789c08
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoHandle missing "ours" stage in WorkingTreeIterator.hasCrLfInIndex() 16/143716/1
Thomas Wolf [Tue, 11 Jun 2019 11:16:18 +0000 (13:16 +0200)]
Handle missing "ours" stage in WorkingTreeIterator.hasCrLfInIndex()

In a delete-modify conflict with the deletion as "ours" there may be
no stage 2 in the index. Add appropriate null checks. Add a new test
for this case, and verify that the file gets added with a single LF
after conflict resolution with core.autocrlf=true. This matches the
behavior of canonical git for this case.

Bug: 547724
Change-Id: I1bafdb83d9b78bf85294c78325e818e72fae53bc
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoConfig: Add helper method to check for empty value 75/143575/4
David Pursehouse [Sat, 8 Jun 2019 06:01:44 +0000 (15:01 +0900)]
Config: Add helper method to check for empty value

Rename MAGIC_EMPTY_VALUE to MISSING_ENTRY, make it private, and add
a helper method to check if a given string is that value.

This avoids that callers trigger the "reference equality" warning
from Error Prone.

Change-Id: Idc76f78c0cf1828aa48d02ee33911a4b5df50355
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoErrorProne: Increase severity of FutureReturnValueIgnored to ERROR 77/143577/4
David Pursehouse [Sat, 8 Jun 2019 06:47:42 +0000 (15:47 +0900)]
ErrorProne: Increase severity of FutureReturnValueIgnored to ERROR

The only remaining code where the return value is ignored is in tests.
Update them to store the value and perform a basic assertion.

Change-Id: I29ef5bd5dd0648aac3490f9e47ecc74544109652
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoFS_Win32: Add missing parentheses on if-blocks 76/143576/4
David Pursehouse [Sat, 8 Jun 2019 06:06:22 +0000 (15:06 +0900)]
FS_Win32: Add missing parentheses on if-blocks

Change-Id: I70504484f20aee103e51c852d71cd41b54093793
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpgrade spotbugs to 3.1.12 52/143652/2
David Pursehouse [Tue, 11 Jun 2019 00:24:26 +0000 (09:24 +0900)]
Upgrade spotbugs to 3.1.12

Change-Id: I8093ce8342ab98f12ffabaf2862e6f1b161c4c87
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoAbbreviated{Long}ObjectId: Make operator precedence explicit 79/143579/4
David Pursehouse [Sat, 8 Jun 2019 07:25:32 +0000 (16:25 +0900)]
Abbreviated{Long}ObjectId: Make operator precedence explicit

Change-Id: Iafd616d3fdc81ac3072f776061548be195270d85
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoGC: Update TODO comments 78/143578/4
David Pursehouse [Sat, 8 Jun 2019 06:48:57 +0000 (15:48 +0900)]
GC: Update TODO comments

The TODO comments say "in 5.0", but 5.0 was already released without
resolving them. Remove "in 5.0" on the assumption that the mentioned
improvements still need to be done at some point.

Change-Id: I3eb429803e2266de3fc490e1f3912991c08aa1ad
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoFS_POSIX: Fix reference comparison of Boolean.FALSE 74/143574/3
David Pursehouse [Sat, 8 Jun 2019 05:54:19 +0000 (14:54 +0900)]
FS_POSIX: Fix reference comparison of Boolean.FALSE

Change-Id: Ic205d017b365ea85983d0b0d9d033fcf7e6bf6ab
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoIncrease bazel timeout for long running tests 48/143648/2
Matthias Sohn [Mon, 10 Jun 2019 21:35:20 +0000 (23:35 +0200)]
Increase bazel timeout for long running tests

EolRepositoryTest and GcCommitSelectionTest timed out frequently when
running unit tests using bazel with the default timeout "moderate"
(300s). Increase timeout of these tests to "long" (900s).

Change-Id: I43588cf950f55b50f868d9fe9c66d22bd428a54c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUse bazelisk to switch between used bazel version 84/143584/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 agoBump minimum Bazel version to 0.26.1 83/143583/2
David Ostrovsky [Sat, 8 Jun 2019 15:32:35 +0000 (17:32 +0200)]
Bump minimum Bazel version to 0.26.1

Change-Id: I8d6f9eac5af54e5b270e7db4e52d1b4063c1aa56
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
5 years agoBazel: Bump skylib library version to 0.8.0 82/143582/2
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 agoRetry loading config when locked by another process 30/126730/3
Michael Keppler [Sun, 29 Jul 2018 05:53:11 +0000 (07:53 +0200)]
Retry loading config when locked by another process

When loading the config, a FileNotFoundException may occur if the file
exists but cannot be read (see [1]). This is the case on Windows with a
virus scanner checking the file. Therefore if the file exists and that
exception is thrown, retry multiple times, similar to how this was
already implemented for IOException.

[1] https://docs.oracle.com/javase/8/docs/api/java/io/FileNotFoundException.html

Bug: 529522
Change-Id: Ic5dc3b7b24bb0005d6256ed00513bc7c0b91e613
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMake pull --rebase on an unborn branch do a checkout 67/137967/2
Thomas Wolf [Sun, 3 Mar 2019 23:07:40 +0000 (00:07 +0100)]
Make pull --rebase on an unborn branch do a checkout

A merging pull on an unborn branch was already supported. But a
rebasing pull failed. If the user has pull.rebase = true in his
user config, the pull would try to rebase. Rebasing needs a parent
commit, though. Native git handles this case:

  git init
  git remote add origin <URI>
  git pull --rebase origin master

Check up front in PullCommand for the unborn head and just do a
checkout in this case. MergeCommand already has similar code.

Bug: 544965
Change-Id: I1277e1ac0b0364b4623fd791f3d6b07bd5f58fca
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoWarn if configured cookie file is missing 94/143594/2
Matthias Sohn [Sun, 9 Jun 2019 07:49:07 +0000 (09:49 +0200)]
Warn if configured cookie file is missing

We logged a stack trace if the configured http.cookieFile was missing.
Instead only log a warning.

Bug: 548081
Change-Id: I42e39f5ad8ffce7b43162e5068f60af073b8a126
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoHandle escaped CR-LF in git config files 38/140138/4
Thomas Wolf [Fri, 5 Apr 2019 19:33:14 +0000 (21:33 +0200)]
Handle escaped CR-LF in git config files

Canonical git treats CR-LF in config files as LF.[1][2] JGit does so,
too, except when escaped as a line continuation. Correct this and
treat the sequence \-CR-LF as a line continuation.

[1] https://github.com/git/git/commit/db2c075d9
[2] https://github.com/git/git/blob/v2.21.0/config.c#L485

Bug: 545850
Change-Id: I51e7378a22c21b3baa3701163c423d04c900af5a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoDescribeCommand: use glob match instead of path match 30/141730/2
Thomas Wolf [Tue, 30 Apr 2019 17:11:16 +0000 (19:11 +0200)]
DescribeCommand: use glob match instead of path match

Otherwise tags may fail to match if their name contains slashes.
Canonical git also uses its wildcard matcher in glob mode.[1]

[1] https://github.com/git/git/blob/v2.21.0/builtin/describe.c#L182

Bug: 546703
Change-Id: I122c7959974fa1fc6a53dfc65837e4314a8badd4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoFix off-by-one error in RebaseTodoFile when reading a todo file 25/140925/2
Thomas Wolf [Sun, 21 Apr 2019 19:23:30 +0000 (21:23 +0200)]
Fix off-by-one error in RebaseTodoFile when reading a todo file

Commit messages of length 1 were not read. 'lineEnd' is the offset
of the last character in the line before the terminating LF or CR-LF,
and 'nextSpace' is actually the offset of the character _after_ the
next space. With a one-character commit message, nextSpace == lineEnd.

The code also assumes the commit message to be optional, but actually
failed in that case because it read beyond the line ending. Fix that,
too.

Add a test case for reading a todo file.

Bug: 546245
Change-Id: I368d63615930ea2398a6230e756442fd88870654
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoConsistently use "!isEmpty()" to detect non-empty list 83/143483/1
David Pursehouse [Fri, 7 Jun 2019 03:12:44 +0000 (12:12 +0900)]
Consistently use "!isEmpty()" to detect non-empty list

Replace "size() > 0" with "!isEmpty()" where appropriate.

In the Status implementation we can drop the check; the subsequent
loop will only execute when the list is non-empty anyway.

Change-Id: I355aff551a603373e702a9d44304f087b476263c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoTransportHttp: Check for non-empty list with "!isEmpty()" rather than "size() > 0" 81/143481/1
David Pursehouse [Fri, 7 Jun 2019 01:59:46 +0000 (10:59 +0900)]
TransportHttp: Check for non-empty list with "!isEmpty()" rather than "size() > 0"

Change-Id: Iabb627c8f584346eb8ace3c24afb63b4d1ad3d47
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoTransportHttp: Fix comparison of size with ">= 0" 80/143480/1
David Pursehouse [Fri, 7 Jun 2019 01:57:15 +0000 (10:57 +0900)]
TransportHttp: Fix comparison of size with ">= 0"

Error Prone reports:

  [SizeGreaterThanOrEqualsZero] Comparison of a size >= 0 is always true,
  did you intend to check for non-emptiness?

  see https://errorprone.info/bugpattern/SizeGreaterThanOrEqualsZero

Change-Id: Ie964771cacca4b15569eb45f6e273ad2a7e2e49c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoNetscapeCookieFileTest: Split HttpCookiesMatcher to own class 79/143479/1
David Pursehouse [Fri, 7 Jun 2019 01:51:21 +0000 (10:51 +0900)]
NetscapeCookieFileTest: Split HttpCookiesMatcher to own class

The bazel build fails due to NetscapeCookieFileTest's internal class not
being visible to TransportHttpTest.

Split the file out to its own class in the util package, so it's visible
to both.

Change-Id: I69236026eecb9d08a9a66e51752a80ea522b0c6a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBazel: Add missing dependency on mockito for TransportHttpTest 78/143478/1
David Pursehouse [Fri, 7 Jun 2019 01:22:13 +0000 (10:22 +0900)]
Bazel: Add missing dependency on mockito for TransportHttpTest

Change-Id: I54eff21c7aa8ee4b3b4a2fea60c5bca359256808
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoDetermine hard-linking and nlink support per FileStore 85/142385/2
Thomas Wolf [Sat, 18 May 2019 21:48:54 +0000 (23:48 +0200)]
Determine hard-linking and nlink support per FileStore

It's quite possible that JGit can use the hard-linking mechanism
for atomic file creation on some volumes but not on others.
Ultimately it depends on the file systems on the mounted volumes.

Cache the information per FileStore instead of using a single
global flag. Also catch FileSystemException, it may be thrown
if the operating system reports a failure. The previously caught
AccessDeniedException is a sub-class of FileSystemException.

Bug: 547332
Change-Id: I1ef672b3468b0be79e71674344f16f28f9d11ba1
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoSupport reading and writing cookies. 04/132704/25
Konrad Windszus [Mon, 19 Nov 2018 17:10:07 +0000 (18:10 +0100)]
Support reading and writing cookies.

The git config entries "http.cookieFile" and
"http.saveCookies" are correctly evaluated.

Bug: 488572
Change-Id: Icfeeea95e1a5bac3fa4438849d4ac2306d7d5562
Signed-off-by: Konrad Windszus <konrad_w@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPackWriter: Make internal class static 78/143178/4
David Pursehouse [Sun, 2 Jun 2019 08:45:32 +0000 (17:45 +0900)]
PackWriter: Make internal class static

When Error Prone checks are enabled, the "ClassCanBeStatic" warning is
triggered:

  Inner class is non-static but does not reference enclosing class
  see https://errorprone.info/bugpattern/ClassCanBeStatic

Change-Id: I5a0e3bf0cf8c28176d9c98914c1c0dfab9c5736f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge branch 'stable-5.3' into stable-5.4 53/143453/2
Matthias Sohn [Thu, 6 Jun 2019 09:34:56 +0000 (11:34 +0200)]
Merge branch 'stable-5.3' into stable-5.4

* stable-5.3:
  Prepare 5.3.3-SNAPSHOT builds
  JGit v5.3.2.201906051522-r
  Prepare 5.1.9-SNAPSHOT builds
  JGit v5.1.8.201906050907-r
  Test detecting modified packfiles
  Enhance fsTick() to use filesystem timer resolution
  Add debug trace to measure time needed to open pack index
  Extend FileSnapshot for packfiles to also use checksum to detect changes
  Wait opening new packfile until it can't be racy anymore
  Avoid null PackConfig in GC
  Add FileSnapshot test testing recognition of file size changes
  Capture reason for result of FileSnapshot#isModified
  Skip FileSnapshotTest#testSimulatePackfileReplacement on Windows
  Tune max heap size for tests
  Fix FileSnapshotTest.testNewFileNoWait() to match its javadoc
  ObjectDirectory: fix closing of obsolete packs
  Update API filters for methods added to fix bugs
  Bazel: Increase severity of most error-prone checks to ERROR
  Enable error-prone checks by default
  Add bazel options to align with gerrit's
  Include filekey file attribute when comparing FileSnapshots
  Measure file timestamp resolution used in FileSnapshot
  Fix FileSnapshot's consideration of file size
  Fix API problem filters
  Fix API problem filters

Change-Id: Ie1c7e4752661aec9e1754660934921224e2408eb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 5.3.3-SNAPSHOT builds 52/143452/1
Matthias Sohn [Wed, 5 Jun 2019 21:35:14 +0000 (23:35 +0200)]
Prepare 5.3.3-SNAPSHOT builds

Change-Id: Idebf272835cb22c21257c88b414ada802629b665
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRepository: Add getIdentifier() method to avoid instanceof operator 61/142261/12
David Ostrovsky [Thu, 16 May 2019 15:06:57 +0000 (17:06 +0200)]
Repository: Add getIdentifier() method to avoid instanceof operator

This change is needed to implement permission aware ref database in
Gerrit: [1], that is a pre-requisite to re-enable Git v2 protocol in
Gerrit: [2].

Background: Last year Git v2 protocol was enabled in Gerrit. The fact,
that JGit layer was not calling ref advertise filter for Git v2
protocol, introduced security vulnerability.

The lesson learned from this security incident: Gerrit should not rely
on ref advertise filter being called by JGit to implement crictical
security checks. Instead, the idea is to use the same approach as
currently used by Google's internal code on googlesource.com that
didn't suffer from this vulnerability: provide a custom repository to
JGit. The repository provides a RefDatabase that is permission-aware
and will only ever return refs that the user has access to.

However, due to hard coded instanceof operator usages in JGit code
base, some tests in Gerrit are failing with: [1] in place. This change
addresses this problem.

[1] https://gerrit-review.googlesource.com/c/gerrit/+/212874
[2] https://gerrit-review.googlesource.com/c/gerrit/+/226754

Change-Id: I67c0f53ca33b149442e7ee3e51910d19e3f348d5
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.3.2.201906051522-r 00/143400/1 v5.3.2.201906051522-r
Matthias Sohn [Wed, 5 Jun 2019 19:23:13 +0000 (21:23 +0200)]
JGit v5.3.2.201906051522-r

Change-Id: I41b4926f4bfa896ef2a13c35e93e08071ae949a3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.2' into stable-5.3 99/143399/1
Matthias Sohn [Wed, 5 Jun 2019 19:18:21 +0000 (21:18 +0200)]
Merge branch 'stable-5.2' into stable-5.3

* stable-5.2:
  Prepare 5.1.9-SNAPSHOT builds
  JGit v5.1.8.201906050907-r
  Test detecting modified packfiles
  Enhance fsTick() to use filesystem timer resolution
  Add debug trace to measure time needed to open pack index
  Extend FileSnapshot for packfiles to also use checksum to detect changes
  Wait opening new packfile until it can't be racy anymore
  Avoid null PackConfig in GC
  Add FileSnapshot test testing recognition of file size changes
  Capture reason for result of FileSnapshot#isModified
  Skip FileSnapshotTest#testSimulatePackfileReplacement on Windows
  Tune max heap size for tests
  Fix FileSnapshotTest.testNewFileNoWait() to match its javadoc
  ObjectDirectory: fix closing of obsolete packs
  Include filekey file attribute when comparing FileSnapshots
  Measure file timestamp resolution used in FileSnapshot
  Fix FileSnapshot's consideration of file size
  Fix API problem filters
  Fix API problem filters

Change-Id: Id79a3a19f9a31dff94d10a406c2b6e08a506931a

5 years agoMerge branch 'stable-5.1' into stable-5.2 95/143395/2
Matthias Sohn [Wed, 5 Jun 2019 13:43:29 +0000 (15:43 +0200)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  Prepare 5.1.9-SNAPSHOT builds
  JGit v5.1.8.201906050907-r
  Test detecting modified packfiles
  Enhance fsTick() to use filesystem timer resolution
  Add debug trace to measure time needed to open pack index
  Extend FileSnapshot for packfiles to also use checksum to detect changes
  Wait opening new packfile until it can't be racy anymore
  Avoid null PackConfig in GC
  Add FileSnapshot test testing recognition of file size changes
  Capture reason for result of FileSnapshot#isModified
  Skip FileSnapshotTest#testSimulatePackfileReplacement on Windows
  Tune max heap size for tests
  Fix FileSnapshotTest.testNewFileNoWait() to match its javadoc
  ObjectDirectory: fix closing of obsolete packs
  Include filekey file attribute when comparing FileSnapshots
  Measure file timestamp resolution used in FileSnapshot
  Fix FileSnapshot's consideration of file size
  Fix API problem filters

Change-Id: I3ac77bfa03f7436de12ab86e1bba29afee5ccd01
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 5.1.9-SNAPSHOT builds 62/143362/1
Matthias Sohn [Wed, 5 Jun 2019 13:23:56 +0000 (15:23 +0200)]
Prepare 5.1.9-SNAPSHOT builds

Change-Id: I60571e4e0bea04bb2c25ef3d0332a9ab6895db06
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.1.8.201906050907-r 61/143361/1 v5.1.8.201906050907-r
Matthias Sohn [Wed, 5 Jun 2019 13:06:56 +0000 (15:06 +0200)]
JGit v5.1.8.201906050907-r

Change-Id: Iae0ffe161df2ca8a800d21688d6b7d7419dfb640
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoTest detecting modified packfiles 24/143124/6
Christian Halstrick [Fri, 31 May 2019 13:02:02 +0000 (15:02 +0200)]
Test detecting modified packfiles

Test that JGit detects that packfiles have changed even if they are
repacked multiple times in one tick of the filesystem timer.

Test that this detection works also when repacking doesn't change the
length or the filekey of the packfile. In this case where a modified
file can't be detected by looking at file metadata JGit should still
detect too fast modification by racy git checks and trigger rescanning
the pack list and consequently rereading of packfile content.

Change-Id: I67682cfb807c58afc6de9375224ff7489d6618fb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoEnhance fsTick() to use filesystem timer resolution 85/143285/2
Christian Halstrick [Tue, 4 Jun 2019 16:03:26 +0000 (18:03 +0200)]
Enhance fsTick() to use filesystem timer resolution

RepositoryTestCase.fsTick() was was waiting 64, 128, 256, ... milliseconds
until it detected that the filesystem timer has ticked. Make use of
the filesystemtimer resolution information in FS to sleep a fraction
of the filesystem timer resolution. That raises probability to wake up
shortly after the filesystem timer has ticked.

Change-Id: Ibcc38576e42ece13b2fd4423a29c459eed167a69

5 years agoAdd debug trace to measure time needed to open pack index 75/143275/4
Matthias Sohn [Tue, 4 Jun 2019 13:46:44 +0000 (15:46 +0200)]
Add debug trace to measure time needed to open pack index

Change-Id: Ia698cc06aa3fe6cb7903a687db8885f1b83c3bf2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoExtend FileSnapshot for packfiles to also use checksum to detect changes 34/142834/18
Matthias Sohn [Sun, 26 May 2019 20:40:47 +0000 (22:40 +0200)]
Extend FileSnapshot for packfiles to also use checksum to detect changes

If the attributes of FileSnapshot don't detect modification of a
packfile read the packfile's checksum and compare it against the
checksum cached in the loaded packfile.

Since reading the checksum needs less IO than reloading the complete
packfile this may help to reduce the overhead to detect modficiation
when a gc completes while ObjectDirectory scans for packfiles in another
thread.

Bug: 546891
Change-Id: I9811b497eb11b8a85ae689081dc5d949ca8c4be5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoWait opening new packfile until it can't be racy anymore 43/141843/20
Matthias Sohn [Wed, 8 May 2019 23:23:15 +0000 (01:23 +0200)]
Wait opening new packfile until it can't be racy anymore

If
- pack.waitPreventRacyPack = true (default is false)
- packfile size > pack.minSizePreventRacyPack (default is 100 MB)
wait after a new packfile was written and before it is opened until it
cannot be racy anymore.

If a new packfile is accessed while it's still racy at least the pack's
index will be reread by ObjectDirectory.scanPacksImpl(). Hence it may
save resources to wait one tick of the file system timer to avoid this
reloading. On filesystems with a coarse timestamp resolution it may be
beneficial to skip this wait for small packfiles.

Bug: 546891
Change-Id: I0e8bf3d7677a025edd2e397dd2c9134ba59b1a18
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate to Orbit R20190602212107 93/143193/2
Matthias Sohn [Mon, 3 Jun 2019 07:55:20 +0000 (09:55 +0200)]
Update to Orbit R20190602212107

This version fixed wrong
Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=9))"
in bouncycastle 1.61.

Bug: 547570
Change-Id: I715bcc4b39c3d4ad036dcc5bbdf48d321759f55f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPacketLineIn: Deprecate the END constant 76/143176/3
David Pursehouse [Sun, 2 Jun 2019 08:27:17 +0000 (17:27 +0900)]
PacketLineIn: Deprecate the END constant

Deprecate the constant with the intention of making it private in
a future release.

All existing usage of the constant within JGit code has already been
replaced with the recommended alternatives in preceding commits.

Change-Id: I10eb95f3f92cb74f93a26bf1a6edd24615b75c6f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoPacketLineIn: Add an iterator over strings in the input stream 75/143175/3
David Pursehouse [Sun, 2 Jun 2019 08:02:51 +0000 (17:02 +0900)]
PacketLineIn: Add an iterator over strings in the input stream

Allows callers to read all lines in the input stream until the
END marker is reached, without having to explicitly check for
the END marker.

Replace all remaining usage of the END marker with the new method.

Change-Id: I51f419c7f569ab7ed01e1aaaf6b40ed8cdc2116b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoReplace most usages of PacketLineIn.END with PacketLineIn.end() 73/143173/3
David Pursehouse [Sun, 2 Jun 2019 03:50:34 +0000 (12:50 +0900)]
Replace most usages of PacketLineIn.END with PacketLineIn.end()

PacketLineIn.END is only referenced in tests. Replace most of those
with a new package visible end() method.

Remaining usages of PacketLineIn.END are in the form:

  while ((line = pckIn.readString()) != PacketLineIn.END) {

and are not trivial replacements, hence are not touched in this change.

Change-Id: Id77c5321ddcad127130b246bde8f08736e60e1ea
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoPacketLineIn: Deprecate DELIM constant 72/143172/3
David Pursehouse [Sun, 2 Jun 2019 02:13:36 +0000 (11:13 +0900)]
PacketLineIn: Deprecate DELIM constant

Deprecate DELIM with the intention of making it private in a future
release.

Callers that want to test if a packet line string is the delimiter
should use the isDelimiter(String) method.

The only other references to DELIM in the JGit code are in tests. For
those, introduce a package visible delimiter() method.

Change-Id: I21e8bbac0ffb9ef710c9753e23435416b09a4891
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoReplace trivial reference comparison of PacketLineIn.{DELIM,END} 71/143171/2
David Pursehouse [Sun, 2 Jun 2019 02:04:59 +0000 (11:04 +0900)]
Replace trivial reference comparison of PacketLineIn.{DELIM,END}

Replace reference comparisons of PacketLineIn's DELIM and END strings
with usage of the helper methods isDelimiter() and isEnd().

Change-Id: I52dcfc4ee9097f1bd6970601c716701847d9eebd
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoPacketLineIn: Rename isDelim to isDelimiter 70/143170/2
David Pursehouse [Sun, 2 Jun 2019 02:16:52 +0000 (11:16 +0900)]
PacketLineIn: Rename isDelim to isDelimiter

Change-Id: I279808b8ddd8a9230a35582c00867b811633dfe8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoProtocolV2ParserTest: Fix typo in comment 69/143169/1
David Pursehouse [Sun, 2 Jun 2019 02:11:28 +0000 (11:11 +0900)]
ProtocolV2ParserTest: Fix typo in comment

Change-Id: I22b07179ba6e2517ae3e178c31fde20987cead34
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpgrade Bouncy Castle to 1.61 19/140719/8
Brandon Weeks [Tue, 16 Apr 2019 22:15:46 +0000 (00:15 +0200)]
Upgrade Bouncy Castle to 1.61

Also now use JcaKeyBoxBuilder constructor in
BouncyCastleGpgKeyLocator.readKeyBoxFile(Path).

CQ: 19868
CQ: 19869
CQ: 19870
Change-Id: I45bd80e158aecd90448b0c7e59615db27aaef892
Signed-off-by: Brandon Weeks <bweeks@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate to Orbit R20190531194818 and rollback update to Ant 1.10.6 58/143158/2
Matthias Sohn [Fri, 31 May 2019 12:57:06 +0000 (14:57 +0200)]
Update to Orbit R20190531194818 and rollback update to Ant 1.10.6

An issue has been reported with Java 1.8 and new Ant version 1.10.6
hence this was rolled back to 1.10.5 in Orbit.

See: https://bz.apache.org/bugzilla/show_bug.cgi?id=63457
Bug: 547607
Change-Id: I9c04c988ec89bb1e2cbb528a2d3add30a0b7b3b9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agocli: Add the --always option to describe 75/138975/7
Sebastian Schuberth [Mon, 18 Mar 2019 21:04:05 +0000 (22:04 +0100)]
cli: Add the --always option to describe

Change-Id: I0342d589e4deabe9d80ea3c9c6b48d7b265d8fe6
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
5 years agoDescribeCommand: Support the "always" option 22/138922/9
Sebastian Schuberth [Fri, 15 Mar 2019 14:27:18 +0000 (15:27 +0100)]
DescribeCommand: Support the "always" option

See:

https://git-scm.com/docs/git-describe#Documentation/git-describe.txt---always

Extend the tests accordingly.

Change-Id: Ibfcda338a246c8cba0df6b6e7b9bad76c9f8b593
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
5 years agocli: Add the --tags option to describe 74/138974/7
Sebastian Schuberth [Mon, 18 Mar 2019 21:00:15 +0000 (22:00 +0100)]
cli: Add the --tags option to describe

Change-Id: I78924e61e2050eeaff991ee56715f36514100492
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
5 years agoDescribeCommand: Consistenly omit the default value 32/143132/1
Sebastian Schuberth [Fri, 31 May 2019 15:08:39 +0000 (17:08 +0200)]
DescribeCommand: Consistenly omit the default value

Omit the default value of "false" for "useTags" like already done for
"longDesc".

Change-Id: I25aaacae028fc8cf27f4040ba45fe79609318aa1
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
5 years agoRemove excess blank line in FileUtilsTest 89/143089/2
Matthias Sohn [Thu, 30 May 2019 21:51:05 +0000 (23:51 +0200)]
Remove excess blank line in FileUtilsTest

Change-Id: I0d617feb7baacf9917b1da605fcb75f7d4ccd184
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPacketLineIn: Add helper methods to check for END and DELIM 63/143063/1
David Pursehouse [Thu, 30 May 2019 11:31:39 +0000 (20:31 +0900)]
PacketLineIn: Add helper methods to check for END and DELIM

These methods will allow clients to check for END and DELIM without
doing a reference comparison on the String objects, which raises
warnings from Error Prone.

Change-Id: I9e7e59843553ed4488ee8e864033198bbb60d67c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUploadPackTest: Rename variable to avoid hiding class member 62/143062/1
David Pursehouse [Thu, 30 May 2019 11:18:28 +0000 (20:18 +0900)]
UploadPackTest: Rename variable to avoid hiding class member

Change-Id: I9e02642b2f56a735681e58b8c8d6e3545ef9093b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUploadPackTest: Add missing <> operator on instantiation of ArrayList 61/143061/1
David Pursehouse [Thu, 30 May 2019 11:17:24 +0000 (20:17 +0900)]
UploadPackTest: Add missing <> operator on instantiation of ArrayList

Change-Id: I348cbcd75252d7857ada843dc496d445ee1d62fb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoAvoid null PackConfig in GC 23/142823/6
Matthias Sohn [Sun, 26 May 2019 15:12:06 +0000 (17:12 +0200)]
Avoid null PackConfig in GC

Initialize it using the repository's config already in the constructor.

Change-Id: I4ea620a7db72956e7109f739990f09644640206b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoAdd FileSnapshot test testing recognition of file size changes 05/141805/14
Matthias Sohn [Wed, 8 May 2019 01:25:53 +0000 (03:25 +0200)]
Add FileSnapshot test testing recognition of file size changes

Change-Id: Ibcd76a5e6e4183ada0be1d4436ce957243f2094d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoCapture reason for result of FileSnapshot#isModified 19/141919/10
Matthias Sohn [Thu, 9 May 2019 22:58:42 +0000 (00:58 +0200)]
Capture reason for result of FileSnapshot#isModified

This allows to verify the expected behavior in
FileSnapshotTest#testSimulatePackfileReplacement and enables extending
FileSnapshot for packfiles to read the packfile's checksum as another
criterion to detect modifications without reading the full content.

Also add another field capturing the result of the last check if
lastModified was racily clean.

Remove unnecessary determination of raciness in the constructor. It was
determined twice in all relevant cases.

Change-Id: I100a2f49d7949693d7b72daa89437e166f1dc107
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoSkip FileSnapshotTest#testSimulatePackfileReplacement on Windows 45/143045/1
Matthias Sohn [Wed, 29 May 2019 21:41:43 +0000 (23:41 +0200)]
Skip FileSnapshotTest#testSimulatePackfileReplacement on Windows

NTFS does not support FileKey hence ignore this test on Windows.

Change-Id: I7b53a591daa5e03eb5e401b5b26d612ab68ce10d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoTune max heap size for tests 94/142894/2
Matthias Sohn [Wed, 22 May 2019 12:42:43 +0000 (14:42 +0200)]
Tune max heap size for tests

This is an attempt to fix crashes observed on the new Jenkins
infrastructure running on Kubernetes [1].

Increase it to 512m for
- org.eclipse.jgit.ant.test
- org.eclipse.jgit.http.test
- org.eclipse.jgit.lfs.server.test
- org.eclipse.jgit.lfs.test
- org.eclipse.jgit.pgm.test

Decrease it to 768m for
- org.eclipse.jgit.test

[1] e.g. https://ci-staging.eclipse.org/jgit/job/stable/job/jgit.gerrit/16074/console

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

5 years agoFix FileSnapshotTest.testNewFileNoWait() to match its javadoc 04/141804/10
Matthias Sohn [Wed, 8 May 2019 01:19:15 +0000 (03:19 +0200)]
Fix FileSnapshotTest.testNewFileNoWait() to match its javadoc

testNewFileNoWait() was identical to testNewFileWithWait() but claims it
doesn't wait at all. Hence remove the waits.

Change-Id: I49b8ca5cb49a43c55fe61870c18c42f32fb4b74d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoObjectDirectory: fix closing of obsolete packs 36/142636/6
Marc Strapetz [Wed, 22 May 2019 21:51:12 +0000 (23:51 +0200)]
ObjectDirectory: fix closing of obsolete packs

This resolves a regression introduced in fef78212.

Change-Id: Ibb4521635a87012520566efc70870c59d11be874
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
5 years agoBitmapCalculator: javadoc fixes 88/142688/2
Ivan Frade [Thu, 23 May 2019 17:39:31 +0000 (10:39 -0700)]
BitmapCalculator: javadoc fixes

Fill out the description of when IOException is thrown.

Also fix a typo in the description for IncorrectObjectTypeException.

Change-Id: I9fafd19d68ddc4fe4e95e8516c2c38484b941a3a
Signed-off-by: Ivan Frade <ifrade@google.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpdate API filters for methods added to fix bugs 31/142831/1
Matthias Sohn [Wed, 15 May 2019 08:17:39 +0000 (10:17 +0200)]
Update API filters for methods added to fix bugs

Change-Id: I235c608d80a14c8af39400ae2e749488a4fa0d22
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoBazel: Increase severity of most error-prone checks to ERROR 16/142816/1
David Pursehouse [Sun, 26 May 2019 09:03:07 +0000 (18:03 +0900)]
Bazel: Increase severity of most error-prone checks to ERROR

Most of the checks can be increased to ERROR because there is no
code in the project that triggers them.

There are still several that are triggered, and these are left
at the WARN severity:

  https://errorprone.info/bugpattern/AmbiguousMethodReference
  https://errorprone.info/bugpattern/BadComparable
  https://errorprone.info/bugpattern/ClassNewInstance
  https://errorprone.info/bugpattern/Finally
  https://errorprone.info/bugpattern/FutureReturnValueIgnored
  https://errorprone.info/bugpattern/ImmutableEnumChecker
  https://errorprone.info/bugpattern/NarrowingCompoundAssignment
  https://errorprone.info/bugpattern/NonOverridingEquals
  https://errorprone.info/bugpattern/OperatorPrecedence
  https://errorprone.info/bugpattern/ReferenceEquality
  https://errorprone.info/bugpattern/ShortCircuitBoolean
  https://errorprone.info/bugpattern/StringEquality
  https://errorprone.info/bugpattern/TypeParameterUnusedInFormals

These can be cleaned up and increased to ERROR in follow-up
commits.

Change-Id: Icfc3b3163e129e504f10b3fc856aef262f723f99
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoEnable error-prone checks by default 15/142815/1
David Pursehouse [Sun, 26 May 2019 08:47:08 +0000 (17:47 +0900)]
Enable error-prone checks by default

Based on recent work by Dave Borowitz on the Gerrit project [1, 2].

The warnings/error configuration is unchanged, but now the checks are
enabled by default during the build rather than having to be manually
invoked.

[1] https://gerrit-review.googlesource.com/c/gerrit/+/225653
[2] https://gerrit-review.googlesource.com/c/gerrit/+/225714

Change-Id: I7f4849896af72de38880b13d64519cc93bb3d2a3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoAdd bazel options to align with gerrit's 12/142812/2
David Ostrovsky [Sat, 25 May 2019 15:05:08 +0000 (17:05 +0200)]
Add bazel options to align with gerrit's

Change-Id: I6addd5fcaecb8c2508e1d5776ecfed8ae676b6ed
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
5 years agoRevWalkUtils: add progress callback to findBranchesReachableFrom 77/142777/2
Andrey Loskutov [Sat, 25 May 2019 07:53:47 +0000 (09:53 +0200)]
RevWalkUtils: add progress callback to findBranchesReachableFrom

Offer a version of findBranchesReachableFrom method with progress
monitor callback. This is required to allow UI clients to cancel long
running operations and show progress.

Bug: 547642
Change-Id: I31d1de54dbaa6ffb11e03da4c447963e8defa1d0
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
5 years agoMerge branch 'stable-5.4' 99/142699/1
David Pursehouse [Thu, 23 May 2019 23:34:32 +0000 (08:34 +0900)]
Merge branch 'stable-5.4'

* stable-5.4:
  SystemReader: Respect passed-in parent when no system config is present
  Prepare 5.4.0-SNAPSHOT builds
  JGit v5.4.0.201905221418-m3
  Prepare 5.4.0-SNAPSHOT builds
  JGit v5.4.0.201905081430-m2

Change-Id: If69cb0afe9915b926d977e4ad26c7d72db31667c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge branch 'stable-5.3' into stable-5.4 98/142698/1
David Pursehouse [Thu, 23 May 2019 23:33:41 +0000 (08:33 +0900)]
Merge branch 'stable-5.3' into stable-5.4

* stable-5.3:
  SystemReader: Respect passed-in parent when no system config is present

Change-Id: I758ed0c2a3527ffcf6255158a49090aba090e942
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoSystemReader: Respect passed-in parent when no system config is present 97/142697/1
Dave Borowitz [Thu, 23 May 2019 20:56:00 +0000 (13:56 -0700)]
SystemReader: Respect passed-in parent when no system config is present

The default implementation of openSystemConfig has special handling for
when the FS returns null from getGitSystemConfig: it should return a
"real" FileBasedConfig instance that never actually tries to load a
file. However, this codepath was not respecting the passed-in parent
config.

Change-Id: Id0bcdc93bb42f9ebe3f5ee4c6b4be8863e0133f9

5 years agoUpgrade maven-source-plugin to 3.1.0 63/142463/3
David Pursehouse [Mon, 20 May 2019 23:25:38 +0000 (08:25 +0900)]
Upgrade maven-source-plugin to 3.1.0

Change-Id: I8253e75f5038b6c0e2205d74683e0ebd9839dd33
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpgrade maven-jar-plugin to 3.1.2 56/142056/4
David Pursehouse [Mon, 13 May 2019 09:24:29 +0000 (11:24 +0200)]
Upgrade maven-jar-plugin to 3.1.2

Change-Id: I9a291390205ee8c44b02c4081f2d8f17635d90ec
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpgrade jacoco-maven-plugin to 0.8.4 55/142055/4
David Pursehouse [Mon, 13 May 2019 09:23:31 +0000 (11:23 +0200)]
Upgrade jacoco-maven-plugin to 0.8.4

Change-Id: Ibab24e1f5eefdc14bcf9ab6d72eab7e0a0cfaad9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoBitmapCalculator and its test: add missing license header 40/142640/1
Matthias Sohn [Thu, 23 May 2019 00:12:16 +0000 (02:12 +0200)]
BitmapCalculator and its test: add missing license header

Change-Id: I3c4a8b1e9159b0553aa95213bb82628370b6c036
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 5.4.0-SNAPSHOT builds 31/142631/1
Matthias Sohn [Wed, 22 May 2019 20:52:43 +0000 (22:52 +0200)]
Prepare 5.4.0-SNAPSHOT builds

Change-Id: I9df6fccee253d4087f9afab4cb46e0a40b8a5699
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.4.0.201905221418-m3 12/142612/1 v5.4.0.201905221418-m3
Matthias Sohn [Wed, 22 May 2019 18:18:14 +0000 (20:18 +0200)]
JGit v5.4.0.201905221418-m3

Change-Id: I8a7e687acfcf8c341abd726ae60b5ee173422215
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRevWalk: new method createReachabilityChecker() 68/142468/6
Ivan Frade [Tue, 21 May 2019 00:14:22 +0000 (17:14 -0700)]
RevWalk: new method createReachabilityChecker()

Every caller would need to check if bitmaps are available in the repo to
instantiate a reachability checker.

Offer a method to create the reachability checker in the walk: the
caller has already a walk over the repo, and the walk has all the
information required.

This allows us to make the implementation classes package-private.

Change-Id: I355e47486fcd9d55baa7cb5700ec08dcc230eea5
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoMerge branch 'master' into stable-5.4 09/142609/1
Matthias Sohn [Wed, 22 May 2019 17:37:40 +0000 (19:37 +0200)]
Merge branch 'master' into stable-5.4

* master:
  ReachabilityCheckers: @since 5.4
  Update Orbit to S20190521195709 for 2019-06 M3
  Tune max heap size for tests
  GPG: check that the key found is a signing key
  GPG: use key fingerprint suffix to compare id for signing key
  Recognize ReachabilityCheckerTestCase as helper
  UploadPack: restore inadvertently deleted line
  UploadPack: Use reachability checker to validate non-advertised wants
  Bazel: Simplify names of bouncy castle libraries
  Convert to lambda or member reference
  BitmappedReachabilityChecker: Reachability check using bitmaps
  BitmapCalculator: Get the reachability bitmap of a commit
  ReachabilityChecker: Default implementation with a RevWalk

Change-Id: I323c460853230abcffa94c4f34f15dbaff8c330c

5 years agoReachabilityCheckers: @since 5.4 65/142465/3
Ivan Frade [Mon, 20 May 2019 23:46:47 +0000 (16:46 -0700)]
ReachabilityCheckers: @since 5.4

The new ReachabilityChecker interface and its implementations are marked
as @since 5.5, but they will make it to the 5.4 release.

Change-Id: I88c31b3300ccf35d18c35faddb2517f0a57bdcfd
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoUpdate Orbit to S20190521195709 for 2019-06 M3 03/142603/1
Matthias Sohn [Wed, 22 May 2019 15:34:58 +0000 (17:34 +0200)]
Update Orbit to S20190521195709 for 2019-06 M3

Update
- org.apache.ant to 1.10.6.v20190516-0412 (CQ 19829)
- org.apache.httpcomponents.httpclient to 4.5.6.v20190503-0009

CQ: 19829
Change-Id: Ia057d4f07dab21374ca66c3d87a2bab1c795562c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoTune max heap size for tests 90/142590/1
Matthias Sohn [Wed, 22 May 2019 12:42:43 +0000 (14:42 +0200)]
Tune max heap size for tests

This is an attempt to fix crashes observed on the new Jenkins
infrastructure running on Kubernetes [1].

Increase it to 512m for
- org.eclipse.jgit.ant.test
- org.eclipse.jgit.http.test
- org.eclipse.jgit.lfs.server.test
- org.eclipse.jgit.lfs.test
- org.eclipse.jgit.pgm.test

Decrease it to 768m for
- org.eclipse.jgit.test

[1] e.g. https://ci-staging.eclipse.org/jgit/job/stable/job/jgit.gerrit/16074/console

Change-Id: Id074ed0f7bcb8a13da649a547342af2a08439d9f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoInclude filekey file attribute when comparing FileSnapshots 48/141748/12
Matthias Sohn [Tue, 7 May 2019 21:55:54 +0000 (23:55 +0200)]
Include filekey file attribute when comparing FileSnapshots

Due to finite filesystem timestamp resolution the last modified
timestamp of files cannot detect file changes which happened in the
immediate past (less than one filesystem timer tick ago).

Some filesystems expose unique file identifiers, e.g. inodes in Posix
filesystems which are named filekeys in Java's BasicFileAttributes. Use
them as another means to detect file modifications based on stat
information.

Running git gc on a repository yields a new packfile with the same id as
a packfile which existed before the gc if these packfiles contain the
same set of objects. The content of the old and the new packfile might
differ if a different PackConfig was used when writing the packfile.
Considering filekeys in FileSnapshot may help to detect such packfile
modifications.

Bug: 546891
Change-Id: I711a80328c55e1a31171d540880b8e80ec1fe095
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>