aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into stable-5.4Matthias Sohn2019-06-1119-220/+1308
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * Handle missing "ours" stage in WorkingTreeIterator.hasCrLfInIndex()Thomas Wolf2019-06-111-0/+48
| | | | | | | | | | | | | | | | | | | | | | 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>
| * ErrorProne: Increase severity of FutureReturnValueIgnored to ERRORDavid Pursehouse2019-06-111-1/+2
| | | | | | | | | | | | | | | | 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>
| * Make pull --rebase on an unborn branch do a checkoutThomas Wolf2019-06-101-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Handle escaped CR-LF in git config filesThomas Wolf2019-06-081-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-071-0/+17
| | | | | | | | | | | | | | | | | | | | 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-071-0/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-071-5/+5
| | | | | | | | | | | | | | | | | | | | 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>
| * NetscapeCookieFileTest: Split HttpCookiesMatcher to own classDavid Pursehouse2019-06-073-104/+152
| | | | | | | | | | | | | | | | | | | | | | 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>
| * Support reading and writing cookies.Konrad Windszus2019-06-063-0/+708
| | | | | | | | | | | | | | | | | | 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>
| * Replace most usages of PacketLineIn.END with PacketLineIn.end()David Pursehouse2019-06-033-81/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-032-67/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-025-50/+49
| | | | | | | | | | | | | | | | 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-021-1/+1
| | | | | | | | | | 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>
| * DescribeCommand: Support the "always" optionSebastian Schuberth2019-05-311-7/+24
| | | | | | | | | | | | | | | | | | | | | | 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>
| * 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-301-6/+7
| | | | | | | | | | | | | | | | | | 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 and its test: add missing license headerMatthias Sohn2019-05-231-0/+42
| | | | | | | | Change-Id: I3c4a8b1e9159b0553aa95213bb82628370b6c036 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Merge branch 'stable-5.3' into stable-5.4Matthias Sohn2019-06-063-3/+447
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * Merge branch 'stable-5.2' into stable-5.3Matthias Sohn2019-06-053-3/+447
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
| | * Merge branch 'stable-5.1' into stable-5.2Matthias Sohn2019-06-053-2/+446
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| | | * Test detecting modified packfilesChristian Halstrick2019-06-051-11/+222
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | | * Extend FileSnapshot for packfiles to also use checksum to detect changesMatthias Sohn2019-06-041-0/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | | * Add FileSnapshot test testing recognition of file size changesMatthias Sohn2019-05-291-0/+17
| | | | | | | | | | | | | | | | Change-Id: Ibcd76a5e6e4183ada0be1d4436ce957243f2094d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * Capture reason for result of FileSnapshot#isModifiedMatthias Sohn2019-05-291-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | | * Skip FileSnapshotTest#testSimulatePackfileReplacement on WindowsMatthias Sohn2019-05-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | NTFS does not support FileKey hence ignore this test on Windows. Change-Id: I7b53a591daa5e03eb5e401b5b26d612ab68ce10d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * Fix FileSnapshotTest.testNewFileNoWait() to match its javadocMatthias Sohn2019-05-271-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | | * Include filekey file attribute when comparing FileSnapshotsMatthias Sohn2019-05-221-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | | * Measure file timestamp resolution used in FileSnapshotMatthias Sohn2019-05-221-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FileSnapshot.notRacyClean() assumed a worst case filesystem timestamp resolution of 2.5 sec (FAT has a resolution of 2 sec). Instead measure timestamp resolution to avoid unnecessary IO caused by false positives in detecting the racy git problem caused by finite filesystem timestamp resolution [1]. Cache the measured resolution per FileStore since timestamp resolution depends on the respective filesystem type. If timestamp resolution cannot be measured or fails due to an exception fallback to the worst case FAT timestamp resolution and avoid caching this value. Add a 10% safety margin in FileSnapshot.notRacyClean(), though running FsTest.testFsTimestampResolution() 1000 times which is not using a safety margin didn't fail on Mac using APFS and Java 8, 11, 12. Measured Java file timestamp resolution: [2] [1] https://github.com/git/git/blob/master/Documentation/technical/racy-git.txt [2] https://docs.google.com/spreadsheets/d/1imy0y6WmRqBf0kjCxzxj2X7M50eIVfa7oaUIzEOHmjo Bug: 546891 Change-Id: I493f3b57b6b306285ffa7d392339d253e5966ab8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Merge changes from topic 'reachability-2'Jonathan Tan2019-05-204-0/+433
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * changes: UploadPack: Use reachability checker to validate non-advertised wants BitmappedReachabilityChecker: Reachability check using bitmaps BitmapCalculator: Get the reachability bitmap of a commit ReachabilityChecker: Default implementation with a RevWalk
| * | | | BitmappedReachabilityChecker: Reachability check using bitmapsIvan Frade2019-05-151-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "basic" reachability check walks the graph starting from the tips marking things as "uninteresting". If the target commit is marked as "uninteresting" it was reached; it is reachable from those tips. This requires a lot of walking and can be solved directly with bitmaps. Most of the time the bitmaps are already calculated or a short walk away. This should improve the performance of reachability checks, for example in Gitiles. Change-Id: I83d33271f58d95d2dc9ed151967b3eda513c99f7 Signed-off-by: Ivan Frade <ifrade@google.com>
| * | | | BitmapCalculator: Get the reachability bitmap of a commitIvan Frade2019-05-151-0/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To make reachability checks with bitmaps, we need to get the reachability bitmap of a commit, which is not always precalculated. There is already a class returning such bitmap (BitmapWalker) but it does too much unnecessary work: it calculates ALL reachable objects from a commit (i.e. including trees and blobs), when for reachability the commits are just enough. Introduce BitmapCalculator to get the bitmap of a commit: either because it is precalculated or generating it with a walk only over commits. Change-Id: Ibb6c78affe9eeaf1fa362a06daf4fd2d91c1caea Signed-off-by: Ivan Frade <ifrade@google.com>
| * | | | ReachabilityChecker: Default implementation with a RevWalkIvan Frade2019-05-152-0/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is common to check if a certain commit is reachable from some starting points. For example gitiles does it to check if a commit is visible to a user based on its permissions. Offer this functionality in JGit. Split the interface as the next commit will introduce an implementation using bitmap indices. Change-Id: I0933b305c8d734f7a64502910ff4d9ef4fc92ae1 Signed-off-by: Ivan Frade <ifrade@google.com>
* | | | | Convert to lambda or member referenceCarsten Hammer2019-05-1616-384/+211
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert anonymous inner classes to lambda expressions or member references Bug: 545856 CQ: 19537 Change-Id: I621431c178e8b99316314602f7c66c9a36f9ae98 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Merge branch 'stable-5.3'Matthias Sohn2019-04-293-19/+96
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.3: Prepare 5.3.2-SNAPSHOT builds JGit v5.3.1.201904271842-r Prepare 5.2.3-SNAPSHOT builds JGit v5.2.2.201904231744-r Revert 4678f4b and provide another solution for bug 467631 Apache MINA sshd: make sendKexInit() work also for re-keying Prepare 5.1.8-SNAPSHOT builds JGit v5.1.7.201904200442-r ObjectUploadListener: Add callback interface Prepare 4.11.9-SNAPSHOT builds JGit v4.11.8.201904181247-r Prepare 4.9.11-SNAPSHOT builds JGit v4.9.10.201904181027-r Prepare 4.7.10-SNAPSHOT builds JGit v4.7.9.201904161809-r Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: I8a8671f7767444a77b809bd66a27d776c8332736 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | | Merge branch 'stable-5.2' into stable-5.3Matthias Sohn2019-04-283-19/+96
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.2: Prepare 5.2.3-SNAPSHOT builds JGit v5.2.2.201904231744-r Revert 4678f4b and provide another solution for bug 467631 Apache MINA sshd: make sendKexInit() work also for re-keying Prepare 5.1.8-SNAPSHOT builds JGit v5.1.7.201904200442-r ObjectUploadListener: Add callback interface Prepare 4.11.9-SNAPSHOT builds JGit v4.11.8.201904181247-r Prepare 4.9.11-SNAPSHOT builds JGit v4.9.10.201904181027-r Prepare 4.7.10-SNAPSHOT builds JGit v4.7.9.201904161809-r Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: Ie7e572ac7e346f21fe0c387d7448be168a9c127a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * | Revert 4678f4b and provide another solution for bug 467631Thomas Wolf2019-04-203-19/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Making gitlinks and folders match in a tree walk was the wrong approach to fix bug 467631. The problem is that in such a conflict the tree walk may then not descend into the folder. Revert the changes to Paths.java and PathsTest.java from commit 4678f4b. Instead test for the problem case from bug 467631 explicitly in IndexDiff. Add Daniel's test case from bug 545162, and add yet another test case for DiffEntry.scan() that covers the problem originally reported in bug 545162. Bug: 545162 Change-Id: Ie2214c5d5ee32ac6596b621f0f1c7b86d38fa9b7 Also-by: Daniel Veihelmann <daniel.veihelmann@gmail.com> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | tree:<depth>: do not revisit tree during packingMatthew DeVore2019-04-161-0/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a tree is visited during pack and filtered out with tree:<depth>, we may need to include it if it is visited again at a lower depth. Until now we revisit it no matter what the depth is. Now, avoid visiting it if it has been visited at a lower or equal depth. Change-Id: I68cc1d08f1999a8336684a05fe16e7ae51898866 Signed-off-by: Matthew DeVore <matvore@gmail.com>
* | | | tree:<depth> should not traverse overly-deep treesMatthew DeVore2019-04-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we are traversing a tree which is too deep, then there is no need to traverse the children. Skipping children is much faster than traversing the possibly thousands of objects which are directly or indirectly referenced by the tree. Change-Id: I6d68cc1d35da48e3288b9cc80356a281ab36863d Signed-off-by: Matthew DeVore <matvore@gmail.com>
* | | | Preliminary support for tree:<depth> filterMatthew DeVore2019-04-163-0/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is used when fetching, and in particular to populate a partial clone or a virtual file system cache as the user navigates. With this, a client can pre-fetch a few directories deeper than only the current directory. depth:0 will omit all trees, and is useful if you only want to fetch the commits of a repository, or fetch just a single tree or blob object. depth:1 will fetch only the root tree of all commits fetched. depth:2 will fetch the root tree and all blobs and tree objects directly referenced from it. depth:3 gets one more level, and so on. depth:# will not filter a blob or tree that is explicitly marked wanted. Bitmaps are disabled when this filter is used. This implementation is quite slow because it iterates over all omitted objects rather than skipping them. This will be addressed in follow-up commits. Change-Id: Ic312fee22d60e32cfcad59da56980e90ae2cae6a Signed-off-by: Matthew DeVore <matvore@gmail.com>
* | | | Use Arrays.asList instead of copying array in a for loopCarsten Hammer2019-04-141-2/+2
| | | | | | | | | | | | | | | | | | | | Change-Id: Ie44950f7d2f2f94a0412efb6c274f6e1e31efcd6 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Use isEmpty() instead of size()==0 where possibleCarsten Hammer2019-04-132-6/+5
| | | | | | | | | | | | | | | | | | | | Change-Id: I97f1367a2ea9f1f6146e264c27c3981b842f2a26 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Use jdk 5 for loopCarsten Hammer2019-04-136-34/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace simple uses of Iterator with a corresponding for-loop. Also add missing braces on loops as necessary. Change-Id: I708d82acdf194787e3353699c07244c5ac3de189 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Join catch sections using multicatchCarsten Hammer2019-04-131-3/+1
| | | | | | | | | | | | | | | | | | | | Change-Id: I1a9112e6a4f938638c599b489cb0858eca27ab91 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Use StringBuilder instead of StringBuffer where possible.Carsten Hammer2019-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Ifc67c84a3e786cd766f45726733a6d294d2652a1 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | ConfigTest: Add test for parsing invalid group headerDavid Pursehouse2019-04-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test that an exception is raised for an invalid group header: [group "foo" ] foo = bar i.e. where there is a space between the group subsection name and the closing ']'. Change-Id: I8933ae100b77634b0afb66bb8aa43d24c955799e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | Introduce RefDatabase#getTipsWithSha1 to list refs pointing to objectPatrick Hiesel2019-04-082-1/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add resolveTipSha1, an inverse of exactRef(String ...), to RefDatabase and provide a default implementation that runs in O(n) time where n is the number of refs. For RefTable, provide an implementation that runs in O(log(n)) time. [ifrade@google.com: with tests in InMemoryRepositoryTest to exercise the reftable code path, too] Change-Id: I2811ccd0339cdc1c74b42cce2ea003f07a2ce9e1 Signed-off-by: Patrick Hiesel <hiesel@google.com> Signed-off-by: Ivan Frade <ifrade@google.com>