summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
Commit message (Collapse)AuthorAgeFilesLines
* Avoid double quotes in Git ConfigMathias Kinzler2010-09-011-1/+25
| | | | | | | | | | | Currently, if a branch is created that has special chars ('#' in the bug), Config will surround the subsection name with double quotes during it's toText method which will result in an invalid file after saving the Config. Bug: 318249 Change-Id: I0a642f52def42d936869e4aaaeb6999567901001 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* Extend DirCache test case to check "intent to add" flag.Marc Strapetz2010-08-311-2/+5
|
* Partial support for index file format "3".Marc Strapetz2010-08-311-0/+32
| | | | | | | | Extended flags are processed and available via DirCacheEntry's new isSkipWorkTree() and isIntentToAdd() methods. "resolve-undo" information is completely ignored since its an optional extension. Change-Id: Ie6e9c6784c9f265ca3c013c6dc0e6bd29d3b7233
* Add test for RawParseUtils.formatBase10Shawn O. Pearce2010-08-311-0/+70
| | | | | Change-Id: I3ad3533d03990c9e84186e53b9d755784b2a3758 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Improve MergeAlgorithm to produce smaller conflictsChristian Halstrick2010-08-311-2/+13
| | | | | | | | | | | | | | | | | | The merge algorithm was reporting conflicts which where to big. Example: The common base was "ABC", the "ours" version contained "AB1C" (the addition of "1" after pos 2) and the "theirs" version also contained "AB1C". We have two potentially conflicting edits in the same region which happen to bring in exactly the same content. This should not be a conflict - but was previously reported as "AB<<<1===1>>>C". This is fixed by checking every conflicting chunk whether the conflicting regions have a common prefix or suffix and by removing this regions from the conflict. Change-Id: I4dc169b8ef7a66ec6b307e9a956feef906c9e15e Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Added merge strategy RESOLVEChristian Halstrick2010-08-311-36/+264
| | | | | | | | | | | | | | | This adds the first merge strategy to JGit which does real content-merges if necessary. The new merge strategy "resolve" takes as input three commits: a common base, ours and theirs. It will simply takeover changes on files which are only touched in ours or theirs. For files touched in ours and theirs it will try to merge the two contents knowing taking into account the specified common base. Rename detection has not been introduced for now. Change-Id: I49a5ebcdcf4f540f606092c0f1dc66c965dc66ba Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Stefan Lay <stefan.lay@sap.com>
* Merge "Add one more test to ReadTreeTest"Chris Aniszczyk2010-08-301-0/+14
|\
| * Add one more test to ReadTreeTestChristian Halstrick2010-08-301-0/+14
| | | | | | | | | | | | | | | | | | Add an explicit test case to check that we don't overwrite dirty files in case Head & Index are equal. Change-Id: I6266d0a449e55369d2d0a048694dca5565c5fcf3 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | Wait for JIT optimization before measuring diff performanceMatthias Sohn2010-08-301-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Mac OS X MyerDiffPerformanceTest was failing since during the first few tests the JIT compiler is running in parallel slowing down the tests. When setting the JVM option -Xbatch forcing the JIT to do its work prior to running the code this effect can be avoided. Instead we chose to run some tests without recording prior to the recorded tests since relying on -X JVM parameters isn't portable across JVMs. Use 10k * powers of 2 as sample size instead of odd numbers used before and also improve formatting of performance readings. Bug: 323766 Change-Id: I9a46d73f81a785f399d3cf5a90c8c0516526e048 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Improve LargeObjectException reportingShawn O. Pearce2010-08-302-5/+17
|/ | | | | | | | | | Use 3 different types of LargeObjectException for the 3 major ways that we can fail to load an object. For each of these use a unique string translation which describes the root cause better than just the ObjectId.name() does. Change-Id: I810c98d5691b74af9fc6cbd46fc9879e35a7bdca Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add TagCommandChris Aniszczyk2010-08-271-0/+116
| | | | | | | | | A tag command is added to the Git porcelain API. Tests were also added to stress test the tag command. Change-Id: Iab282a918eb51b0e9c55f628a3396ff01c9eb9eb Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Implement a Dircache checkout (needed for merge)Christian Halstrick2010-08-272-22/+165
| | | | | | | | | | | | | | Implementation of a checkout (or 'git read-tree') operation which works together with DirCache. This implementation does similar things as WorkDirCheckout which main problem is that it works with deprecated GitIndex. Since GitIndex doesn't support multiple stages of a file which is required in merge situations this new implementation is required to enable merge support. Change-Id: I13f0f23ad60d98e5168118a7e7e7308e066ecf9c Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Fix parsing of multiple authors in PersonIdent.Marc Strapetz2010-08-264-83/+93
| | | | | | | | | PersonIdent should be parsable for an invalid commit which contains multiple authors, like "A <a@a.org>, B <b@b.org>". PersonIdent(String) constructor now delegates to RawParseUtils.parsePersonIdent(). Change-Id: Ie9798d36d9ecfcc0094ca795f5a44b003136eaf7
* Increase temporary buffer for unit testShawn O. Pearce2010-08-251-1/+2
| | | | | | | | Because we are using the large stream size, we have to be above the STREAM_THRESHOLD constant, which I just increased. Change-Id: I6f10ec8558d9f751d4b547fcae05af94f1c8866b Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Support parsing commit:path style blob referencesShawn O. Pearce2010-08-251-0/+21
| | | | | | | | | We can now resolve expressions that reference a path within a commit, designating a specific revision of a specific tree or file in the project. Change-Id: Ie6a8be629d264d72209db894bd680c5900035cc0 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Support parsing git describe style outputShawn O. Pearce2010-08-251-0/+20
| | | | | | | | | | We now match on the -gABBREV style output created by git describe when its describing a non-tagged commit, and resolve that back to the full ObjectId using the abbreviation resolution feature that we already support. Change-Id: Ib3033f9483d9e1c66c8bb721ff48d4485bcdaef1 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Rename T0008_testparserev to RepositoryResolveTestShawn O. Pearce2010-08-251-1/+1
| | | | | | | | Calling it by the old numerical numbering system makes it really hard to find the test that tests Repository.resolve(String). Change-Id: I92d0ecbc8d66ce21bfed08888eeedf1300ffa594 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Throw AmbiguousObjectException during resolve if its ambiguousShawn O. Pearce2010-08-251-2/+15
| | | | | | | | | | | Its wrong to return null if we are resolving an abbreviation and we have proven it matches more than one object. We know how to resolve it if we had more nybbles, as there are two or more objects with the same prefix. Declare that to the caller quite clearly by giving them an AmbiguousObjectException. Change-Id: I01bb48e587e6d001b93da8575c2c81af3eda5a32 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add brute force byte array loading to ObjectLoaderShawn O. Pearce2010-08-251-0/+270
| | | | | | | | | | | | | | | | | Some algorithms are coded in a way that requires us to provide them the entire object contents as a contiguous byte array. The parsers in RevCommit and RevTag, or our RawText objects are really good examples of these. Instead of duplicating this logic everywhere, lets put it into the base ObjectLoader type. That way the caller only needs to give us their upper size bound, and we'll do the rest of the heavy work to figure out if the object still fits within that bound, and get them an array that has the complete contents. Change-Id: Id95a7f79d2b97e39f6949370ccca2f2c9cfb1a0f Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Fix ObjectDirectory abbreviation resolution to notice new packsShawn O. Pearce2010-08-241-1/+0
| | | | | | | | | | | | | | | If we can't resolve an abbreviation, it might be because there is a new pack file we haven't picked up yet. Try scanning the packs again and recheck each pack if there were differences from the last scan we did. Because of this, we don't have to open a pack during the test where we generate a pack on the fly. We'll miss on the first loop during which the PackList is the NO_PACKS magic initialization constant, and pick up the newly created index during this retry logic. Change-Id: I7b97efb29a695ee60c90818be380f7ea23ad13a3 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Fully implement SHA-1 abbreviationsShawn O. Pearce2010-08-233-5/+230
| | | | | | | | | | | | | | | | | | ObjectReader implementations are now responsible for creating the unique abbreviation of an ObjectId, or for resolving an abbreviation back to its full form. In this latter case the reader can offer up multiple candidates to the caller, who may be able to disambiguate them based on context. Repository.resolve() doesn't take multiple candidates into account right now, but it could in the future by looking for a remaining ^0 or ^{commit} suffix and take an expansion if there is only one commit that matches the input abbreviation. It could also use the distance from an annotated tag to resolve "tag-NNN-gcommit" style strings that are often output by `git describe`. Change-Id: Icd3250adc8177ae05278b858933afdca0cbbdb56 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Delete deprecated ObjectWriterShawn O. Pearce2010-08-239-72/+124
| | | | | | | | ObjectWriter is a deprecated API that people shouldn't be using. So get rid of it in favor of the ObjectInserter API. Change-Id: I6218bcb26b6b9ffb64e3e470dba5dca2e0a62fd4 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Move commit and tag formatting to CommitBuilder, TagBuilderShawn O. Pearce2010-08-235-11/+7
| | | | | | | | | | | | These objects should be responsible for their own formatting, rather than delegating it to some obtuse type called ObjectInserter. While we are at it, simplify the way we insert these into a database. Passing in the type and calling format in application code turned out to be a huge mistake in terms of ease-of-use of the insert API. Change-Id: Id5bb95ee56aa2a002243e9b7853b84ec8df1d7bf Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Rename Commit, Tag to CommitBuilder, TagBuilderShawn O. Pearce2010-08-236-24/+24
| | | | | | | | | Since these types no longer support reading, calling them a Builder is a better description of what they do. They help the caller to build a commit or a tag object. Change-Id: I53cae5a800a66ea1721b0fe5e702599df31da05d Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Perform automatic CRLF to LF conversion during WorkingTreeIteratorMarc Strapetz2010-08-204-7/+123
| | | | | | | | | | | | | | | | | | | WorkingTreeIterator now optionally performs CRLF to LF conversion for text files. A basic framework is left in place to support enabling (or disabling) this feature based on gitattributes, and also to support the more generic smudge/clean filter system. As there is no gitattribute support yet in JGit this is left unimplemented, but the mightNeedCleaning(), isBinary() and filterClean() methods will provide reasonable places to plug that into in the future. [sp: All bugs inside of WorkingTreeIterator are my fault, I wrote most of it while cherry-picking this patch and building it on top of Marc's original work.] CQ: 4419 Bug: 301775 Change-Id: I0ca35cfbfe3f503729cbfc1d5034ad4abcd1097e Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add a public RevTag.parse() methodShawn O. Pearce2010-08-201-0/+20
| | | | | | | | | | Callers might have a canonical tag encoding on hand that they wish to convert into a clean structure for presentation purposes, and the object may not be available in a repository. (E.g. maybe its a "draft" tag being written in an editor.) Change-Id: I387a462afb70754aa7ee20891e6c0262438fdf32 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add a public RevCommit.parse() methodShawn O. Pearce2010-08-201-0/+21
| | | | | | | | | | Callers might have a canonical commit encoding on hand that they wish to convert into a clean structure for presentation purposes, and the object may not be available in a repository. (E.g. maybe its a "draft" commit being written in an editor.) Change-Id: I21759cff337cbbb34dbdde91aec5aa4448a1ef37 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Make Tag class only for writingShawn O. Pearce2010-08-201-85/+48
| | | | | | | | | | The Tag class now only supports the creation of an annotated tag object. To read an annotated tag, applictions should use RevTag. This permits us to have exactly one implementation, and RevTag's is faster and more bug-free. Change-Id: Ib573f7e15f36855112815269385c21dea532e2cf Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Make Commit class only for writingShawn O. Pearce2010-08-205-72/+99
| | | | | | | | | | The Commit class now only supports the creation of a commit object. To read a commit, applictions should use RevCommit. This permits us to have exactly one implementation, and RevCommit's is faster and more bug-free. Change-Id: Ib573f7e15f36855112815269385c21dea532e2cf Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Fix ReadTreeTests to not rely on cached indexChristian Halstrick2010-08-202-1/+7
| | | | | | | | | | | ReadTreeTests relied on Repository.getIndex() which on platforms which coarse FileSystemTimers failed to detect index modifications. By explicitly reloading and writing the index this problem is solved. Change-Id: I0a98babfc2068a3b6b7d2257834988e1154f5b26 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove unnecessary ObjectId.copy() callsShawn O. Pearce2010-08-193-6/+6
| | | | | | | | | | | | | | | | | | | | When RevObject overrode equals() to provide only reference equality we used to need to convert a RevObject into an ObjectId by copy() just to use standard Java tools like JUnit assertEquals(), or to use contains() or get() on standard java.util collection types. Now that we have removed this override and made ObjectId's equals() final (preventing any of this mess in the future), some copy() calls are unnecessary. Anytime the value is being used as an input to a lookup routine, or to an equals, we can avoid the copy(). However we still want to use copy() anytime we are given an ObjectId that may exist long-term, where we don't want the high cost of the additional storage from a RevCommit extension. So we can't remove all uses of copy(), just some of them. Change-Id: Ief275dace435c0ddfa362ac8e5d93558bc7e9fc3 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Fix missing Configuration Change eventingMathias Kinzler2010-08-191-0/+81
| | | | | | | | | Configuration change events were not being triggered, now they are forwarded from the FileConfig up to the Repository's listeners. Change-Id: Ida94a59f5a2b7fa8ae0126e33c13343275483ee5 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Remove getter and setter for author in TagChris Aniszczyk2010-08-181-9/+10
| | | | | | | | | There was a duplicated getter and setter for tagger in Tag. There's no needed to have two getters and setters that represent the same things. The appropriate tests were updated also. Change-Id: If46dc00c4c0f31ea4234c6d3bda3c03e6ebbafac Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Add blob-data to utility method indexState()Christian Halstrick2010-08-183-66/+68
| | | | | | | | | | 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-182-23/+46
| | | | | | | | | | | | 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>
* Backout RevObject's object-identity based equals implementationMatthias Sohn2010-08-151-5/+5
| | | | | | | | | | | | | | This restores the transitivity and symmetry properties of the equals methods on the AnyObjectId type hierarchy as defined in [1]. Following [2] we declare these equals methods final to ensure that semantics of equals are consistent across AnyObjectId's type hierarchy. [1] http://download-llnw.oracle.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object) [2] http://www.angelikalanger.com/Articles/JavaSolutions/SecretsOfEquals/Equals.html Bug: 321502 Change-Id: Ibace21fa268c4aa15da6c65d42eb705ab1aa24b3 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'rename-bug'Shawn O. Pearce2010-08-061-1/+4
|\ | | | | | | | | | | | | | | | | | | * rename-bug: Fix ArrayIndexOutOfBounds on non-square exact rename matrix Conflicts: org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java Change-Id: Ie0b8dd3e1ec174f79ba39dc4706bb0694cc8be29
| * Fix ArrayIndexOutOfBounds on non-square exact rename matrixShawn O. Pearce2010-08-061-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | If the exact rename matrix for a particular ObjectId isn't square we crashed with an ArrayIndexOutOfBoundsException because the matrix entries were encoded backwards. The encode function accepts the source (aka deleted) index first, not second. Add a unit test to cover this non-square case to ensure we don't have this regression in the future. Change-Id: I5b005e5093e1f00de2e3ec104e27ab6820203566 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Merge changes I39bfefee,I47795987,I70d120fb,I58cc5e01,I96bee7b9Shawn O. Pearce2010-08-051-15/+31
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * changes: Enable configuration of non-standard pack settings Pass PackConfig down to PackWriter when packing Simplify UploadPack use of options during writing Move PackWriter configuration to PackConfig Allow PackWriter callers to manage the thread pool
| * | Move PackWriter configuration to PackConfigShawn O. Pearce2010-07-281-15/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This refactoring permits applications to configure global per-process settings for all packing and easily pass it through to per-request PackWriters, ensuring that the process configuration overrides the repository specific settings. For example this might help in a daemon environment where the server wants to cap the resources used to serve a dynamic upload pack request, even though the repository's own pack.* settings might be configured to be more aggressive. This allows fast but less bandwidth efficient serving of clients, while still retaining good compression through a cron managed `git gc`. Change-Id: I58cc5e01b48924b1a99f79aa96c8150cdfc50846 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Merge "Add "all" parameter to the commit Command"Chris Aniszczyk2010-08-051-0/+34
|\ \ \
| * | | Add "all" parameter to the commit CommandStefan Lay2010-08-041-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the add parameter is set all modified and deleted files are staged prior to commit. Change-Id: Id23bc25730fcdd151386cd495a7cdc0935cbc00b Signed-off-by: Stefan Lay <stefan.lay@sap.com>
* | | | Merge "Add the parameter "update" to the Add command"Chris Aniszczyk2010-08-052-72/+173
|\| | |
| * | | Add the parameter "update" to the Add commandStefan Lay2010-08-042-72/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Merge "add fsTick() to RepositoryTestCase"Chris Aniszczyk2010-08-052-32/+36
|\| | |
| * | | add fsTick() to RepositoryTestCaseChristian Halstrick2010-08-042-32/+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>
* | | | Merge "add more control to indexState() return-value"Chris Aniszczyk2010-08-052-52/+84
|\| | |
| * | | add more control to indexState() return-valueChristian Halstrick2010-08-042-52/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Allow to replace existing Change-IdStefan Lay2010-08-051-1/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is useful to be able to replace an existing Change-Id in the message, for example if the user decides not to amend the previous commit. Bug: 321188 Change-Id: I594e7f9efd0c57d794d2bd26d55ec45f4e6a47fd Signed-off-by: Stefan Lay <stefan.lay@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | | | Rename getOldName,getNewName to getOldPath,getNewPathShawn O. Pearce2010-08-045-70/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TreeWalk calls this value "path", while "name" is the stuff after the last slash. FileHeader should do the same thing to be consistent. Rename getOldName to getOldPath and getNewName to getNewPath. Bug: 318526 Change-Id: Ib2e372ad4426402d37939b48d8f233154cc637da Signed-off-by: Shawn O. Pearce <spearce@spearce.org>