summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit
Commit message (Collapse)AuthorAgeFilesLines
* 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>
| * Prepare 4.2.1-SNAPSHOT buildsMatthias Sohn2016-01-222-17/+17
| | | | | | | | | | Change-Id: Ic9eac53b10ac97b2038b334d388ae3d21393f993 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * JGit v4.2.0.201601211800-rv4.2.0.201601211800-rMatthias Sohn2016-01-212-2/+2
| | | | | | | | | | Change-Id: I89f33b0da81ff499315baa5311f95f31724fa510 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Prepare 4.3.0-SNAPSHOT buildsMatthias Sohn2016-01-212-17/+17
|/ | | | | Change-Id: Idcf0479529693b023042becd96698f9afd344bd4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove declared IOException which is no longer thrownMatthias Sohn2016-01-201-2/+1
| | | | | | | Since 2ccea7f0 ChangeIdUtil.computeChangeId() doesn't throw IOException anymore. Change-Id: I0bf43f2346dadbbfe7e6cbcb38b5525456fbf686 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* PackWriter: Declare preparePack object sets as @NonNullShawn Pearce2016-01-121-1/+1
| | | | | | | | Require callers to pass in valid sets for both want and have collections. Offer PackWriter.NONE as a handy constant for an empty collection for the have part of preparePack instead of null. Change-Id: Ifda4450f5e488cbfefd728382b7d30797e229217
* Merge changes Idaed9310,I62bd7c0bMatthias Sohn2016-01-031-2/+2
|\ | | | | | | | | | | * changes: ObjectChecker: honor some git-core fsck.* options ObjectChecker: allow some objects to skip errors
| * ObjectChecker: allow some objects to skip errorsShawn Pearce2015-12-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some ancient objects may be broken, but in a relatively harmless way. Allow the ObjectChecker caller to whitelist specific objects that are going to fail checks, but that have been reviewed by a human and decided the objects are OK enough to permit continued use of. This avoids needing to rewrite history to scrub the broken objects out. Honor the git-core fsck.skipList configuration setting when receiving a push or fetching from a remote repository. Change-Id: I62bd7c0b0848981f73dd7c752860fd02794233a6
* | Implement Buck driven buildDavid Ostrovsky2015-12-311-0/+10
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Today there are plenty of modern build tool systems available in the wild (in no particular order): * http://bazel.io * https://pantsbuild.github.io * http://shakebuild.com * https://ninja-build.org * https://buckbuild.com The attributes, that all these build tools have in common, are: * reliable * correct * very fast * reproducible It must not always be the other build tool, this project is currently using. Or, quoting Gerrit Code Review maintainer here: "Friends, don't let friends use <the other build tool system>!" This change is non-complete implementation of JGit build in Buck, needed by Gerrit Code Review to replace its dependency with standlone JGit cell. This is very useful when a developer is working on both projects and is trying to integrate changes made in JGit in Gerrit. The supported workflow is: $ cd jgit $ emacs <hack> $ cd ../gerrit $ buck build --config repositories.jgit=../jgit gerrit With --config repositories.jgit=../jgit jgit cell is routed through JGit development tree. To build jgit, issue: $ buck build //:jgit [-] PROCESSING BUCK FILES...FINISHED 0,0s Yes, you can't measure no-op build time, given that Buck daemon is used. Change-Id: I301a71b19fba35a5093d8cc64d4ba970c2877a44 Signed-off-by: David Ostrovsky <david@ostrovsky.org>
* Add support for clean filtersChristian Halstrick2015-11-271-0/+13
| | | | | | | | | When filters are defined for certain paths in gitattributes make sure that clean filters are processed when adding new content to the object database. Change-Id: Iffd72914cec5b434ba4d0de232e285b7492db868 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add missing @since tags and missing javadocMatthias Sohn2015-11-255-2/+32
| | | | Change-Id: I8575797127fc96abea8af56f019ca39f5897486f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Restore TestRepository.getClock(), it is used by Gerrit/GitilesTerry Parker2015-10-221-0/+11
| | | | | Change-Id: I88880f18998e33377c0c684cbd8007b5d27d76e7 Signed-off-by: Terry Parker <tparker@google.com>
* Push control of time into MockSystemReaderTerry Parker2015-10-203-25/+55
| | | | | | | | | | | LocalDiskRepositoryTestCase and TestRepository have competing ideas about time. Push them into MockSystemReader so they can cooperate. Rename getClock() methods that return Dates to getDate(). Change-Id: Ibbd9fe7f85d0064b0a19e3b675b9718a9e67c479 Signed-off-by: Terry Parker <tparker@google.com>
* Delete non empty directories before checkout a pathAndrey Loskutov2015-10-092-0/+13
| | | | | | | | | | If the checkout path is currently a non-empty directory (and was a link or a regular file before), this directory will be removed before performing checkout, but only if the checkout path is specified. Bug: 474973 Change-Id: Ifc6c61592d9b54d26c66367163acdebea369145c Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Prepare 4.2.0-SNAPSHOT buildsMatthias Sohn2015-09-282-17/+17
| | | | | Change-Id: If559d3565b1f84c93a533e1ce18d5293605d1950 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Prepare 4.1.1-SNAPSHOT buildsMatthias Sohn2015-09-282-17/+17
| | | | | Change-Id: I035f3a8d0f0de86e8b8f00e668be5ce008402e82 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* JGit v4.1.0.201509280440-rv4.1.0.201509280440-rMatthias Sohn2015-09-282-2/+2
| | | | | Change-Id: I9a536870b9f5c1247c52d6c976a954115982fa1c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* [performance] Cache platform name in SystemReaderAndrey Loskutov2015-09-271-0/+18
| | | | | | | | | SystemReader.isMacOs() and SystemReader.isWindows() return values are unlikely to change during the JVM lifetime (except tests). Don't read system properties each time the methods are called, just use previously calculated value. Change-Id: I495521f67a8b544e7b7247d99bbd05a42ea16d20 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Restore lazy Bundle-ActivationPolicy removed in 3a4a5a4eMatthias Sohn2015-08-311-0/+1
| | | | | | | | This header was removed unintentionally from some bundles in 3a4a5a4e57f41c595ba950ea6f6680260669bf34. Restore it to ensure lazy activation of bundles. Change-Id: I1f841f978fb93278e3ec0533a01f1363510dd976 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Update uses-clauses in OSGi manifestsMatthias Sohn2015-08-311-2/+9
| | | | | | | | | | In Bug 476164 it was reported that EGit doesn't start when the platform comes with jsch 0.1.51 while this version of EGit/JGit brings jsch 0.1.53. This could be caused by outdated uses-clauses. Hence recompute them using PDE tooling. Bug: 476164 Change-Id: I185ba097884ead9cd034eba842bd3bf34181a99b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Move `RepositoryTestCase.indexState` to parent classChris Price2015-07-102-106/+100
| | | | | | | | | | | | | | | The test helper method `indexState` in `RepositoryTestCase` is very useful for writing tests, even in cases where we need to do things like create more than one repository for a test and thus we don't want to use the built-in `db` member variable that exists in `RepositoryTestCase`. Since the method is static, we can move it up to the parent class `LocalDiskRepositoryTestCase`, where it can be used by tests that aren't a great fit for inheriting directly from `RepositoryTestCase`. Bug: 436200 Change-Id: I2b6de75c001d2d77ddb607488af246548784a67f Signed-off-by: Chris Price <chris@puppetlabs.com>
* Change `indexState` to static methodChris Price2015-07-101-1/+1
| | | | | | | | | The `indexState` method is no longer referring to any member variables from the class, so it can be made static. Bug: 436200 Change-Id: I013316de5c373417ea758ca6e17da29209fead53 Signed-off-by: Chris Price <chris@puppetlabs.com>
* Use local variable in RepositoryTestCase.indexStateChris Price2015-07-071-1/+1
| | | | | | | | | | | | | | | | | There is a signature of the test helper method `indexState`, in `RepositoryTestCase`, that accepts a `Repository` object as an argument. However, there was one line of code where this variable was not being used, and the method was instead referring to a member variable `db`. I believe this was probably just an oversight in a previous refactor, and that the correct behavior is to use the variable from the argument list. This change also has the benefit of making it possible to convert this method to a static method, since it no longer relies on any state from the class. Bug: 436200 Change-Id: Iac95b046dc5bd0b3756642e241c3637f1fad3609 Signed-off-by: Chris Price <chris@puppetlabs.com>
* Prepare 4.1.0-SNAPSHOT buildsMatthias Sohn2015-06-032-17/+17
| | | | | Change-Id: I03d08b8e2d3400d4b5cdb4ab541b312870776843 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Replace deprecated release() methods by close()Matthias Sohn2015-05-211-27/+29
| | | | | | | | See the discussion [1] in the Gerrit mailing list. [1] https://groups.google.com/forum/#!topic/repo-discuss/RRQT_xCqz4o Change-Id: I2c67384309c5c2e8511a7d0d4e088b4e95f819ff Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* TestRepository: Add a cherryPick methodDave Borowitz2015-03-232-0/+63
| | | | | | | | | | CherryPickCommand only works on a non-bare repository, as it must modify the working tree and index in case of a merge conflict. In tests, being able to recover from a merge conflict is less important, as the caller should be able to control the full contents of files in advance of the cherry-pick. Change-Id: Ic332e44df1308b9336e884666b08c1f6db64513d
* TestRepository: Expose a Git instanceDave Borowitz2015-03-181-0/+12
| | | | Change-Id: I2fab7dd9a24205686db4724e77c0fd0a28f2075e
* TestRepository: Allow setting explicit Change-IdDave Borowitz2015-03-121-9/+22
| | | | | | | This includes both leaving existing Change-Ids alone (as, for example Gerrit's commit-msg hook does) and programmatically setting a value. Change-Id: Iaaffb0107ae27de24df1f0e95a8d628fb8ea5364
* TestRepository: Ignore existing Change-Id in messageDave Borowitz2015-03-121-0/+4
| | | | Change-Id: I343c3065fa369ef8aab2b033ac1e392b28d10daf
* TestRepository: Support committing to unborn symrefDave Borowitz2015-03-121-2/+1
| | | | Change-Id: I6bcee635adda7c929f6fa68ef20438fe77e49184
* TestRepository: Expose some getters for CommitBuilderDave Borowitz2015-03-121-0/+16
| | | | Change-Id: Ic6d179bd2de0081633c22fb82ca68ea619cb686f
* TestRepository: Add methods to amend commits or refsDave Borowitz2015-03-121-12/+87
| | | | Change-Id: I47082416f6e281262b160ba15272258f9109abd1
* TestRepository: Add a reset method to move HEAD aroundDave Borowitz2015-03-121-0/+55
| | | | | | | | | This flushed out a number of bugs in the way DfsRefUpdate, or at least the InMemoryRepository implementation, processes symrefs. These have been fixed, to an extent, in InMemoryRepository, but other implementations may still suffer from these bugs. Change-Id: Ifd12115a0060b9ff45a88d305b72f91ca0472f9a
* TestRepository: Optionally insert Change-Id in commit messageDave Borowitz2015-03-121-1/+25
| | | | | | Copied the implementation from CommitCommand. Change-Id: Iade0e2d70bde70cfa830fe23bcc41959b011a14a
* TestRepository: Allow custom author/committer per-commitDave Borowitz2015-03-111-9/+32
| | | | Change-Id: I078fe00470ebe60f93f4a718c163dd1412fdc776
* TestRepository: Use try-with-resources where appropriateDave Borowitz2015-03-111-74/+58
| | | | Change-Id: I06f9534ab84278df37a140700fc2bed5ab667299
* Set minimum required Java version to Java 7Matthias Sohn2015-02-093-5/+5
| | | | | | Bug: 458475 Change-Id: Iea8f2236d4e6a94a8d14bb8cc685006ea3fd1bb7 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Prepare 4.0.0-SNAPSHOT buildsMatthias Sohn2015-01-272-16/+16
| | | | | Change-Id: I414ba8ccc82866d3107ba7083a567ea70c879bdf Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Prepare 3.7.0-SNAPSHOT buildsMatthias Sohn2014-12-242-16/+16
| | | | | Change-Id: Ib3e7b5f46ee1e27b9cf25b3b2d01d681a5c4904c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Prepare 3.6.1-SNAPSHOT buildsMatthias Sohn2014-12-232-16/+16
| | | | | Change-Id: Ie620c90ffafbffc6755b4e1ed55a61a15b118a2a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* JGit v3.6.0.201412230720-rv3.6.0.201412230720-rMatthias Sohn2014-12-232-2/+2
| | | | | Change-Id: Ic28e2bbbdb1099e948c64a005c39f6b8d8ac69a8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix junit tests under windows when the platform is explicitly changedChristian Halstrick2014-12-221-0/+2
| | | | | | | | | | | | SystemReader used a chached ObjectChecker which was instantiated only once. But in case of unit tests where we can change the platform dynamically (e.g. MockSystemReader.setWindows()) this is wrong and caused DirCacheCheckoutMaliciousPathTest. testMaliciousAbsoluteCurDrivePathWindowsOnUnix() to fail. This change allows user of SystemReader to force the creation of a new ObjectChecker. MockSystemReader.setWindows() and .setUnix() make use of this feature. Change-Id: I87458d1dc63c1f5c18979f972b1c1f0d670a9ed8
* Allow explicit configuration of git directory in InitCommandChristian Halstrick2014-12-151-0/+1
| | | | | | | | | | | | | | Native git's "init" command allows to specify the location of the .git folder with the option "--separate-git-dir". This allows for example to setup repositories with a non-standard layout. E.g. .git folder under /repos/a.git and the worktree under /home/git/a. Both directories contain pointers to the other side: /repos/a.git/config contains core.worktree=/home/git/a . And /home/git/a/.git is a file containing "gitdir: /repos/a.git". This commit adds that option to InitCommand. This feature is needed to support the new submodule layout where the .git folder of the submodules is under .git/modules/<submodule>. Change-Id: I0208f643808bf8f28e2c979d6e33662607775f1f
* Fix LocalDiskRepositoryTestCase to create correct type of reposChristian Halstrick2014-12-121-1/+1
| | | | | | | | | In one place LocalDiskRepositoryTestCase was ignoring the specification whether to create a bare or non-bare repository. Fix this and fix also one test which fails now because bare repos don't write reflogs by default. Change-Id: I4bcf8cf97c5b46e2f3919809eaa121a8d0e47010 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Prepare post 3.6.0-m1 buildsMatthias Sohn2014-11-122-2/+2
| | | | | Change-Id: Ie9927de64fa6b7d517f96b8cd12e57541f284ff2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>