aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java
Commit message (Collapse)AuthorAgeFilesLines
* Move base test classes to the junit bundle for reuse for Java 7 testsRobin Rosenberg2013-02-041-494/+0
| | | | Change-Id: Iedb54eb9d8396bc3ae66d8754c1527fd9ca655f9
* Pull up method for creating DirCacheEntry into RepositoryTestCaseRobin Stocker2012-10-281-0/+18
| | | | Change-Id: I6e6522289553137df1a46ceeb52f461e9d25a290
* Add a check in fstick that the reference file existsRobin Rosenberg2012-10-251-0/+2
| | | | | | This helps avoiding some stupid thinkos. Change-Id: I5b386cd9c6bf0e11f270bb2b8cfaac66ce9b341b
* StashCreateCommand: Abort in case of unmerged pathsRobin Stocker2012-10-221-0/+35
| | | | | Bug: 391861 Change-Id: I5f8ffe072c08c8ca2ca6be6b6afa67c8e16a63b6
* Provide a convenient read() in RepositoryTestCaseRobin Stocker2012-09-251-0/+4
| | | | | | | For reading a file by its repository-relative path, analogous to writeTrashFile. Change-Id: I112de0d57c2ee1bd425de6cbf561a57fea7147f0
* Ensure a directory exists before trying to create/merge a file into it.Jevgeni Zelenkov2012-08-061-0/+6
| | | | | | | | | | Since git doesn't keep track of empty directories, they should be created first. Test case included demonstrates that using StashApplyCommand(). Bugfix is applied to the DirCacheCheckout class, because StashApplyCommand() uses it internally to apply a stash. Change-Id: Iac259229ef919f9e92e7e51a671d877172bb88a8 Signed-off-by: Jevgeni Zelenkov <jevgeni.zelenkov@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Again teach ResolveMerger to create more correct DirCacheEntry'sChristian Halstrick2012-07-261-0/+29
| | | | | | | | | | | | | | | | | | Currently, after a merge/cherry-pick/rebase, all index entries are smudged as the ResolveMerger never sets entry lengths and/or modification times. This change teaches it to re-set them at least for things it did not touch. The other entries are then repaired when the index is persisted, or entries are checked out. The first attempt to get this in was commit 3ea694c2523d909190b5350e13254a62e94ec5d5 which has been reverted. Since then some fixes to ResolveMerger and a few more tests have been added which check situations where the index is not matching HEAD before we merge. Change-Id: I648fda30846615b3bf688c34274c6cf4bc857832 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Also-by: Markus Duft <markus.duft@salomon.at>
* Revert "Teach ResolveMerger to create more correct DirCacheEntry's"Shawn Pearce2012-07-241-29/+0
| | | | | | This reverts commit 3ea694c2523d909190b5350e13254a62e94ec5d5 Merges with unmodified subtrees are broken with this commit present. Back it out until a fixed version can be supplied.
* Teach ResolveMerger to create more correct DirCacheEntry'sMarkus Duft2012-07-191-0/+29
| | | | | | | | | | | Currently, after a merge/cherry-pick/rebase, all index entries are smudged as the ResolveMerger never sets entry lengths and/or modification times. This change teaches it to re-set them at least for things it did not touch. The other entries are then repaired when the index is persisted, or entries are checked out. Change-Id: I0944f2017483d32043d0d09409b13055b5609a4b Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Move writeTrashFile and deleteFile into JGitTestUtilDariusz Luksza2012-01-251-5/+3
| | | | | | | | | Moves RepositoryTestCase.writeThashFile, RepositoryTestCase.deleteFile and dependencies into JGitTestUtil for further reuse. Required-by-EGit: If8dfa0251797aca56ddc825619500dc21885ba26 Change-Id: I6fc62c8e6626f907e544b5bbe5d64e864a2c323f Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
* Refactor test casesPhilipp Thun2011-03-211-0/+25
| | | | | | | | This change moves commonly used methods into the RepositoryTestCase base class. Change-Id: I56a46c31ee1661c7ce22eb755ab23da8bc9f5da2 Signed-off-by: Philipp Thun <philipp.thun@sap.com>
* Fix NPE on checkout of remote tracking branchMatthias Sohn2011-03-011-6/+50
| | | | | | | | | Checkout of remote tracking branch failed when no local branch existed. Also enhance RepositoryTestCase to enable checking index state of another test repository. Bug: 337695 Change-Id: Idf4c05bdf23b5161688818342b2bf9a45b49f479 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Convert all JGit unit tests to JUnit 4Robin Rosenberg2010-12-311-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Eclipse has some problem re-running single JUnit tests if the tests are in Junit 3 format, but the JUnit 4 launcher is used. This was quite unnecessary and the move was not completed. We still have no JUnit4 test. This completes the extermination of JUnit3. Most of the work was global searce/replace using regular expression, followed by numerous invocarions of quick-fix and organize imports and verification that we had the same number of tests before and after. - Annotations were introduced. - All references to JUnit3 classes removed - Half-good replacement for getting the test name. This was needed to make the TestRngs work. The initialization of TestRngs was also made lazily since we can not longer find out the test name in runtime in the @Before methods. - Renamed test classes to end with Test, with the exception of TestTranslateBundle, which fails from Maven - Moved JGitTestUtil to the junit support bundle Change-Id: Iddcd3da6ca927a7be773a9c63ebf8bb2147e2d13 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* [findbugs] Do not ignore exceptional return valueMatthias Sohn2010-12-071-3/+3
| | | | | | | | | | java.io.File.delete() reports failure as an exceptional return value false. Fix the code which silently ignored this exceptional return value. Also remove some duplicate deletion helper methods. Change-Id: I80ed20ca1f07a2bc6e779957a4ad0c713789c5be Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Check assume unchanged flag in Add commandStefan Lay2010-11-291-0/+5
| | | | | | | | | | When the assume unchanged flag is set the Add command must not update the index for this file if any changes are present in the working directory. Bug: 331351 Change-Id: I255870f689225a1d88971182e0eb377952641b42 Signed-off-by: Stefan Lay <stefan.lay@sap.com>
* Do some more tests for rebase --abortStefan Lay2010-11-251-0/+6
| | | | | | | | | Check for deletion of temporary files in .git folder. Check for deletion and creation of files. Change-Id: I60b0b2975724f2e3582e8674d9f876dcbf62b350 Signed-off-by: Stefan Lay <stefan.lay@sap.com> Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* Add blob-data to utility method indexState()Christian Halstrick2010-08-181-17/+19
| | | | | | | | | | indexState() encodes the complete state of the index into one readable String. This helps to write tests against the index. indexState() is enhanced to optionally also contain the content of the files in the index. Change-Id: Ie988f93768d864f4cbd55809a786bd5759fc24a5 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* added resetIndex() to RepositoryTestCaseChristian Halstrick2010-08-181-0/+44
| | | | | | | | | | | | Added a utility method to set the reset an index to match exactly some content in the filesystem. This can be used by tests to prepare commits in the working-tree and set the index in one shot. [sp: Cleaned up formatting, added getEntryFile(), released inserter.] Change-Id: If38b1f7cacaaf769f51b14541c5da0c1e24568a5 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add the parameter "update" to the Add commandStefan Lay2010-08-041-0/+1
| | | | | | | | | | This change is mainly done for a subsequent commit which will introduce the "all" parameter to the Commit command. Bug: 318439 Change-Id: I85a8a76097d0197ef689a289288ba82addb92fc9 Signed-off-by: Stefan Lay <stefan.lay@sap.com>
* add fsTick() to RepositoryTestCaseChristian Halstrick2010-08-041-0/+36
| | | | | | | | | | | | An utility method which was in RacyGitTests has been moved to RepositoryTestCase. Also the javadoc has been improved. This method allows to wait long enough until the filesystem-timer has advanced. This is useful when it has to be guaranteed that two files modifications have different modification timestamps. Change-Id: I2ebd7cd7818feba6acffb3f835101d8fd281bd5a Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* add more control to indexState() return-valueChristian Halstrick2010-08-041-40/+74
| | | | | | | | | | | | | The indexState() method was enhanced to be more configurable. A bitmask controls which of the optional parts are reported. All data about the worktree is not reported anymore by this method which makes the interface more cleaner for users wanting to test only the state of the index. This was done because the previous version reported always so much additional data that it was hard to write good assertions against it. Change-Id: I9b481e97f8fcf3fcdbb785b801dc07bfa85dcc33 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Stefan Lay <stefan.lay@sap.com>
* Add tests for racy git / Index state encodingChristian Halstrick2010-07-281-0/+84
| | | | | | | | | | | | | | | | | | | | | | | | | In order to test racy git situations we have to be able to control the last-modification timestamps of the filesystem. Since we already access the modification timestamps of files through an abstraction (the WorkingTreeIterator) I add a new implementation of this iterator which allows to map timestamp-ranges to single constant timestamps. For users of this iterator it looks like all files in that range have been modified at exactly the same time. With the help of this iterator a test has been writting which checkes for racy git handling (smudging, unsmudging, dirty-detection). Additionally add a method to RepositoryTestCase which encodes the current index state in one String. This should include info about pathes, file/index modtime, smudgeState, clean-state. Make sure timestamps are presented in a way that it is easy to write assertions against this strings (no concrete milliseconds but t0,t1,...). These two topics depend circulary on each other: thats why they have been squashed in one commit. Change-Id: I115c3f2f20fca9b481830bdc6b9d1ade2c3abdcf Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Move FileRepository to storage.file.FileRepositoryShawn O. Pearce2010-06-261-0/+1
| | | | | | | | | | | | This move isolates all of the local file specific implementation code into a single package, where their package-private methods and support classes are properly hidden away from the rest of the core library. Because of the sheer number of files impacted, I have limited this change to only the renames and the updated imports. Change-Id: Icca4884e1a418f83f8b617d0c4c78b73d8a4bd17 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Rename Repository getWorkDir to getWorkTreeShawn O. Pearce2010-06-251-2/+2
| | | | | | | | | | | | | | This better matches with the name used in the environment (GIT_WORK_TREE), in the configuration file (core.worktree), and in our builder object. Since we are already breaking a good chunk of other code related to repository access, and this fairly easy to fix in an application's code base, I'm not going to offer the wrapper getWorkDir() method. Change-Id: Ib698ba4bbc213c48114f342378cecfe377e37bb7 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Use FileRepository where we assume other file semanticsShawn O. Pearce2010-06-251-1/+1
| | | | | | | | | | | When the surrounding code is already heavily based upon the assumption that we have a FileRepository (e.g. because it created that type of repository) keep the type around and use it directly. This permits us to continue to do things like save the configuration file. Change-Id: Ib783f0f6a11acd6aa305c16d61ccc368b46beecc Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Only import the sample data packs on tests that need themShawn O. Pearce2009-11-021-21/+1
| | | | | | | | | | | Not all of our test cases really require the sample data packs, and we are better off not using them because its hard to see exactly what condition a test is testing when looking only at the Java code. Clarify the dependency by only making the packs available when there is a real need for it. Change-Id: Id8a76ee7ee1f7efba585be4bed19a8fb5b3b3585 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Refactor RepositoryTestCase to use LocalDiskRepository insteadShawn O. Pearce2009-11-021-213/+21
| | | | | Change-Id: I07014d1b8cc2fab0761d644a12e4ae04f0adf3ef Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Move setupReflog test function to only test that caresShawn O. Pearce2009-10-051-19/+0
| | | | | | | | Only one test class actually needs this function, so instead of us inheriting it down into every test, move it to that one class. Change-Id: I5700ca48df4177153f2b3861dec7c538c621e775 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Initial JGit contribution to eclipse.orgGit Development Community2009-09-291-0/+347
Per CQ 3448 this is the initial contribution of the JGit project to eclipse.org. It is derived from the historical JGit repository at commit 3a2dd9921c8a08740a9e02c421469e5b1a9e47cb. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>