summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Upgrade spotbugs to 3.1.12David Pursehouse2019-06-111-1/+1
| | | | | Change-Id: I8093ce8342ab98f12ffabaf2862e6f1b161c4c87 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Abbreviated{Long}ObjectId: Make operator precedence explicitDavid Pursehouse2019-06-112-2/+2
| | | | | Change-Id: Iafd616d3fdc81ac3072f776061548be195270d85 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* GC: Update TODO commentsDavid Pursehouse2019-06-111-2/+2
| | | | | | | | | 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>
* FS_POSIX: Fix reference comparison of Boolean.FALSEDavid Pursehouse2019-06-111-2/+2
| | | | | Change-Id: Ic205d017b365ea85983d0b0d9d033fcf7e6bf6ab Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Increase bazel timeout for long running testsMatthias Sohn2019-06-101-0/+4
| | | | | | | | | 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>
* Use bazelisk to switch between used bazel versionDavid Ostrovsky2019-06-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Bump minimum Bazel version to 0.26.1David Ostrovsky2019-06-101-1/+1
| | | | | Change-Id: I8d6f9eac5af54e5b270e7db4e52d1b4063c1aa56 Signed-off-by: David Ostrovsky <david@ostrovsky.org>
* Bazel: Bump skylib library version to 0.8.0David Ostrovsky2019-06-101-3/+3
| | | | | Change-Id: I2089899c9f197b2c93b93390fdd55f6fe11e5ce4 Signed-off-by: David Ostrovsky <david@ostrovsky.org>
* Retry loading config when locked by another processMichael Keppler2019-06-103-2/+21
| | | | | | | | | | | | | | 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>
* Make pull --rebase on an unborn branch do a checkoutThomas Wolf2019-06-102-0/+73
| | | | | | | | | | | | | | | | | 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>
* Warn if configured cookie file is missingMatthias Sohn2019-06-093-0/+7
| | | | | | | | 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>
* Handle escaped CR-LF in git config filesThomas Wolf2019-06-082-3/+55
| | | | | | | | | | | | | 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>
* DescribeCommand: use glob match instead of path matchThomas Wolf2019-06-072-6/+28
| | | | | | | | | | 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>
* Fix off-by-one error in RebaseTodoFile when reading a todo fileThomas Wolf2019-06-072-3/+151
| | | | | | | | | | | | | | | | 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>
* Consistently use "!isEmpty()" to detect non-empty listDavid Pursehouse2019-06-0711-17/+17
| | | | | | | | | | 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>
* TransportHttp: Check for non-empty list with "!isEmpty()" rather than ↵David Pursehouse2019-06-071-2/+2
| | | | | | | "size() > 0" Change-Id: Iabb627c8f584346eb8ace3c24afb63b4d1ad3d47 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* TransportHttp: Fix comparison of size with ">= 0"David Pursehouse2019-06-071-1/+1
| | | | | | | | | | | | 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>
* NetscapeCookieFileTest: Split HttpCookiesMatcher to own classDavid Pursehouse2019-06-074-104/+153
| | | | | | | | | | | 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>
* Bazel: Add missing dependency on mockito for TransportHttpTestDavid Pursehouse2019-06-071-0/+4
| | | | | Change-Id: I54eff21c7aa8ee4b3b4a2fea60c5bca359256808 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Determine hard-linking and nlink support per FileStoreThomas Wolf2019-06-061-9/+24
| | | | | | | | | | | | | | 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>
* Support reading and writing cookies.Konrad Windszus2019-06-0618-1/+1774
| | | | | | | | | 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>
* Repository: Add getIdentifier() method to avoid instanceof operatorDavid Ostrovsky2019-06-056-21/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Update to Orbit R20190602212107Matthias Sohn2019-06-0315-75/+78
| | | | | | | | | 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>
* PacketLineIn: Deprecate the END constantDavid Pursehouse2019-06-031-1/+9
| | | | | | | | | | | 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>
* PacketLineIn: Add an iterator over strings in the input streamDavid Pursehouse2019-06-034-37/+93
| | | | | | | | | | | 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>
* Replace most usages of PacketLineIn.END with PacketLineIn.end()David Pursehouse2019-06-034-81/+95
| | | | | | | | | | | | | | 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>
* PacketLineIn: Deprecate DELIM constantDavid Pursehouse2019-06-033-67/+81
| | | | | | | | | | | | | | 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>
* Replace trivial reference comparison of PacketLineIn.{DELIM,END}David Pursehouse2019-06-0214-66/+64
| | | | | | | | 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>
* PacketLineIn: Rename isDelim to isDelimiterDavid Pursehouse2019-06-022-2/+2
| | | | | Change-Id: I279808b8ddd8a9230a35582c00867b811633dfe8 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* ProtocolV2ParserTest: Fix typo in commentDavid Pursehouse2019-06-021-1/+1
| | | | | Change-Id: I22b07179ba6e2517ae3e178c31fde20987cead34 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Upgrade Bouncy Castle to 1.61Brandon Weeks2019-06-0114-100/+109
| | | | | | | | | | | | 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>
* Update to Orbit R20190531194818 and rollback update to Ant 1.10.6Matthias Sohn2019-06-0115-39/+39
| | | | | | | | | 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>
* cli: Add the --always option to describeSebastian Schuberth2019-05-312-0/+5
| | | | | Change-Id: I0342d589e4deabe9d80ea3c9c6b48d7b265d8fe6 Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
* DescribeCommand: Support the "always" optionSebastian Schuberth2019-05-312-9/+47
| | | | | | | | | | | 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>
* cli: Add the --tags option to describeSebastian Schuberth2019-05-312-0/+5
| | | | | Change-Id: I78924e61e2050eeaff991ee56715f36514100492 Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
* DescribeCommand: Consistenly omit the default valueSebastian Schuberth2019-05-311-1/+1
| | | | | | | | Omit the default value of "false" for "useTags" like already done for "longDesc". Change-Id: I25aaacae028fc8cf27f4040ba45fe79609318aa1 Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
* Remove excess blank line in FileUtilsTestMatthias Sohn2019-05-311-1/+0
| | | | Change-Id: I0d617feb7baacf9917b1da605fcb75f7d4ccd184 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* PacketLineIn: Add helper methods to check for END and DELIMDavid Pursehouse2019-05-302-6/+31
| | | | | | | | | 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>
* UploadPackTest: Rename variable to avoid hiding class memberDavid Pursehouse2019-05-301-4/+4
| | | | | Change-Id: I9e02642b2f56a735681e58b8c8d6e3545ef9093b Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* UploadPackTest: Add missing <> operator on instantiation of ArrayListDavid Pursehouse2019-05-301-1/+1
| | | | | Change-Id: I348cbcd75252d7857ada843dc496d445ee1d62fb Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* BitmapCalculator: javadoc fixesIvan Frade2019-05-271-1/+2
| | | | | | | | | | 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>
* RevWalkUtils: add progress callback to findBranchesReachableFromAndrey Loskutov2019-05-253-1/+43
| | | | | | | | | | 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>
* Merge branch 'stable-5.4'David Pursehouse2019-05-241-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | * 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>
| * Merge branch 'stable-5.3' into stable-5.4David Pursehouse2019-05-241-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | * 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>
| | * SystemReader: Respect passed-in parent when no system config is presentDave Borowitz2019-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Prepare 5.4.0-SNAPSHOT buildsMatthias Sohn2019-05-2272-103/+103
| | | | | | | | | | | | | | | Change-Id: I9df6fccee253d4087f9afab4cb46e0a40b8a5699 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | JGit v5.4.0.201905221418-m3v5.4.0.201905221418-m3Matthias Sohn2019-05-2272-103/+103
| | | | | | | | | | | | | | | Change-Id: I8a7e687acfcf8c341abd726ae60b5ee173422215 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | Merge branch 'master' into stable-5.4Matthias Sohn2019-05-22112-1242/+1675
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * | | Prepare 5.4.0-SNAPSHOT buildsMatthias Sohn2019-05-1572-103/+103
| | | | | | | | | | | | | | | | | | | | Change-Id: Ieb4b049972509631f06b5268a90f432a1b9ee207 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | | JGit v5.4.0.201905081430-m2v5.4.0.201905081430-m2Matthias Sohn2019-05-0872-103/+103
| | | | | | | | | | | | | | | | | | | | Change-Id: I535a98d8ef507d3c8cda7b0f042a2ae835da1279 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>