aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
Commit message (Collapse)AuthorAgeFilesLines
* Make Commit class only for writingShawn O. Pearce2010-08-207-365/+245
| | | | | | | | | | 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>
* Correct PersonIdent hashCode() and equals() to ignore millisecondsShawn O. Pearce2010-08-201-2/+5
| | | | | | | | | | Git doesn't store millisecond accuracy in person identity lines, so a line that we create in Java and round-trip through a Git object wouldn't compare as being equal. Truncate to seconds when comparing values to ensure the same identity is equal. Change-Id: Ie4ebde64061f52c612714e89ad34de8ac2694b07 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Try really hard to load a commit or tagShawn O. Pearce2010-08-201-1/+25
| | | | | | | | | | | | | | When we need the canonical form of a commit or a tag in order to parse it into our RevCommit or RevTag fields, we really need it as a single contiguous byte array. However the ObjectDatabase may choose to give us a large loader. In general commits or tags are always under the several MiB limit, so even if the loader calls it "large" we should still be able to afford the JVM heap memory required to get a single byte array. Coerce even large loaders into a single byte array anyway. Change-Id: I04efbaa7b31c5f4b0a68fc074821930b1132cfcf Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Fix formatting of serialization code in ObjectIdShawn O. Pearce2010-08-191-3/+4
| | | | | Change-Id: I5b3e99e9e658fe272a9e171db04b0f20e48ed8d3 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Make ObjectId.compareTo finalShawn O. Pearce2010-08-191-4/+4
| | | | | | | | | | Since equals() is now final and does not permit being overridden, we should do the same thing with compareTo() to prevent different subclasses from having different ordering behaviors. This could lead to the same mess that we had with different equals() behaviors. Change-Id: I35a849b6efccee5fe74cc5788a3566a1516004b7 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Make ObjectId.hashCode final tooShawn O. Pearce2010-08-191-1/+1
| | | | | | | | | | Since equals() is now final and does not permit being overridden, we should do the same thing with hashCode() to prevent different subclasses from having different hashing behaviors. This could lead to the same mess that we had with different equals() behaviors. Change-Id: I35a849b6efccee5fe74cc5788a3566a1516004b7 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Remove unnecessary ObjectId.copy() callsShawn O. Pearce2010-08-191-2/+2
| | | | | | | | | | | | | | | | | | | | 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-193-0/+63
| | | | | | | | | 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>
* Enhance MergeResult to report conflicts, etcChristian Halstrick2010-08-193-25/+136
| | | | | | | | | | The MergeResult class is enhanced to report more data about a three-way merge. Information about conflicts and the base, ours, theirs commits can be retrived. Change-Id: Iaaf41a1f4002b8fe3ddfa62dc73c787f363460c2 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Allow for optional tagger and message in TagChris Aniszczyk2010-08-181-4/+7
| | | | | | | | | We should be more lenient when tagging without an tagger or message. Currently, we will throw an NPE which is incorrect behavior. Change-Id: I04e30ce25a9432e4ca56c3f29658ecb24fb18d24 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Remove getter and setter for author in TagChris Aniszczyk2010-08-182-18/+4
| | | | | | | | | 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>
* added resetIndex() to RepositoryTestCaseChristian Halstrick2010-08-181-0/+9
| | | | | | | | | | | | 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>
* Do not trigger RefsChangedEvent on the first attempt to read a refRobin Rosenberg2010-08-181-1/+1
| | | | | | | | Such events make no sense, it has never been visible to this process so no client can have a stale value of the ref. Change-Id: Iea3a5035b0a1410b80b09cf53387b22b78b18018 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* Add FileRepository(String) convenience constructorKetan Padegaonkar2010-08-181-0/+14
| | | | | | | | Add a convenience API in FileRepository to pass in a String that points to the GIT_DIR location. This is converted to a File and sent through the usual constructor. Change-Id: I588388f37e89b8c690020f110a1bc59f46170c40
* Backout RevObject's object-identity based equals implementationMatthias Sohn2010-08-152-12/+2
| | | | | | | | | | | | | | 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 "Fix RevCommitList to work with subclasses of RevWalk"Shawn Pearce2010-08-121-6/+2
|\
| * Fix RevCommitList to work with subclasses of RevWalkMatthias Sohn2010-08-131-6/+2
| | | | | | | | | | Bug: 321502 Change-Id: Ic4bc49a0da90234271aea7c0a4e344a1c3620cfc Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Improve IndexDiff performanceJens Baumgart2010-08-122-0/+97
|/ | | | | | | | | Exclude ignored files from IndexDiff tree walk. This makes EGit commit much faster. Change-Id: I398499510c22c37667b7612db32eac3b31d325f0 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Merge "Hide Maven target directories from Eclipse"Chris Aniszczyk2010-08-111-0/+11
|\
| * Hide Maven target directories from EclipseRobin Rosenberg2010-08-081-0/+11
| | | | | | | | | | Change-Id: I64f12a35423a90ced9c9bc83f6869d8ed766dd35 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* | TransportHttp does not honor timeout settingMathias Kinzler2010-08-101-0/+2
| | | | | | | | | | | | | | This can result in an infinitely hanging IDE. Change-Id: I669bc8d220a07011a42edf79de31825305ff3763 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* | Fix NPE on commit in empty RepositoryJens Baumgart2010-08-091-4/+16
|/ | | | | | | | NPE occured when committing in an empty repository. Bug: 321858 Change-Id: Ibddb056c32c14c1444785501c43b95fdf64884b1 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
* Merge branch 'rename-bug'Shawn O. Pearce2010-08-061-5/+5
|\ | | | | | | | | | | | | | | | | | | * 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-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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-0513-500/+903
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * 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
| * | Enable configuration of non-standard pack settingsShawn O. Pearce2010-07-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For daemons we might want to disable delta compression entirely, or in some strange case an administrator might need to turn of delta reuse. Expose these normally internal pack settings through the pack configuration section. Change-Id: I39bfefee8384c864cc04ffac724f197240c8a11a Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
| * | Pass PackConfig down to PackWriter when packingShawn O. Pearce2010-07-286-14/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | When we are creating a pack the higher level application should be able to override the PackConfig used, allowing it to control the number of threads used or how much memory is allocated per writer. Change-Id: I47795987bb0d161d3642082acc2f617d7cb28d8c Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
| * | Simplify UploadPack use of options during writingShawn O. Pearce2010-07-281-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | We only use these variables once, so just put them at the proper use site and avoid assigning the local variable. The code is a bit shorter and the intent is a little bit more clear. Change-Id: I70d120fb149b612ac93055ea39bc053b8d90a5db Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
| * | Move PackWriter configuration to PackConfigShawn O. Pearce2010-07-287-485/+637
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Allow PackWriter callers to manage the thread poolShawn O. Pearce2010-07-282-24/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By permitting the caller of PackWriter to select the Executor it uses for task execution, we give the caller the ability to manage the lifecycle of the thread pool, including reusing it across concurrent pack generators. This is the first step to supporting application thread pools within Daemon or another managed service like Gerrit Code Review. Change-Id: I96bee7b9c30ff9885f2bd261d0b6daaac713b5a4 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Merge "Remove static progress task names from PackWriter"Shawn O. Pearce2010-08-051-30/+6
|\| |
| * | Remove static progress task names from PackWriterShawn O. Pearce2010-07-281-30/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | These need to be dynamic based on the current thread's environment at time of execution in order to be properly localized for the end user that will be seeing these messages. Change-Id: I4976f462cfe606edd2761c0e36b2f6b20f63d53c Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Merge "Add "all" parameter to the commit Command"Chris Aniszczyk2010-08-051-0/+29
|\ \ \
| * | | Add "all" parameter to the commit CommandStefan Lay2010-08-041-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-051-12/+41
|\| | |
| * | | Add the parameter "update" to the Add commandStefan Lay2010-08-041-12/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Allow to replace existing Change-IdStefan Lay2010-08-051-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-046-62/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | | Merge branch 'js/diff'Shawn O. Pearce2010-08-041-1/+2
|\ \ \ \ | | |_|/ | |/| | | | | | | | | | * js/diff: Fixed bug in scoring mechanism for rename detection
| * | | Fixed bug in scoring mechanism for rename detectionJeff Schumacher2010-08-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A bug in rename detection would cause file scores to be wrong. The bug was due to the way rename detection would judge the similarity between files. If file A has three lines containing 'foo', and file B has 5 lines containing 'foo', the rename detection phase should record that A and B have three lines in common (the minimum of the number of times that line appears in both files). Instead, it would choose the the number of times the line appeared in the destination file, in this case file B. I fixed the bug by having the SimilarityIndex instead choose the minimum number, as it should. I also added a test case to verify that the bug had been fixed. Change-Id: Ic75272a2d6e512a361f88eec91e1b8a7c2298d6b
* | | | Add gitignore support to IndexDiff and use TreeWalkJens Baumgart2010-08-041-56/+130
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | IndexDiff was re-implemented and now uses TreeWalk instead of GitIndex. Additionally, gitignore support and retrieval of untracked files was added. Change-Id: Ie6a8e04833c61d44c668c906b161202b200bb509 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | | Make use of Repository.writeMerge...()Christian Halstrick2010-07-291-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | The CommitCommand should not use java.io to delete MERGE_HEAD and MERGE_MSG files since Repository already has utility methods for that. Change-Id: If66a419349b95510e5b5c2237a91f06c1d5ba0d4 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | | Merge "Fix tag sorting in PlotWalk"Christian Halstrick2010-07-282-14/+17
|\ \ \
| * | | Fix tag sorting in PlotWalkShawn O. Pearce2010-07-282-14/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By deferring tag sorting until the commit is produced by the walker we can avoid an infinite loop that was triggered by trying to sort tags while allocating a commit. This also avoids needing to look at commits which aren't going to be produced in the result. Bug: 321103 Change-Id: I25acc739db2ec0221a50b72c2d2aa618a9a75f37 Reviewed-by: Mathias Kinzler <mathias.kinzler@sap.com> Reviewed-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | | Meaningful error message when trying to check-out submodulesMathias Kinzler2010-07-283-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, a NullPointerException occurs in this case. We should instead throw a more meaningful Exception with a proper message. This is a very "stupid" implementation which simply checks for the existence of a ".gitmodules" file. Bug: 300731 Bug: 306765 Bug: 308452 Bug: 314853 Change-Id: I155aa340a85cbc5d7d60da31dba199fc30689b67 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* | | | Fix unit tests under windowsChristian Halstrick2010-07-281-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the following tests fail under windows because certain inputstreams are not closed and files cannot be deleted because of that. The main problem I found is UnpackedObject.InflaterInputStream.close(). This method may throw exceptions found by checkValidEndOfStream() but doesn't call super.close() before leaving. It is not clear to me which resources a close() method should release before it throws an exception. But those reseources which are not published to the outside and which therefore cannot be closed by other means have to be closed in all cases. I changed the close() method to call super.close() under all circumstances. failing tests: testStandardFormat_LargeObject_TruncatedZLibStream(org.eclipse.jgit.storage.file.UnpackedObjectTest) testStandardFormat_LargeObject_TrailingGarbage(org.eclipse.jgit.storage.file.UnpackedObjectTest) testPackFormat_SmallObject(org.eclipse.jgit.storage.file.UnpackedObjectTest) Change-Id: Id2e609a29e725aad953ff9bd88af6381df38399d Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | | Teach NameConflictTreeWalk to report DF conflictsChristian Halstrick2010-07-281-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a method isDirectoryFileConflict() to NameConflictTreeWalk which tells whether the current path is part of a directory/file conflict. Change-Id: Iffcc7090aaec743dd6f3fd1a333cac96c587ae5d Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Stack Overflow in EGit History View Mathias Kinzler2010-07-281-2/+3
| |/ |/| | | | | | | | | | | | | | | | | | | This is caused by a recursion in PlotWalk.getTags(). As a hotfix, the sort was simply removed. The sort must be re-implemented so that parseAny() is not called again (currently, this happens in the PlotRefComparator). Change-Id: I060d26fda8a75ac803acaf89cfb7d3b4317328f3 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com> Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | Break dissimilar file pairs during diffJeff Schumacher2010-07-275-21/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | File pairs that are very dissimilar during a diff were not being broken apart into their constituent ADD/DELETE pairs. The leads to sub-optimal rename detection. Take, for example, this situation: A file exists at src/a.txt containing "foo". A user renames src/a.txt to src/b.txt, then adds a new src/a.txt containing "bar". Even though the old a.txt and the new b.txt are identical, the rename detection algorithm would not detect it as a rename since it was already paired in a MODIFY. I added code to split all MODIFYs below a certain score into their constituent ADD/DELETE pairs. This allows situations like the one I described above to be more correctly handled. Change-Id: I22c04b70581f206bbc68c4cd1ee87a1f663b418e Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Add methods which write MERGE_HEAD and MERGE_MSGChristian Halstrick2010-07-271-3/+60
| | | | | | | | | | | | | | | | | | | | Add methods to the Repository class which write into MERGE_HEAD and MERGE_MSG files. Since we have the read methods in the same class this seems to be the right place. Change-Id: I5dd65306ceb06e008fcc71b37ca3a649632ba462 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>