aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Introduce FAILED result for RebaseCommandPhilipp Thun2011-03-241-0/+340
| |/ |/| | | | | | | | | | | | | In case an underlying cherry-pick fails due to uncommitted changes, a RebaseCommand shall fail and roll-back changes. Change-Id: Ic22eb047fb03ac2c8391f777036b7dbf22a1b061 Signed-off-by: Philipp Thun <philipp.thun@sap.com>
* | Merge "Introduce CherryPickResult"Mathias Kinzler2011-03-241-0/+73
|\ \
| * | Introduce CherryPickResultPhilipp Thun2011-03-231-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to distinguish cherry-pick failures caused by conflicts vs. 'abnormal failures' (e.g. due to unstaged changes or a dirty worktree), a CherryPickResult class is introduced and returned by CherryPickCommand.call() instead of a RevCommit. This new class is similar to MergeResult and RebaseResult. The CherryPickResult contains all necessary information, e.g. paths causing the cherry-pick (a merge called within, respectively) to fail. This allows callers to better react on failures. Change-Id: I5db57b9259e82ed118e4bf4ec94463efe68b8c1f Signed-off-by: Philipp Thun <philipp.thun@sap.com> Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* | | Add status command to GIT apiChristian Halstrick2011-03-231-0/+134
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | Allow users of the GIT api to get to know the state of their workingtree and index by adding a status command. The implementation is mainly a wrapper around IndexDiff class. Better support for multiple stages in the index (conflict situations) is still missing. An appropriate change to IndexDiff and StatusCommand will come in a subsequent commit. Bug: 337296 Change-Id: Idb390375a68611853c1c903299ec678c89b081dc Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | PullCommand: Use short ref name in merge messageRobin Stocker2011-03-221-2/+36
| | | | | | | | | | | | | | | | Add a test case for PullCommand for the successful merge case and test that the short ref name is used. Change-Id: I16cbbc88595f73e5512f984e67f93f87ee0fe242 Signed-off-by: Robin Stocker <robin@nibor.org>
* | Improve MergeResultPhilipp Thun2011-03-211-4/+11
| | | | | | | | | | | | | | | | | | Add paths causing abnormal merge failures (e.g. due to unstaged changes) to the MergeResult returned by MergeCommand. This helps callers to better handle (e.g. present) merge results. Change-Id: Idb8cf04c5cecfb6a12cb880e16febfc3b9358564 Signed-off-by: Philipp Thun <philipp.thun@sap.com>
* | Refactor test casesPhilipp Thun2011-03-215-87/+25
| | | | | | | | | | | | | | | | This change moves commonly used methods into the RepositoryTestCase base class. Change-Id: I56a46c31ee1661c7ce22eb755ab23da8bc9f5da2 Signed-off-by: Philipp Thun <philipp.thun@sap.com>
* | Merge "BlockList: Micro-optimize appending from another BlockList"Chris Aniszczyk2011-03-191-0/+18
|\ \ | |/ |/|
| * BlockList: Micro-optimize appending from another BlockListShawn O. Pearce2011-03-181-0/+18
| | | | | | | | | | | | | | | | | | Simple variant of addAll() that knows how to copy large segments quickly using System.arraycopy() rather than looping through with an Iterator object. Change-Id: Icb50a8f87fe9180ea28b6920f473bb9e70c300f1 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Abort merge when file to be checked out is dirtyPhilipp Thun2011-03-181-0/+158
|/ | | | | | | | | In case a file needs to be checked out (from THEIRS) during a merge operation, it has to be checked if the worktree version of this file is dirty. If this is true, merge shall fail. Change-Id: I17c24845584700aad953c3d4f2bea77a0d665ec4 Signed-off-by: Philipp Thun <philipp.thun@sap.com>
* Merge "Refactor ResolveMerger"Christian Halstrick2011-03-181-0/+4
|\
| * Refactor ResolveMergerPhilipp Thun2011-03-181-0/+4
| | | | | | | | | | | | | | | | | | | | 1. Perform an explicit check for untracked files. 2. Extract 'dirty checks' into separate methods 3. Clean up comments. 4. Tests: also check contents of files not affected by merge. Change-Id: Ieb089668834d0a395c9ab192c555538917dfdc47 Signed-off-by: Philipp Thun <philipp.thun@sap.com>
* | Merge "Moved tests for commit -o option to own test class"Mathias Kinzler2011-03-182-1243/+1310
|\ \
| * | Moved tests for commit -o option to own test classChristian Halstrick2011-03-182-1243/+1310
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We test the -o option of the commit command very accurate by writing tests for each line of a decision table. In order to still be able to point new jgit users to the CommitAndLogCommandTest to find out how to use log() and commit() I factored out these 1200 lines of very specific tests into their own class. Change-Id: Icf7c517f790a8fa79c8afd9b7f4a2805cf79196e Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | | Handle "ERR %s" when ACK/NAK is expectedShawn O. Pearce2011-03-171-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the remote peer replies with "ERR %s" instead of "ACK %s common" or "NAK" during ancestor negotiation in the fetch-pack/upload-pack protocol, treat that as an exception that aborts processing with the error text as supplied by the remote system. This matches behavior with "ERR %s" during the advertisements, which is also a way for the remote to abort processing. Change-Id: I2fe818e75c7f46156744ef4f703c40173cbc76d0 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Merge "Expose if name or email is based on a guess"Shawn Pearce2011-03-171-0/+12
|\ \ \ | |/ / |/| |
| * | Expose if name or email is based on a guessMatthias Sohn2011-03-161-0/+12
| |/ | | | | | | | | | | | | | | This enables applications to differentiate between explicitly set configuration parameters and best effort attempts to guess these parameters from the operating system. Change-Id: I67cc4099238a40c6dca795e64f0155ced6008ef1 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | CommitCommand: add option to insert a change idJens Baumgart2011-03-171-0/+61
| | | | | | | | | | | | | | | | | | | | An option to insert a change id into the commit message was added to CommitCommand. This change is a prerequisite for removing GitIndex from EGit. Change-Id: Iff9e26a8aaf21d8224bfd6ce3c98821c077bcd82 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Philipp Thun <philipp.thun@sap.com> Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* | Merge "Remove deprecated Repository.mapTree"Mathias Kinzler2011-03-173-13/+20
|\ \ | |/ |/|
| * Remove deprecated Repository.mapTreeShawn O. Pearce2011-03-073-13/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mapTree() routines have been deprecated for a long time, and their sibilings for mapCommit() and mapTag() were already removed from the main Repository API. Remove mapTree(). Application callers who only need the tree's name can use resolve("^{tree}") syntax to resolve to the tree ObjectId, or fail if the input is not a tree. Applications that want to read a tree should use DirCache or TreeWalk. Change-Id: I85726413790fc87721271c482f6636f81baf8b82 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | TransportProtocol: Allow null Repository in canHandle()Shawn O. Pearce2011-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | This allows callers to determine if a URI is supported, before worrying about the local repository. Suggested-by: Dariusz Luksza <dariusz@luksza.org> Change-Id: Ifc76a4ba841f2e2e7354bd51306b87b3b9d7f6ab Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Merge "CloneCommand: add a test to ensure we fetch all tags"Chris Aniszczyk2011-03-151-0/+12
|\ \
| * | CloneCommand: add a test to ensure we fetch all tagsChris Aniszczyk2011-03-141-0/+12
| | | | | | | | | | | | | | | | | | Bug: 326611 Change-Id: Ibf9a7caa84d99f39fca88bebc10c03b01955146d Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | | Merge "PackWriter: Rename getObjectsNumber to getObjectCount"Chris Aniszczyk2011-03-141-8/+8
|\ \ \ | |/ / |/| |
| * | PackWriter: Rename getObjectsNumber to getObjectCountShawn O. Pearce2011-03-141-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | This better matches with PackFile and CachedPack's methods that return the same value. Change-Id: Idb9b7c71d2048dd2344a62c2cde20b4e34529ab7 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | CommitCommand: set correct Reflog message when amendingJens Baumgart2011-03-141-4/+10
|/ / | | | | | | | | | | Change-Id: I2322d31b09ca63bdcee50e90340e326467dc5021 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Fix dumb transport pushShawn O. Pearce2011-03-141-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | PackWriter incorrectly returned 0 from getObjectsNumber() when the pack has not been written yet. This caused dumb transports like amazon-s3:// and sftp:// to abort early and never write out a pack, under the assumption that the pack had no objects. Until the pack header is written to the output stream, compute the current object count each time it is requested. Once the header is started, use the object count from the stats object. Change-Id: I041a2368ae0cfe6f649ec28658d41a6355933900 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | ObjectIdOwnerMap: More lightweight map for ObjectIdsShawn O. Pearce2011-03-131-0/+217
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OwnerMap is about 200 ms faster than SubclassMap, more friendly to the GC, and uses less storage: testing the "Counting objects" part of PackWriter on 1886362 objects: ObjectIdSubclassMap: load factor 50% table: 4194304 (wasted 2307942) ms spent 36998 36009 34795 34703 34941 35070 34284 34511 34638 34256 ms avg 34800 (last 9 runs) ObjectIdOwnerMap: load factor 100% table: 2097152 (wasted 210790) directory: 1024 ms spent 36842 35112 34922 34703 34580 34782 34165 34662 34314 34140 ms avg 34597 (last 9 runs) The major difference with OwnerMap is entries must extend from ObjectIdOwnerMap.Entry, where the OwnerMap has injected its own private "next" field into each object. This allows the OwnerMap to use a singly linked list for chaining collisions within a bucket. By putting collisions in a linked list, we gain the entire table back for the SHA-1 bits to index their own "private" slot. Unfortunately this means that each object can appear in at most ONE OwnerMap, as there is only one "next" field within the object instance to thread into the map. For types that are very object map heavy like RevWalk (entity RevObject) and PackWriter (entity ObjectToPack) this is sufficient, these entity types are only put into one map by their container. By introducing a new map type, we don't break existing applications that might be trying to use ObjectIdSubclassMap to track RevCommits they obtained from a RevWalk. The OwnerMap uses less memory. Each object uses 1 reference more (so we're up 1,886,362 references), but the table is 1/2 the size (2^20 rather than 2^21). The table itself wastes only 210,790 slots, rather than 2,307,942. So OwnerMap is wasting 200k fewer references. OwnerMap is more friendly to the GC, because it hardly ever generates garbage. As the map reaches its 100% load factor target, it doubles in size by allocating additional segment arrays of 2048 entries. (So the first grow allocates 1 segment, second 2 segments, third 4 segments, etc.) These segments are hooked into the pre-allocated directory of 1024 spaces. This permits the map to grow to 2 million objects before the directory itself has to grow. By using segments of 2048 entries, we are asking the GC to acquire 8,204 bytes in a 32 bit JVM. This is easier to satisfy then 2,307,942 bytes (for the 512k table that is just an intermediate step in the SubclassMap). By reusing the previously allocated segments (they are re-hashed in-place) we don't release any memory during a table grow. When the directory grows, it does so by discarding the old one and using one that is 4x larger (so the directory goes to 4096 entries on its first grow). A directory of size 4096 can handle up to 8 millon objects. The second directory grow (16384) goes to 33 million objects. At that point we're starting to really push the limits of the JVM heap, but at least its many small arrays. Previously SubclassMap would need a table of 67108864 entries to handle that object count, which needs a single contiguous allocation of 256 MiB. That's hard to come by in a 32 bit JVM. Instead OwnerMap uses 8192 arrays of about 8 KiB each. This is much easier to fit into a fragmented heap. Change-Id: Ia4acf5cfbf7e9b71bc7faa0db9060f6a969c0c50 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Make the supported Transports extensible and discoverableShawn O. Pearce2011-03-132-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new TransportProtocol type describes what a particular Transport implementation wants in order to support a connection. 3rd parties can now plug into the Transport.open() logic by implementing their own TransportProtocol and Transport classes, and registering with Transport.register(). GUI applications can help the user configure a connection by looking at the supported fields of a particular TransportProtocol type, which makes the GUI more dynamic and may better support new Transports. Change-Id: Iafd8e3a6285261412aac6cba8e2c333f8b7b76a5 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Add -o option to commit commandPhilipp Thun2011-03-111-0/+1245
| | | | | | | | | | | | | | This change adds the --only/ -o option to the commit command. Change-Id: I44352d56877f8204d985cb7a35a2e0faffb7d341 Signed-off-by: Philipp Thun <philipp.thun@sap.com>
* | PackWriter: Reduce GC during enumerationShawn O. Pearce2011-03-071-0/+336
|/ | | | | | | | | | | | | | | | | | | | | Instead of resizing an ArrayList until all objects have been added, append objects into a specialized List type that uses small arrays of 1024 entries for each 1024 objects added. For a large repository like linux-2.6, PackWriter will now allocate 1,758 smaller arrays to hold the object list, without creating any garbage from the intermediate states due to list expansion. 1024 was chosen as the block size (and initial directory size) as this is a reasonable balance for the PackWriter code. Each block uses approximately 4096 bytes in a 32 bit JVM, as does the default top level block directory. The top level directory doesn't expand until 1 million items have been added to the list, which for linux-2.6 won't yet occur as the lists are per-object-type and are thus bounded to about 1/3 of 1.8 million. Change-Id: If9e4092eb502394c5d3d044b58cf49952772f6d6 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Remove deprecated TreeIteratorShawn O. Pearce2011-03-073-456/+0
| | | | | | | | This interface has been deprecated for a while now. Applications can use a TreeWalk instead. Change-Id: I751d6e919e4b501c36fc36e5f816b8a8c5379cb9 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Remove deprecated IndexTreeVisitorShawn O. Pearce2011-03-071-162/+0
| | | | | | | | This has been deprecated for some time now. Applications should instead use DirCache within a TreeWalk. Change-Id: I8099d93f07139c33fe09bdeef8d739782397da17 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Remove deprecated WorkDirCheckoutShawn O. Pearce2011-03-073-225/+1
| | | | | | | | | This class has been deprecated for a long time now. Time to remove it. Applications can use the newer DirCacheCheckout class as a replacement. Change-Id: Id66d29fcca5a7286b8f8838303d83f40898918d2 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Remove deprecated Treeish interfaceShawn O. Pearce2011-03-072-4/+2
| | | | | | | | This interface has been deprecated for a long time now. Time to remove it. Change-Id: I29a938657e4637b2a9d0561940b38d70866613f7 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Allow to amend a commit with CommitCommandTomasz Zarna2011-03-071-0/+17
| | | | | | Bug: 339088 Change-Id: I57dc727688c4bb6968ac076b176661c857c05afa Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Enable test methods in CommitAndLogCommandTestsTomasz Zarna2011-03-071-0/+7
| | | | | | Change-Id: I52bbf19416cba42340004f0235e17a436cad1058 Bug: 339086 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Merge "PushCommand: Test for update of tracking branch"Shawn Pearce2011-03-041-0/+53
|\
| * PushCommand: Test for update of tracking branchRobin Stocker2011-03-041-0/+53
| | | | | | | | | | | | | | | | Bug 317411 (Push does not update remote tracking branch) is assigned to JGit. This test verifies that JGit does the right thing. Bug: 317411 Change-Id: I8f632e3e6c8a4f16a1170b1dba92e8fd3d6267d0
* | resolve(): Fix wrong parsing of branch "foo-gbed2-dev"Shawn O. Pearce2011-03-031-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When parsing a string such as "foo-gbed2" resolve() was assuming the suffix was from git describe output. This lead to JGit trying to find the completion for the object abbreviation "bed2", rather than using the current value of the reference. If there was only one such object in the repository, JGit might actually use the wrong value here, as resolve() would return the completion of the abbreviation "bed2" rather than the current value of the reference "refs/heads/foo-gbed2". Move the parsing of git describe abbreviations out of the operator portion of the resolve() method and into the simple portion that is supposed to handle only object ids or reference names, and only do the describe parsing after all other approaches have already failed to provide a resolution. Add new unit tests to verify the behavior is as expected by users. Bug: 338839 Change-Id: I52054d7b89628700c730f9a4bd7743b16b9042a9 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | RemoteRefUpdate: Accept Ref and ObjectId arguments for sourceShawn O. Pearce2011-03-031-5/+5
|/ | | | | | | | | | | Applications may already have a Ref or ObjectId on hand that they want the remote to be updated to. Instead of converting these into a String and relying on the parsing rules of resolve(), allow the application to supply the Ref or ObjectId directly. Bug: 338839 Change-Id: If5865ac9eb069de1c8f224090b6020fc422f9f12 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Fix NPE on checkout of remote tracking branchMatthias Sohn2011-03-012-6/+84
| | | | | | | | | 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>
* Create empty GIT_DIR/hooks directoryShawn O. Pearce2011-02-221-0/+2
| | | | | | Bug: 337801 Change-Id: I5e0c4d838a211509fb4cc7e048dba6efaec15d5c Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Merge "Changed TreeWalk.forPath(...) to work with recursive paths."Shawn Pearce2011-02-181-0/+147
|\
| * Changed TreeWalk.forPath(...) to work with recursive paths.Jesse Greenwald2011-02-171-0/+147
| | | | | | | | | | | | | | | | Previously, this method would not (always) work when a recursive path such as "a/b" was passed into it. Change-Id: I0752a1f5fc7fef32064d8f921b33187c0bdc7227 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Add git-reset to the Git APIChris Aniszczyk2011-02-171-0/+207
|/ | | | | | Bug: 334764 Change-Id: Ice404629687d7f2a595d8d4eccf471b12f7e32ec Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* RevWalk: Avoid unnecessary re-parsing of commit bodiesShawn O. Pearce2011-02-132-0/+9
| | | | | | | | | | | | If the RevFilter doesn't actually require the commit body, we shouldn't reparse it if the body was disposed. This happens often inside of UploadPack during common ancestor negotation, the RevWalk is reset and re-run over roughly the same commit space, but the bodies are discarded because the commit message is not relevant to the process. Change-Id: I87b6b6a5fb269669867047698abf718d366bd002 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Qualify post 0.11 buildsMatthias Sohn2011-02-122-32/+32
| | | | | Change-Id: Ibcef4fc4c986c2cda01e943d16aa1c53eff99f25 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* JGit 0.11.1v0.11.1Matthias Sohn2011-02-112-32/+32
| | | | | Change-Id: I9ac2fdfb4326536502964ba614d37d0bd103f524 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Adapt expected commit message in testsRobin Stocker2011-02-021-2/+2
| | | | | | | | Because of change I28ae5713, the commit message lost the "into HEAD" and caused the MergeCommandTest to fail. This change fixes it. Bug: 336059 Change-Id: Ifac0138c6c6d66c40d7295b5e11ff3cd98bc9e0c