aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
* Add symlink support to JGitRobin Rosenberg2014-02-101-1/+4
| | | | | | | | | | | | | | | | | | | | The change includes comparing symbolic links between disk and index, adding symbolic links to the index, creating/modifying links on checkout. The behavior is controlled by the core.symlinks setting, just as C Git does. When a new repository is created core.symlinks will be set depending on the capabilities of the operating system and Java runtime. If core.symlinks is set to true, the assumption is that symlinks are supported, which may result in runtime errors if this turns out not to be the case. Measuring the cost of jgit status on a repository with ~70000 files, of which ~30000 are tracked reveals a penalty of about 10% for using the Java7 (really NIO2) support module. Bug: 354367 Change-Id: I12f0fdd9d26212324a586896ef7eb1f6ff89c39c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Failing to delete a directory with untracked content is actually okRobin Rosenberg2014-02-101-5/+4
| | | | | | | We had a test, but it was wrong. Bug: 424630 Change-Id: I926e0954c8623a323a50fe8be3ebe5e0ac6944c8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Ban dangerous ref names in WindowsRobin Rosenberg2014-02-051-0/+23
| | | | | | | Bug: 423551 Change-Id: I3e71ef1b4a8181f46d2902c9169859f150cd6ad0 Also-By: Robin Stocker <robin@nibor.org> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Reset internal state canonical length in WorkingTreeIterator when movingRobin Rosenberg2014-02-031-1/+14
| | | | | Bug: 426514 Change-Id: Ifb75a4fa12291aeeece3dda129a65f0c1fd5e0eb Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix for core.autocrlf=input resulting in modified fileRobin Rosenberg2014-02-022-3/+40
| | | | | | | | | | | This version does not attempt to unsmudge, unlike the first attempt in Idafad150553df14827eccfde2e3b95760e16a8b6. Bug: 372834 Change-Id: I9300e735cb16d6208e1df963abb1ff69f688155d Also-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Robin Stocker <robin@nibor.org>
* Do not report ignored directories as untrackedMatthias Sohn2014-01-191-0/+47
| | | | | Change-Id: I7e3f6b9fb1ac4b99d2cc9a78c63aad86f4fa5744 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add git checkout --orphan implementationSATO taichi2014-01-171-0/+96
| | | | Change-Id: I7bb583674641efed210d3cd5b86af27d7bb48e97 Signed-off-by: SATO taichi <ryushi@gmail.com>
* Fix fast forward rebase with rebase.autostash=trueStefan Lay2014-01-151-0/+39
| | | | | | | | | The folder .git/rebase-merge was not removed in this case. The repository was then still in rebase state, but neither abort nor continue worked. Bug: 425742 Change-Id: I43cea6c9e5f3cef9d6b15643722fddecb40632d9
* Upgrade javaewah to version 0.7.9Colby Ranger2014-01-133-3/+3
| | | | | | | Package was renamed, so I had to update the imports. Also, I verified bitmap serialization was still compatible. Change-Id: I161ad3875b963b56001beab477ef8d072accee4f
* Merge branch 'stable-3.2'Matthias Sohn2013-12-132-37/+232
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-3.2: Canonicalize worktree path in BaseRepositoryBuilder if set via config Add missing @since tags for new public methods in Config Don't use API exception in RebaseTodoLine Fix aborting rebase with detached head Add recursive variant of Config.getNames() methods Prepare post 3.2.0-m3 builds JGit v3.2.0.201311130903-m3 Change-Id: Iad6e284e0fe2c7950f156372b334e47ebd82f3f7 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Don't use API exception in RebaseTodoLineChristian Halstrick2013-12-111-36/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | This came up while testing the proposed buck build for jgit. With buck we can introduce smaller modules to allow for more concurrency during build and to better control inner structure of jgit. Trying to put the porcelain API into a different module than lower level implementation classes failed since RebaseTodoLine used a porcelain API exception causing a dependency cycle on the proposed modules. Using an exception defined on the same abstraction level fixes this problem. Change-Id: I26a5353e1a8fc23e67d8ce61309bd964f7665bcb Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
| * Merge "Fix aborting rebase with detached head" into stable-3.2Robin Rosenberg2013-12-101-0/+63
| |\
| | * Fix aborting rebase with detached headStefan Lay2013-12-101-0/+63
| | | | | | | | | | | | | | | Bug: 423670 Change-Id: Ia6052867f85d4974c4f60ee5a6c820501e8d2427
| * | Add recursive variant of Config.getNames() methodsMatthias Sohn2013-12-061-1/+55
| |/ | | | | | | | | | | | | | | | | | | | | | | | | These methods allow to find all configuration entry names for a given section or section/subsection searching recursively through all base configurations of the given configuration. These methods are needed to calculate the names for the effective configuration of a git repository which combines the configuration entry names found in the repository, global and system configuration files Bug: 396659 Change-Id: Ie3731b5e877f8686aadad3f1a46b2e583ad3b7c6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* / Prepare 3.3.0-SNAPSHOT buildsMatthias Sohn2013-12-052-36/+36
|/ | | | | Change-Id: I7c7e7c1beec0c5d15b96c14c73ce93e3f09855c8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Implement rebase.autostashStefan Lay2013-12-041-0/+137
| | | | | | | This feature was introduced in native git with version 1.8.4. Bug: 422951 Change-Id: I42f194174d64d7ada6631e2156c2a7bf93b5e91c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge "More helpful InvalidPathException messages (include reason)"Christian Halstrick2013-12-041-1/+1
|\
| * More helpful InvalidPathException messages (include reason)Robin Stocker2013-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | Instead of just a generic "Invalid path: $path", add a reason for the cases where it's not obvious what the problem is (e.g. "aux" being reserved on Windows). Bug: 413915 Change-Id: Ia6436bd2560e4f049c92d9aac907cb87348605e0 Signed-off-by: Robin Stocker <robin@nibor.org>
* | Fix IgnoreRule#isMatch returning wrong result due to missing resetRobin Stocker2013-12-031-0/+12
|/ | | | | | | | | | The matcher has to be reset before using it, as was already done in the other cases. Bug: 423039 Change-Id: I87abaa7ad7f0aac8651db6e88d41427cacb4d776 Also-by: Ondrej Vrabec <ovrabec@netbeans.org> Signed-off-by: Robin Stocker <robin@nibor.org>
* Fix exception on conflicts with recursive mergeRobin Stocker2013-12-031-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When there are conflicts with a recursive merge, the conflicting paths are stored in unmergedPaths (field in ResolveMerger). Later, when the MergeResult is constructed in MergeCommand, getBaseCommit is called, which computes the merge base a second time. In case of RecursiveMerger, getBaseCommit merges the multiple merge bases into one. It does this not by creating a new ResolveMerger but instead calling mergeTrees. The problem with mergeTrees is that at the end, it checks if unmergedPaths is non-empty and returns false in that case. Because unmergedPaths was already non-empty because of the real merge, it thinks that there were conflicts when computing the merge base again, when there really were none. This can be fixed by storing the base commit when computing it and then returning that instead of computing it a second time. Note that another possible fix would be to just use a new ResolveMerger for merging the merge bases instead. This would also remove the need to remember the old value of dircache, inCore and workingTreeIterator (see RecursiveMerger#getBaseCommit). Bug: 419641 Change-Id: Ib2ebf4e177498c22a9098aa225e3cfcf16bbd958 Signed-off-by: Robin Stocker <robin@nibor.org>
* Do not allow non-ff-rebase if there are uncommitted changesStefan Lay2013-12-021-28/+152
| | | | | | | | | | | | | With this change jgit checks for uncommitted changes before a rebase is started. This is also done by native git. One reason is that an abort would override such changes. The check is skipped for a non-interactive rebase when it will result in a fast-forward. In this case there can be only checkout conflicts but no merge conflicts, so there cannot be an abort which overrides uncommitted changes. Bug: 422352 Change-Id: I1e0b59b2a4d80a686b67a6729e441924362b1236 Signed-off-by: Stefan Lay <stefan.lay@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix handling of file/folder conflicts during a checkoutChristian Halstrick2013-11-291-0/+25
| | | | | | | | | | | | | | | | | | | | JGit was not handling certain file/folder conflicts during a checkout correctly. This was reported by Axel Richard in http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02358.html. This commit fixes this problem. Still JGit behaves intentionally different than native git. If HEAD contains a tree, and workingtree, Index and Merge contain a file with same content ... then JGit allows a conflict free checkout of Merge. Native git always complains that it doesn't want to overwrite local changes. But there is no need to update the working tree because Index and Merge are already equal. A shell script which shows how native git behaves can be found here. https://gist.github.com/chalstrick/7694959#file-gistfile1-sh Change-Id: Ifd6a68974d61cd4fa23bc575f3a40773db66cafc Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Fix applying stash on other commitStefan Lay2013-11-291-0/+87
| | | | | | | | Applying a stash on another commit failed because the merge base for the cherry-pick of the stashed index state was not corectly set. Bug: 422684 Change-Id: I9355352b2b9a7abefa3248ca3c17a9301177d0d6 Signed-off-by: Stefan Lay <stefan.lay@sap.com>
* Break up GCTest to run in parallelShawn Pearce2013-11-2411-777/+1226
| | | | | | | | Separate some sections of the GC tests into different test classes. Individual classes permits running in parallel under Buck, reducing test latency if there are sufficient CPUs available. Change-Id: I5eb177f78efd4aa8ac857d0d8b1a1fd81ca07790
* Modify T0004_PackReaderTest to use existing packShawn Pearce2013-11-241-10/+10
| | | | | | | | Instead of making a new PackFile from a resource, lookup the existing PackFile that was already created by the base class SampleDataRepositoryTestCase. Change-Id: Ib5da18c832ae0cb29703706b99e99503f5cc819d
* Move SampleDataRepositoryTestCase to org.eclipse.jgit.testShawn Pearce2013-11-2416-15/+94
| | | | | | | | This class requires resources which are private to another bundle. Move the class next to its resources, removing an odd cross bundle dependency. Change-Id: I30d5568b09ea5fb3bd3bb60b602f149c0867f49a
* Cache SimpleDateFormat in GitDateParser per localeMatthias Sohn2013-11-233-18/+38
| | | | | | | | | | Otherwise switching to another locale yields wrong results when parsing date strings in GitDateParser. Since the MockSystemReader explicitly uses english locale the tests need to specify the locale to be used when parsing date strings. Bug: 420772 Change-Id: I313ef6b1e9ef3bfb43d929ce34712ebd21f2cd9c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix FIXUP error for blank lines in interactive rebaseStefan Lay2013-11-221-0/+38
| | | | | | | | Empty lines of discarded commit messages were added to the commit message because they were not commented out properly. Bug: 422246 Change-Id: I263e8a6b30a3392d8b4f09c0695505068a0a485d Signed-off-by: Stefan Lay <stefan.lay@sap.com>
* Fix parsing Rebase todo lines when commit message is missingStefan Lay2013-11-211-0/+13
| | | | | Bug: 422253 Change-Id: I9739b16c91d2df31a481360a712d3479a4eeee2e Signed-off-by: Stefan Lay <stefan.lay@sap.com>
* Add close() method to APIChristian Halstrick2013-11-201-0/+28
| | | | | | | | | | | The API in org.eclipse.jgit.api does allow to open repositories but it did not allow to close them. This commit fixes this and allows API users to close a repository without having to use lower-level classes. Bug: 420502 Change-Id: I866225cc8534ae5916113fa24eb1c7513fd4472e Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Don't delete .idx file if .pack file can't be deletedChristian Halstrick2013-11-131-0/+36
| | | | | | | | | | | | | | | | | | If during an garbage collection old packfiles are deleted it could happen that on certain platforms the index file can be deleted but the packfile can't be deleted (because someone locked the file). This led to repositories with packfiles without corresponding index files. Those zombie-packfiles potentially consume a lot of space on disk and it is never tried to delete them again. Try to avoid this situation by deleting packfiles first and don't try to delete the other files if we can't delete the packfile. This gives us the chance to delete the packfile during next GC. This commit only improves the situation - there is still the chance for orphan files during packfile deletion. We don't have an atomic delete of multiple files . Change-Id: I0a19ae630186f07d0cc7fe9df246fa1cedeca8f6
* [findBugs] Remove nonsense callMatthias Sohn2013-11-101-1/+0
| | | | | | Result of c.containsAll(c) is always true for any collection c. Change-Id: I853cbb44bdc03e2b54229bb9c36ae42e02dcc4d9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove unnecessary @SuppressWarnings("null")Matthias Sohn2013-11-101-5/+0
| | | | Change-Id: I5bddcdab2c5cc92622144a7b207bad90cb601609 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Don't import non-existing package org.eclipse.jgit.java7Matthias Sohn2013-11-101-1/+0
| | | | Change-Id: Idc48cb1995050913498d2bad97a8e6e330dee94c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Interactive Rebase: Do actions if there were conflictsStefan Lay2013-11-081-0/+207
| | | | | | | | | If a commit was marked for edit, reword, squash or fixup, but the interactive rebase stopped because of a conflict, the step was not done after conflict resolution. This is done now. Change-Id: If8e7ccc50469165744f2b8a53d180f9ba0f72330 Signed-off-by: Stefan Lay <stefan.lay@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Rebase interactive should finish if last step is editStefan Lay2013-11-061-0/+33
| | | | | | | | When the last step was an edit step, rebase interactive did not finish after continuing the rebase. Instead, it returned with the status FAST_FORWARD. Change-Id: Ib19857474ac089dfeaae665ad5e95c66c21099b0
* Merge changes I40f2311c,I3c419094Matthias Sohn2013-11-051-2/+339
|\ | | | | | | | | | | * changes: Add additional RebaseResult for editing commits Add Squash/Fixup support for rebase interactive in RebaseCommand
| * Add additional RebaseResult for editing commitsStefan Lay2013-11-051-1/+1
| | | | | | | | | | | | | | | | | | With the new RebaseResult.EDIT a client can now distinguish if rebase stopped due to a conflict or because the commit was marked for edit in an interactive rebase. Change-Id: I40f2311cf43ed5f290dcda65a7bd85ba770a85f5 Signed-off-by: Stefan Lay <stefan.lay@sap.com>
| * Add Squash/Fixup support for rebase interactive in RebaseCommandTobias Pfeifer2013-11-051-1/+338
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rebase command now supports squash and fixup. Both actions are not allowed as the first step of the rebase. In JGit, before any rebase step is performed, the next commit is already cherry-picked. This commit keeps that behaviour. In case of squash or fixup a soft reset to the parent is perfomed afterwards. CQ: 7684 Bug: 396510 Change-Id: I3c4190940b4d7f19860e223d647fc78705e57203 Signed-off-by: Tobias Pfeifer <to.pfeifer@web.de> Signed-off-by: Stefan Lay <stefan.lay@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Merge changes ↵Shawn Pearce2013-11-0518-76/+201
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | I85470d1d,I43711486,Ie6ade781,Ic9ab2b6e,Iebe50933,Id6fac253,Ia6becf30,I2af8b0ac * changes: Use absolute paths for file:// URIs in tests Use getPath() in FileResolverTest Extract protocol constants to a common class Move repeat() to utility class for tests Remove hardcoded target/trash from test cases Remove dependency on StatusCommandTest Remove dependency on DiffFormatterReflowTest Remove unnecessary import of BaseConnection in MessageWriter
| * Use absolute paths for file:// URIs in testsShawn Pearce2013-11-018-29/+42
| | | | | | | | | | | | | | | | When run under Buck the repository paths may be relative. Request an absolute path to construct the URI, as relative paths are not supported in file:// style URIs. Change-Id: I85470d1db2f4e80cba30f1559c0d99bdfa8ac410
| * Move repeat() to utility class for testsShawn Pearce2013-11-013-12/+59
| | | | | | | | | | | | | | | | Avoid depending on AutoCRLFOutputStreamTest from within another test such as AutoCRLFInputStreamTest. Breaking the dependency up allows the test classes to be built and executed in parallel. Change-Id: Ic9ab2b6ec74ac87ff4adda8a802ae343dd2a6235
| * Remove hardcoded target/trash from test casesShawn Pearce2013-11-013-5/+22
| | | | | | | | | | | | | | | | | | | | | | Buck does not create a target directory for the build output, this is Maven specific and the project unit tests should not rely on it. Instead follow the pattern used by org.eclipse.jgit.test which is to create a temporary directory in the system temporary folder, and configure the Maven surefire plugin to use the target directory. Change-Id: Iebe5093332343a90f51080614e083aac0d29c26d
| * Remove dependency on StatusCommandTestShawn Pearce2013-11-013-24/+71
| | | | | | | | | | | | | | Move the set constructor function to a Sets utility class, allowing the tests to compile in parallel. Change-Id: Id6fac2533fab8d423f949c892f199af2491a450b
| * Remove dependency on DiffFormatterReflowTestShawn Pearce2013-11-011-6/+7
| | | | | | | | | | | | | | Reference the resource from the root of the CLASSPATH, allowing the test classes to be compiled in parallel with no dependencies. Change-Id: Ia6becf30ccfe93b8585b82293d9a4863b0cf837e
* | Also use MockSystemReader in GitDateParserBadlyFormattedTestMatthias Sohn2013-11-051-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | All tests should use MockSystemReader to isolate them from the underlying platform specifics. GitDateParserBadlyFormattedTest wasn't using MockSystemReader which induced Bug 420772 as a side effect since GitDateParser caches SimpleDateFormat instances without regarding their locale. This will be fixed in another change Bug: 420772 Change-Id: I798e55d05730a71bb0326f80aea5488541d6c1f2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Merge "testMaliciousPathEmpty fails on Windows"Christian Halstrick2013-11-041-2/+9
|\ \
| * | testMaliciousPathEmpty fails on WindowsRobin Rosenberg2013-11-011-2/+9
| |/ | | | | | | | | | | | | | | Checking of spaces at the end of the file name caused the test to fail for Windows only. Bug: 396662 Change-Id: I47bcccb0fa32ce606276c3f30d454851d115ca11 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* | Parse commitId and shortMessage of a commented out line in rebase todoTobias Pfeifer2013-10-311-0/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | A rebase todo file consists of regular non-comment action lines and comment lines. In case that a regular action line has been commented out (i.e. prefixed with a hash '#'), the RebaseTodoLine that is representing this line should hold the values for commitId and shortMessage even though it's a comment line. This allows to switch between comment and non-comment easily even after the file has been persisted and reread. Change-Id: I56ec2ba08eaf3772e2d74d937dd496209a744d4b Signed-off-by: Tobias Pfeifer <to.pfeifer@web.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Enhance reading of git-rebase-todo formatted filesChristian Halstrick2013-10-311-25/+122
|/ | | | | | | | | | | | | | | | | | | | Reading and writing files formatted like the git-rebase-todo files was hidden in the RebaseCommand. Certain constructs (like leading tabs and spaces) have not been handled as in native git. Also the upcoming rebase interactive feature in EGit needs reading/writing these files independently from a RebaseCommand. Therefore reading and writing those files has been moved to the Repository class. RebaseCommand gets smaller because of that and doesn't have to deal with reading/writing files. Additional tests for empty todo-list files, or files containing comments have been added. Change-Id: I323f3619952fecdf28ddf50139a88e0bea34f5ba Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Also-by: Tobias Pfeifer <to.pfeifer@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>