summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit
Commit message (Collapse)AuthorAgeFilesLines
* Add dfs fsck implementationZhen Chen2017-07-261-0/+23
| | | | | | | | | | | | JGit already had some fsck-like classes like ObjectChecker which can check for an individual object. The read-only FsckPackParser which will parse all objects within a pack file and check it with ObjectChecker. It will also check the pack index file against the object information from the pack parser. Change-Id: Ifd8e0d28eb68ff0b8edd2b51b2fa3a50a544c855 Signed-off-by: Zhen Chen <czhen@google.com>
* Move BatchRefUpdate tests to a new fileDave Borowitz2017-07-251-0/+78
| | | | | | | | | | Run with @Parameterized, so we don't have to duplicate test setup for each atomic/non-atomic test. We still have to have two different sets of asserts for the cases where the behavior is different. In fact, this is a readability win: it emphasizes that performing the exact same setup except for the atomic setting will have different behavior. Change-Id: I78a8214075e204732a423341f14c09de273a7854
* Add missing newlines at ends of Java filesDavid Pursehouse2017-07-252-2/+2
| | | | | Change-Id: Iead36f53d57ead0eb3edd3f9efb63b6630c9c20c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Merge branch 'stable-4.8'David Pursehouse2017-06-101-0/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.8: SubmoduleUpdateCommand#setCallback should return 'this' CloneCommand#setCallback should return 'this' Prepare 4.7.2-SNAPSHOT builds JGit v4.7.1.201706071930-r ArchiveCommand: Create prefix entry with commit time Run auto GC in the background Update Orbit to the Oxygen version R20170516192513 Change-Id: Ibf90b4899d097474e7836e6baab8829e66fca524 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * Merge branch 'stable-4.7' into stable-4.8Matthias Sohn2017-06-071-0/+7
| |\ | | | | | | | | | | | | | | | | | | * stable-4.7: Run auto GC in the background Change-Id: I5e25765f65d833f13cbe99696ef33055d7f5c4cf Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * Run auto GC in the backgroundDavid Turner2017-06-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running an automatic GC on a FileRepository, when the caller passes a NullProgressMonitor, run the GC in a background thread. Use a thread pool of size 1 to limit the number of background threads spawned for background gc in the same application. In the next minor release we can make the thread pool configurable. In some cases, the auto GC limit is lower than the true number of unreachable loose objects, so auto GC will run after every (e.g) fetch operation. This leads to the appearance of poor fetch performance. Since these GCs will never make progress (until either the objects become referenced, or the two week timeout expires), blocking on them simply reduces throughput. In the event that an auto GC would make progress, it's still OK if it runs in the background. The progress will still happen. This matches the behavior of regular git. Git (and now jgit) uses the lock file for gc.log to prevent simultaneous runs of background gc. Further, it writes errors to gc.log, and won't run background gc if that file is present and recent. If gc.log is too old (according to the config gc.logexpiry), it will be ignored. Change-Id: I3870cadb4a0a6763feff252e6eaef99f4aa8d0df Signed-off-by: David Turner <dturner@twosigma.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * Prepare 4.7.1-SNAPSHOTMatthias Sohn2017-04-062-19/+19
| | | | | | | | | | | | | | | Change-Id: I16a45035258276217446bccc0ad1b0991383aa0c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * JGit v4.7.0.201704051617-rv4.7.0.201704051617-rMatthias Sohn2017-04-052-2/+2
| | | | | | | | | | | | | | | Change-Id: Ic2bd6aca0b7a7e0597ffc1f7cf647b49878f9950 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | Prepare 4.8.0-SNAPSHOT buildsMatthias Sohn2017-05-172-2/+2
| | | | | | | | | | | | | | | Change-Id: I27fc4e4969fafde0fcba26aeebe30d732770b68f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | JGit v4.8.0.201705170830-rc1v4.8.0.201705170830-rc1Matthias Sohn2017-05-172-2/+2
| | | | | | | | | | | | | | | Change-Id: I60c0a40f2e38748641b25a25bcf10346e2950886 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Prepare 4.9.0-SNAPSHOT buildsMatthias Sohn2017-05-302-19/+19
|/ / | | | | | | | | Change-Id: I52a4153d573799e861ab104939f51fac1aceb9ee Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Bazel: Restrict src globs to Java source filesDavid Pursehouse2017-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generating the src list with an unrestricted wildcard causes all files in the source tree to be included. This results in junk files such as .orig (generated during merge conflict resolution) to be included, which causes in a build error: in srcs attribute of java_library rule //org.eclipse.jgit:jgit: file '//org.eclipse.jgit:src/org/eclipse/jgit/gitrepo/RepoCommand.java.orig' is misplaced here (expected .java, .srcjar or .properties). Modify the globs to only include Java source files. Change-Id: Iaef3db33ac71d71047cd28acb0378e15cb09ece9 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Prepare 4.8.0-SNAPSHOT buildsMatthias Sohn2017-04-052-19/+19
|/ | | | | Change-Id: Ifea6750e79d417a8a2a891b3b5f96d68c7200011 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove Buck buildDavid Pursehouse2017-03-221-10/+0
| | | | | | Buck will be replaced with Bazel Change-Id: I3cf07d7aaaa2a58bac34e16c50af5416693254ac Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* bazel: Mark junit targets testonlyJonathan Nieder2017-03-191-0/+1
| | | | | | | | | | | Only testonly targets (such as tests) need to use junit. In particular this involves making the toplevel :all rule testonly. It's not clear to me what that rule is for --- "bazel build //..." already works to build all targets. In any case it appears to be for testing, so marking it as testonly shouldn't be harmful. Change-Id: I28ff508ab8ce2ec0a0111109110aa9680d30600e
* bazel: Add explicit targets for library dependenciesJonathan Nieder2017-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | This provides a place to declare visibility restrictions and transitive dependencies for each library. Other targets should only declare dependencies on what they directly use, making dependencies easier to maintain. Trim the dependencies of org.eclipse.jgit:jgit to follow that rule. It declares dependencies on Apache httpcomponents and the servlet API but doesn't use them. Tested: * 'bazel build //...' succeeds * applying the change https://gerrit-review.googlesource.com/90843 to a copy of Gerrit, following the instructions there, and running 'bazel test //...' in that copy of Gerrit still succeeds Change-Id: I3ab958ce8b3227019cdbe4cc81e0f042e1541034
* Enable and fix warnings about redundant specification of type argumentsDavid Pursehouse2017-02-204-7/+7
| | | | | | | | | | Since the introduction of generic type parameter inference in Java 7, it's not necessary to explicitly specify the type of generic parameters. Enable the warning in Eclipse, and fix all occurrences. Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Add API filter for usage of FileRepository in test classesDavid Pursehouse2017-02-201-0/+35
| | | | | | | | | | | FileRepository is in the package org.eclipse.jgit.internal, and is thus non-API. This causes warnings in Eclipse when FileRepository is used. Add a filter to prevent the warnings. Change-Id: I9a8ae106c085bb0e826031fa183b4c4bdabcc5fc Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Enable and fix 'Should be tagged with @Override' warningDavid Pursehouse2017-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Set missingOverrideAnnotation=warning in Eclipse compiler preferences which enables the warning: The method <method> of type <type> should be tagged with @Override since it actually overrides a superclass method Justification for this warning is described in: http://stackoverflow.com/a/94411/381622 Enabling this causes in excess of 1000 warnings across the entire code-base. They are very easy to fix automatically with Eclipse's "Quick Fix" tool. Fix all of them except 2 which cause compilation failure when the project is built with mvn; add TODO comments on those for further investigation. Change-Id: I5772061041fd361fe93137fd8b0ad356e748a29c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LocalDiskRepositoryTestCase: Add clarifying comment in call to createRepositoryDavid Pursehouse2017-02-101-1/+1
| | | | | | | | | | Clarify that 'true' means 'auto close'. This makes it consistent with other calls that have a boolean argument for 'bare'. It also makes it a bit easier to see what's going on while stepping in the debugger, because it's not necessary to scroll around to find the method declaration. Change-Id: Idacd749407dcfd258af3efaaf44d129069925dd3 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* RepositoryCacheTest: avoid to close already closed repositoryMatthias Sohn2017-01-281-2/+22
| | | | | | | The tearDown() of the superclass closed the repository once more which led to a negative use count warning logged by Repository.close(). Change-Id: I331f85a540c68264a53456276c32f72b79113d61 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* LocalDiskRepositoryTestCase: Only add to toClose through access methodDavid Pursehouse2017-01-281-1/+1
| | | | | | | | | Only using the access method means we only have one place where the toClose set is modified, making it easier to debug either by adding log statements or by setting a breakpoint. Change-Id: I4f9f1774d5f2e10bcab381edfd84bb6ee0499a11 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LocalDiskRepositoryTestCase: Prevent duplicates in list of repos to closeDavid Pursehouse2017-01-271-1/+3
| | | | | | | | | | Change the "toClose" list to a set, which will not allow duplicate entries. This reduces the number of false positive logs about corrupt use count due to the same repository being closed more than once during teardown. Change-Id: I5ab0ff8b56e7f2b2c7aab5274d957708d26f42c5 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Format Bazel files with buildifierDavid Pursehouse2017-01-221-9/+10
| | | | | Change-Id: I934114315d2c7cab917f1011b8e55c52367d429f Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Implement initial framework of Bazel buildDavid Ostrovsky2017-01-181-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The initial implementation only builds the packages consumed by Gerrit Code Review. Test build and execution is not implemented. We prefer to consume maven_jar custom rule from bazlets repository, for the same reasons as in the Gerrit project: * Caching artifacts across different clones and projects * Exposing source classifiers and neverlink artifact TEST PLAN: $ bazel build :all $ unzip -t bazel-genfiles/all.zip Archive: bazel-genfiles/all.zip testing: libjgit-archive.jar OK testing: libjgit-servlet.jar OK testing: libjgit.jar OK testing: libjunit.jar OK No errors detected in compressed data of bazel-genfiles/all.zip. Change-Id: Ia837ce95d9829fe2515f37b7a04a71a4598672a0 Signed-off-by: David Ostrovsky <david@ostrovsky.org> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Prepare 4.7.0-SNAPSHOT buildsMatthias Sohn2016-12-272-19/+19
| | | | | Change-Id: I20754d13007e6591d36aae5766f3a9a82b24e120 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Prepare 4.6.1-SNAPSHOT buildsMatthias Sohn2016-12-242-19/+19
| | | | | Change-Id: I6b05a6f6c3f92365c272e1bdaf76093ca01f2d58 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* JGit v4.6.0.201612231935-rv4.6.0.201612231935-rMatthias Sohn2016-12-242-2/+2
| | | | | Change-Id: Iaa88fe1b195dfe6be99a7b4cb064684e75563715 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Define MonotonicClock interface for advanced timestampsShawn Pearce2016-11-214-6/+118
| | | | | | | | | | | | | MonotonicClock can be implemented to provide more certainity about time than the standard System.currentTimeMillis() can provide. This can be used by classes such as PersonIdent and Ketch to rely on more certainity about time moving in a strictly ascending order. Gerrit Code Review can also leverage this interface through its embedding of JGit and use MonotonicClock and ProposedTimestamp to provide stronger assurance that NoteDb time is moving forward. Change-Id: I1a3cbd49a39b150a0d49b36d572da113ca83a786
* Deprecate SafeBufferedOutputStreamShawn Pearce2016-11-141-3/+3
| | | | | | | | | | | | | | | | | | | | | Java 8 fixed the silent flush during close issue by FilterOutputStream (base class of BufferedOutputStream) using try-with-resources to close the stream, getting a behavior matching what JGit's SafeBufferedOutputStream was doing: try { flush(); } finally { out.close(); } With Java 8 as the minimum required version to run JGit it is no longer necessary to override close() or have this class. Deprecate the class, and use the JRE's version of close. Change-Id: Ic0584c140010278dbe4062df2e71be5df9a797b3
* Organize importsDavid Pursehouse2016-11-141-2/+11
| | | | | Change-Id: I7c545d06b1bced678c020fab9af1382bc4416b6e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Change JGit minimum execution environment to JavaSE-1.8Matthias Sohn2016-09-203-5/+5
| | | | | Bug: 500059 Change-Id: I47f3f6749a67da52029f84e002d9b155ed56d2b7 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Prepare 4.6.0-SNAPSHOT buildsMatthias Sohn2016-09-192-17/+17
| | | | | Change-Id: Id2eafc331ee32c332c2a9b867b05c260beb0d10f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add a RepeatRule to help repeating flaky testsMatthias Sohn2016-08-253-1/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A JUnit TestRule which enables to run the same JUnit test repeatedly. This may help to identify the root cause why a flaky tests which succeed most often does fail sometimes. Add the RepeatRule to the test class containing the test to be repeated: public class MyTest { @Rule public RepeatRule repeatRule = new RepeatRule(); ... } and annotate the test to be repeated with the @Repeat(n=<repetitions>) annotation: @Test @Repeat(n = 100) public void test() { ... } then this test will be repeated 100 times. If any test execution fails test repetition will be stopped. Change-Id: I7c49ccebe1cb00bcde6b002b522d95c13fd3a35e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Ignore 'The value of exception parameter is not used' warningDavid Pursehouse2016-07-261-0/+1
| | | | | Change-Id: I50407e4a33e35b718ca40503fdd436f1f9f70fba Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Prepare 4.5.0-SNAPSHOT buildsMatthias Sohn2016-06-012-17/+17
| | | | | Change-Id: I572fe9fea0e5ca0bec4648c916ae95a5b1ccf125 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove the deprecated TestRepository.getClock() methodTerry Parker2016-05-311-11/+0
| | | | | | | | Gitles was the holdout and TestRepository.getClock() was removed via: https://gerrit.googlesource.com/gitiles/+/f10481d8384d1695e6981b805c4e5e462e4b71ea Change-Id: I90c0fc17be4891545b097a49763b0f0c202cc004 Signed-off-by: Terry Parker <tparker@google.com>
* Replace use of deprecated method Repository.getRef()Matthias Sohn2016-05-312-4/+4
| | | | Change-Id: Iecf2b8deafc4991cc3333702fb9fa0638be7b914 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix type parameter in javadoc in TestRepository.delete(String ref)Matthias Sohn2016-05-051-1/+1
| | | | | | Type parameter T extends AnyObjectId in signature of update(String, T) Change-Id: I9c13ddc572b8e94d5c7854f4de1f8206cb5e99ca Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* TestRepository: Add delete() methodJonathan Nieder2016-05-041-0/+34
| | | | Change-Id: Ib4841397ceab44bd38cf2f154314ac36ded73ae0
* Prepare 4.4.0-SNAPSHOT buildsMatthias Sohn2016-04-082-17/+17
| | | | | Change-Id: If3162f4cc4ae6319b9f1e3293549485b039cfe7f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Prepare 4.3.1-SNAPSHOT versionsMatthias Sohn2016-04-082-17/+17
| | | | | Change-Id: I52c98ba8fb3a303269a1f9380af114b6dd8c5009 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* JGit v4.3.0.201604071810-rv4.3.0.201604071810-rMatthias Sohn2016-04-082-2/+2
| | | | | Change-Id: I902cdf1ff92ce8c6e9d80c4965d8d5bd8b9ac6c1 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* JGit v4.3.0.201604071045-rMatthias Sohn2016-04-072-2/+2
| | | | | Change-Id: Iafab78d6be34d31a13f979b7be67611135c0f8bd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* In TestRepository, use a consistent clockTerry Parker2016-03-251-13/+12
| | | | | | | | | | | | | The default author and committer objects in TestRepository were initialized statically and did not use the MockSystemReader passed into the TestRepository ctor. Make these fields non-static and initialize them with a consistent clock. Also make the author and commiter name and email strings public for tests that want to verify against them. Change-Id: I88b444b96e22743001b32824d8e4e03c2239aa86 Signed-off-by: Terry Parker <tparker@google.com>
* Fix apply patch which did not work with non-ascii charactersXinTong Wang2016-03-031-3/+3
| | | | | | Bug: 483943 Change-Id: If28f64053d20ab1bee54245f223e952dc2fe392c Signed-off-by: XinTong Wang <xintong@ca.ibm.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'stable-4.2'Matthias Sohn2016-02-151-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.2: Don't use deprecated LockFile constructor Fix warnings about unchecked conversion of MergeResult MockServletConfig: Fix warning about unchecked conversion of Enumeration HugeFileTest: Make Git a class member and open in try-with-resource Suppress "unchecked cast" warnings related to UploadPackFactory.DISABLED DiffAlgorithms: Fix warnings about variable hiding DirCacheBasicTest: Open ObjectInserter.Formatter in try-with-resource DirCacheBuilderIteratorTest: Open TreeWalk in try-with-resource DirCacheCGitCompatabilityTest: Open TreeWalk in try-with-resource DirCacheCheckoutMaliciousPathTest: Open Git and RevWalk in t-w-r DirCacheIteratorTest: Open TreeWalk instances in try-with-resource ForPathTest: Open TreeWalk in try-with-resource GitConstructionTest: Open Git instance in try-with-resource IndexDiffTest: Open Git instances in try-with-resources ManifestParserTest: Don't use deprecated StringBufferInputStream InMemoryRepository: Remove unused RevWalk from batch method signature IndexModificationTimesTest: Open Git instances in try-with-resource InterIndexDiffFilterTest: Open TreeWalk in try-with-resource LockFileTest: Open Git instance in try-with-resource JGit v4.1.2.201602141800-r MergeCommandTest: Use JUnit's assume to check preconditions MergeCommandTest: Open Git instances in try-with-resource Change-Id: Ie5dba6b9132a29e86958a04fa2b76465bcd2c6b5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Don't use deprecated LockFile constructorDavid Pursehouse2016-02-151-1/+1
| | | | | | | | | | Change-Id: Ibc3e2f3372e1a65732dd6d3c71cec53fb1aa15e2 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* | Merge branch 'stable-4.2'Matthias Sohn2016-02-101-4/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.2: RepoProject: Fix warnings about variable hiding RepoTest: Open Git in try-with-resources RepositoryResolveTest: Open Git in try-with-resource RepositoryTestCase: Open autocloseable types in try-with-resource ResetCommandTest: Use Git member in testHardResetAfterSquashMerge ResolveMergerTest: Open Git in try-with-resource RevCommitListTest: Open Git and RevWalk in try-with-resource RevCommitParseTest: Open ObjectInserter.Formatter in try-with-resource RevObjectTest: Open RevWalk in try-with-resource RevTagParseTest: Open ObjectInserter.Formatter in try-with-resource RevertCommandTest: Open Git in try-with-resource SquashMessageFormatterTest: Open git in try-with-resource StatusCommandTest: Open Git in try-with-resource SubmoduleAddTest: Open Git in try-with-resource SymlinksTest: Open git and TreeWalk in try-with-resource T0003_BasicTest: Open autocloseable types in try-with-resource TextHashFunctions: Fix warnings about variable hiding TreeFilterTest: Open TreeWalk in try-with-resource TreeWalkJava7Test: Open TreeWalk in try-with-resource Fix diff for added and removed submodule Change-Id: If3ecc63f6dfac55474d3c1dd2f4105371f3d24fb Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * RepositoryTestCase: Open autocloseable types in try-with-resourceDavid Pursehouse2016-02-051-4/+5
| | | | | | | | | | | | | | | | ObjectInserter.Formatter and Git are autocloseable and can be opened in try-with-resource to prevent a resource leak warning. Change-Id: I48c4001aaa7d9c1e36369e9799bfbb7c3bb46d8b Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>