aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
* Merge "URIish: Allow multiple slashes in paths"Shawn Pearce2013-05-051-2/+18
|\
| * URIish: Allow multiple slashes in pathsRobin Stocker2013-04-271-2/+18
| | | | | | | | | | | | It's also allowed by C Git. Change-Id: Ie0a0d1f57d84e70fd5ef50b7844d22fea43d0e08
* | Remove unused repository field from RevWalkDave Borowitz2013-05-051-1/+1
| | | | | | | | | | | | | | | | The comment about legacy Tag and Object types no longer applies, though prior to Idb273d5a92849b42935ac14eed73b796b80aad50 the field was still being used by RewriteTreeFilter. Change-Id: I9ee5da8f8a3b61c9cf543817c03117ee0609dd8f
* | Merge "Require a DiffConfig when creating a FollowFilter"Shawn Pearce2013-05-051-1/+4
|\ \
| * | Require a DiffConfig when creating a FollowFilterDave Borowitz2013-05-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The various rename detection options are an inherent part of the filter, similar to the path being followed. This fixes a potential NPE when a RevWalk with a FollowFilter is created without a Repository, since the old code path tried to get the DiffConfig from the RevWalk's possibly-missing repository. Change-Id: Idb273d5a92849b42935ac14eed73b796b80aad50
* | | Extend the FS class for Java7Robin Rosenberg2013-05-046-1/+61
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The most important difference is that in Java7 we have symbolic links and for most operations in the work tree we want to operate on the link itself rather than the link target, which the old File methods generally do. We also add support for the hidden attribute, which only makes sense on Windows and exists, just since there are claims that Files.exists is faster the File.exists. A new bundle is only activated when run with a Java7 execution environment. It is implemented as a fragment. Tycho currently has no way to conditionally include optional features based on the java version used to run the build, this means with this change the jgit packaging build always needs to be run using java 7. Change-Id: I3d6580d6fa7b22f60d7e54ab236898ed44954ffd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | TagCommand should be able to create unannotated tags tooRobin Rosenberg2013-05-031-1/+13
| | | | | | | | | | | | | | Using the low level API's is just too cumbersome. Change-Id: Id5b9f560ee095d6db0b2ea5b26aef3e53021626e Signed-off-by: Robin Stocker <robin@nibor.org>
* | Add test for RefUpdate delete without HEADRobin Stocker2013-05-031-1/+16
| | | | | | | | | | Bug: 406722 Change-Id: I555fb366ee64d885de2a71a67cf00833f4c62561
* | Update tags on fetch if --tags or tag refspec specifiedRobin Stocker2013-05-011-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When either --tags or a tag ref is explicitly specified on fetch, C Git updates existing local tags if they are different. Before this change, JGit returned REJECTED in such a case. Now it updates it and returns FORCED. Example: % mkdir a % cd a % git init -q % touch test.txt % git add test.txt % git commit -q -m 'Initial' % git tag v1 % cd .. % git clone -q a b % cd a % echo Test > test.txt % git commit -q -a -m 'Second' % git tag -f v1 Updated tag 'v1' (was bc85c08) % cd ../b % git fetch --tags - [tag update] v1 -> v1 Bug: 388095 Change-Id: I5d5494c2ad1a2cdb8e9e614d3de445289734edfe
* | Only fetch tags that do not exist locally with auto-followRobin Stocker2013-05-011-12/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This corresponds to what C Git does, quoting from the fetch man page: This is done by first fetching from the remote using the given <refspec>s, and if the repository has objects that are pointed by remote tags that it does not yet have, then fetch those missing tags. Before, JGit would also fetch tags that exist locally but point to a different object, resulting in REJECTED results for these. Also add some test cases to cover more cases. Bug: 388095 Change-Id: Ib03d2d82e9c4b60179d626cfd5174be1da6388b2 Also-by: Stefan Lay <stefan.lay@sap.com>
* | Abort before delete in FileUtils.delete EMPTY_DIRECTORIES_ONLY|RECURSIVERobin Stocker2013-04-291-1/+116
| | | | | | | | | | | | | | | | | | | | | | | | Depending on the order in which items are traversed for RECURSIVE, an empty directory may come first before detecting that there is a file and aborting. This fixes it by traversing files first. Bug: 405558 Change-Id: I638b7da58e33ffeb0fee172b96f4c823943d29e9 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Merge "Make the Reflog a public API again"Robin Rosenberg2013-04-278-37/+36
|\ \ | |/ |/|
| * Make the Reflog a public API againRobin Rosenberg2013-04-268-37/+36
| | | | | | | | Change-Id: I8ced7098da5b345fd9af2fdfafd1ef6a44ccee0d
* | Revert "Add tests for FileUtils.delete and EMPTY_DIREECTORIES_ONLY"Shawn Pearce2013-04-191-85/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 7aa54967a26cb027fe390ad1c624ebb30f9ac6d5. The unit test dependend upon the specific order of names that listFiles() returned members in. The order is completely undefined and may differ even on different versions of Linux based systems. A proper unit test for this code would have considered both cases, where the deletion function was able to remove an empty subdirectory, or fail to remove a subdirectory because a file was still present within. This is not such a test. Change-Id: Ib0a706fea01e4b1ed8c8e859247d247a1279b4bc
* | IndexDiff: Provide stage state for conflicting entriesRobin Stocker2013-04-191-0/+48
|/ | | | | | | | | | | | | Adds a new method getConflictingStageStates() which returns a Map<String, StageState> (path to stage state). StageState is an enum for all possible stage combinations (BOTH_DELETED, ADDED_BY_US, ...). This can be used to implement the conflict text for unmerged paths in output of "git status" or in EGit for decorations/hints. Bug: 403697 Change-Id: Ib461640a43111b7df4a0debe92ff69b82171329c Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* Merge "A deleted work tree file is not a conflict when merge wants to delete it"Robin Rosenberg2013-04-191-0/+15
|\
| * A deleted work tree file is not a conflict when merge wants to delete itRobin Rosenberg2013-04-081-0/+15
| | | | | | | | | | Bug: 405199 Change-Id: I4b2ef3dc432d2fad8a6fabd1c8aec407b5c8c5ac Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* | Merge "Untracked files should not be included in stash"Robin Rosenberg2013-04-191-0/+1
|\ \
| * | Untracked files should not be included in stashRobin Rosenberg2013-04-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The previous code stashed untracked files and left them in the work tree. Bug: 403282 Change-Id: I71727addb2b55fb8e409cae2b6af8138b1ff7ef1
* | | Do not export package org.eclipse.jgit from jgit testsMatthias Sohn2013-04-191-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 3344b93c erroneously exported the package org.eclipse.jgit.lib from the org.eclipse.jgit.test bundle which made this a split package since the bundle org.eclipse.jgit exports the same package. Split packages are evil in general and most probably caused the build cycle errors observed recently when importing the jgit projects in Eclipse [1]. [1] http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02012.html Change-Id: I89919e56b928acdbff0b90e3919808025a8562c6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Remove some unnecessary dependencies on FileRepostoryRobin Rosenberg2013-04-189-35/+27
| | | | | | | | | | | | | | | Change-Id: Ib6ee3a2874a7e2240aa68f4ac32d00c4d1fab5ae Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* | | Merge "Remove unused dependencies"Robin Rosenberg2013-04-181-3/+1
|\ \ \
| * | | Remove unused dependenciesMatthias Sohn2013-04-091-3/+1
| | | | | | | | | | | | | | | | Change-Id: I3cd161ac360a2e2635bffe309725a41c9527694e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Improve test coverage of AutoCRLF(In|Out)putStreamRobin Stocker2013-04-182-18/+33
| |/ / |/| | | | | | | | | | | | | | Bug: 405672 Change-Id: I3894e98617fcee16dc2ac9853c203c62eb30c3ab Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* | | Fix boundary conditions in AutoCRLFOutputStreamRobin Rosenberg2013-04-141-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes some problems with inputs around the size of the internal buffer in AutoCRLFOutputStream (8000). Tests supplied by Robin Stocker. Bug: 405672 Change-Id: I6147897290392b3bfd4040e8006da39c302a3d49
* | | Merge "Consider working tree changes when stashing newly added files"Robin Rosenberg2013-04-111-0/+32
|\ \ \
| * | | Consider working tree changes when stashing newly added filesRobin Rosenberg2013-04-091-0/+32
| | |/ | |/| | | | | | | | | | Bug: 402396 Change-Id: I50ff707c0c9abcab3f98eea21aaa6e824f7af63a
* | | Merge changes ↵Shawn Pearce2013-04-101-0/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ideecc472,I2b12788a,I6cb9382d,I12cd3326,I200baa0b,I05626f2e,I65e45422 * changes: Increase PackOutputStream copy buffer to 64 KiB Tighten object header writing in PackOutuptStream Skip main thread test in ThreadSafeProgressMonitor Declare members of PackOutputStream final Always allocate the PackOutputStream copyBuffer Disable CRC32 computation when no PackIndex will be created Steal work from delta threads to rebalance CPU load
| * | | Skip main thread test in ThreadSafeProgressMonitorShawn Pearce2013-04-101-0/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | update(int) is only invoked from a worker thread, in JGit's case this is DeltaTask. The Javadoc of TSPM suggests update should only ever be used by a worker thread. Skip the main thread check, saving some cycles on each run of the progress monitor. Change-Id: I6cb9382d71b4cb3f8e8981c7ac382da25304dfcb
* | | Merge "LogCommand.all(): filter out refs that do not refer to commit objects"Robin Rosenberg2013-04-101-1/+7
|\ \ \
| * | | LogCommand.all(): filter out refs that do not refer to commit objectsArthur Baars2013-03-311-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. I have authored 100% of the content I'm contributing, 2. I have the rights to donate the content to Eclipse, 3. I contribute the content under the EDL Change-Id: I48b1828e0b1304f76276ec07ebac7ee9f521b194
* | | | Merge "LogCommand.all(), peel references before using them"Robin Rosenberg2013-04-101-0/+25
|\| | | | |_|/ |/| |
| * | LogCommand.all(), peel references before using themArthur Baars2013-03-311-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: LogCommand.all() throws an IncorrectObjectTypeException when there are tag references, and the repository does not contain the file "packed-refs". It seems that the references were not properly peeled before being added to the markStart() method. Solution: Call getRepository().peel() on every Ref that has isPeeled()==false in LogCommand.all() . Added test case for LogCommand.all() on repo with a tag. 1. I have authored 100% of the content I'm contributing, 2. I have the rights to donate the content to Eclipse, 3. I contribute the content under the EDL Bug: 402025 Change-Id: Idb8881eeb6ccce8530f2837b25296e8e83636eb7
* | | Fix plugin provider names to conform with release train requirementMatthias Sohn2013-04-081-1/+1
| |/ |/| | | | | | | | | | | | | | | | | According to release train requirements [1] the provider name for all artifacts of Eclipse projects is "Eclipse <project name>". [1] http://wiki.eclipse.org/Development_Resources/HOWTO/Release_Reviews#Checklist Change-Id: I8445070d1d96896d378bfc49ed062a5e7e0f201f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Add the no-commit option to MergeCommandTomasz Zarna2013-04-041-0/+125
| | | | | | | | | | | | | | | | | | | | Added also tests and the associated option for the command line Merge command. Bug: 335091 Change-Id: Ie321c572284a6f64765a81674089fc408a10d059 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Merge "Fix PathFilterGroup not to throw StopWalkException too early"Christian Halstrick2013-04-041-1/+11
|\ \
| * | Fix PathFilterGroup not to throw StopWalkException too earlyRobin Rosenberg2013-04-031-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the Git internal sort order a directory is sorted as if it ended with a '/', this means that the path filter didn't set the last possible matching entry to the correct value. In the reported issue we had the following filters. org.eclipse.jgit.console org.eclipse.jgit As an optimization we throw a StopWalkException when the walked tree passes the last possible filter, which was this: org.eclipse.jgit.console Due to the git sorting order, the tree was processed in this order: org.eclipse.jgit.console org.eclipse.jgit.test org.eclipse.jgit At org.eclipse.jgit.test we threw the StopWalkException preventing the walk from completing successfully. A correct last possible match should be: org.eclipse.jgit/ For simplicit we define it as: org/eclipse/jgit/ This filter would be the maximum if we also had e.g. org and org.eclipse in the filter, but that would require more work so we simply replace all characters lower than '/' by a slash. We believe the possible extra walking does not not warrant the extra analysis. Bug: 362430 Change-Id: I4869019ea57ca07d4dff6bfa8e81725f56596d9f
* | | Merge "Indicate initial commit on a branch in the reflog"Christian Halstrick2013-04-042-4/+6
|\| |
| * | Indicate initial commit on a branch in the reflogRobin Rosenberg2013-04-022-4/+6
| |/ | | | | | | | | Bug: 393463 Change-Id: I4733d6f719bc0dc694e7a6a6ad2092de6364898c
* / Speed up clone/fetch with large number of refsRobin Rosenberg2013-03-301-2/+113
|/ | | | | | | | Instead of re-reading all refs after each update, execute the deletes first, then read all refs once and perform the check for conflicting ref names in memory. Change-Id: I17d0b3ccc27f868c8497607d8e57bf7082e65ba3
* Fixed parsing of URI with a IPv6-addressAndreas König2013-03-271-1/+1
| | | | | | | | Allowed ipv6-address in a uri like: http://[::1]:8080/repo.git Change-Id: Ia00a20f694b2e9314892df77f9b11f551bb1d34e Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* Extend FileUtils.rename to common git semanticsRobin Rosenberg2013-03-261-0/+69
| | | | | | | | | | | | | Unlike the OS or Java rename this method will (on *nix) try (on Windows) replace the target with the source provided the target does not exist, the target does exist and is a file, or if it is a directory which only contains directories. In the latter case the directory hierarchy will be deleted. If the initial rename fails and the target is an existing file the the target file will be deleted first and then the rename is retried. Change-Id: Iae75c49c85445ada7795246a02ce02f7c248d956 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Add tests for FileUtils.delete and EMPTY_DIREECTORIES_ONLYRobin Rosenberg2013-03-241-0/+85
| | | | Change-Id: I54a46c29df5eafc7739a6ef29e5dc80fa2f6d9ba
* Merge changes If98b0b97,I7c9c09b4Shawn Pearce2013-03-213-20/+24
|\ | | | | | | | | | | * changes: Add convenience factory method for most used builder pattern Don't use internal type FileRepository in public API
| * Don't use internal type FileRepository in public APIMatthias Sohn2013-03-203-20/+24
| | | | | | | | | | Change-Id: I7c9c09b4f190fa7cb830563bcdf2071407ee2ce0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Allow users to show server messages while pushingAndré Dietisheim2013-03-211-0/+7
|/ | | | | | | | | | | | Allow users to provide their OutputStream (via Transport# push(monitor, refUpdates, out)) so that server messages can be written to it (in SideBandInputStream) while they're coming in. CQ: 7065 Bug: 398404 Change-Id: I670782784b38702d52bca98203909aca0496d1c0 Signed-off-by: Andre Dietisheim <andre.dietisheim@gmail.com> Signed-off-by: Chris Aniszczyk <zx@twitter.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix GC for FileRepo in case packfile renames failChristian Halstrick2013-03-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Only on Windows the rename operation which renames temporary Packfiles (and index-files and bitmap-files) sometime fails. This happens only when renaming a temporary Packfile to a Packfile which already exists. Such situations occur if you run GC twice on a repo without modifying the repo inbetween. In such situations there was bug in GC which led to a corrupted repo whithout any packfiles anymore. This commit fixes the problem by introducing a utility method which renames a file and throws an IOException if it fails. This method also takes care to repeat a failing rename if our FS class has found out we are running on a platform with a unreliable File.renameTo() method. I am searching for a better solution because even with this utility method in hand a GC on a already GC'ed repo will fail on Windows. But at least with this fix we will not produce corrupted repos anymore. Bug: 389305 Change-Id: Iac1ab3e0b8c419c90404f2e2f3559672eb8f6d28 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Make GC more robust against corrupt reflogsChristian Halstrick2013-03-191-5/+21
| | | | | | | | | | | With JGit it is possible to write reflog entries where new objectid and old objectid is null. Such reflogs cause FileRepository GC to crash because it doesn't expect the new objectid to be null. One case where this happened is in Gerrit's allProjects repo. In the same way as we expect the old objectid to be potentially null we should also ignore null values in the new objectid column. Change-Id: Icf666c7ef803179b84306ca8deb602369b8df16e
* JGit 3.0: move internal classes into an internal subpackageShawn Pearce2013-03-1844-112/+163
| | | | | | | | This breaks all existing callers once. Applications are not supposed to build against the internal storage API unless they can accept API churn and make necessary updates as versions change. Change-Id: I2ab1327c202ef2003565e1b0770a583970e432e9
* Support aborting non-interactive rebase started from C GitRobin Stocker2013-03-161-1/+23
| | | | | | | | | Continuing is trickier, as .git/rebase-apply contains no message file and no git-rebase-todo. Bug: 336820 Change-Id: I4eb87c850078ca187b38b81cc91c92afb1176945 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>