aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
* Refactor TemporaryBuffer to support reuse in other contextsShawn O. Pearce2010-01-122-15/+27
| | | | | | | | | | | | | | | | Later we are going to add support for smart HTTP, which requires us to buffer at least some of the request created by a client before we ship it to the server. For many requests, we can fit it completely into a 1 MiB buffer, but if it doesn't we can drop back to using the chunked transfer encoding to send an unknown stream length. Rather than recoding the block based memory buffer, we refactor the local file overflow strategy into a subclass, allowing the HTTP client code to replace this portion of the logic with its own approach to start the chunked encoding request. Change-Id: Iac61ea1017b14e0ad3c4425efc3d75718b71bb8e Signed-off-by: Shawn O. Pearce <sop@google.com>
* Implement multi_ack_detailed protocol extensionShawn O. Pearce2010-01-121-0/+33
| | | | | | | | | | The multi_ack_detailed extension breaks out the "ACK %s continue" status code into "ACK %s common" and "ACK %s ready" states, making it easier to discover which objects are truely common, and which objects are simply on a chain the server doesn't care learning about. Change-Id: Ie8e907424cfbbba84996ca205d49eacf339f9d04 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Abstract out utility functions for creating test commitsShawn O. Pearce2010-01-128-102/+54
| | | | | | | | | These routines create a fairly clean DSL for writing out the structure of a repository in a test case. Abstract them into a helper class that we can reuse in other test environments. Change-Id: I55cce3d557e1a28afe2fdf37b3a5b67e2651c9f1 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Move TestRng to our JUnit helper packageShawn O. Pearce2010-01-122-67/+2
| | | | | | | | Other test suites may find this useful, especially when trying to defeat the pack file compression with random data files. Change-Id: Ic00a4ac626af7a1c94d18ee99305e295b267b1a3 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Finish removing Apache Felix maven-bundle-pluginShawn O. Pearce2010-01-121-4/+1
| | | | | | | | | | | | | | | | Since Robin reverted using the maven-bundle-plugin to produce the OSGi manifest, there is no reason for us to reference it from our build process anymore. Also, when Robin reverted the to the Eclipse way of doing things, we failed to update the ignore files to ignore our generated files but not ignore our tracked .classpath. Finally, we cannot delete the MANIFEST.MF file during a Maven build, as this is once again a source file. Change-Id: I53f77f2002cb4285f728968829560e835651e188 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Merge "Partial revert "Switch build to Apache Felix maven-bundle-plugin""Robin Rosenberg2010-01-129-36/+101
|\
| * Partial revert "Switch build to Apache Felix maven-bundle-plugin"Robin Rosenberg2010-01-109-36/+101
| | | | | | | | | | | | | | | | | | | | This restores the ability to build using just Eclipse without strange procedures, extra plugins and it is again possible to work on both JGit and EGit in the same Eclipse workspace with ease. Change-Id: I0af08127d507fbce186f428f1cdeff280f0ddcda Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* | Merge branch 'cq-diff'Shawn O. Pearce2010-01-066-0/+714
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per CQ 3559 "JGit - Eugene Myers O(ND) difference algorithm" we have approval to check this into our master branch. * cq-diff: Add file content merge algorithm Add performance tests for MyersDiff Add javadoc comments, remove unused code, shift comments to correct place Fixed MyersDiff to be able to handle more than 100k Fix some warnings regarding unnecessary imports and accessing static methods Add the "jgit diff" command Prepare RawText for diff-index and diff-files Add a test class for Myers' diff algorithm Add Myers' algorithm to generate diff scripts Add set to IntList Conflicts: org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java Change-Id: Ia8e98d81ba1ab52f84d0258a40e6ef5eece9a5b1 CC: Christian Halstrick <christian.halstrick@sap.com>
| * | Add file content merge algorithmChristian Halstrick2010-01-061-0/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the file content merge alorithm and tests for merge to jgit. The merge algorithm: - Gets as input parameters the common base, the two new contents called "ours" and "theirs". - Computes the Edits from base to ours and from base to theirs with the help of MyersDiff. - Iterates over the edits. - Independent edits from ours or from theirs will just be applied to the result. - For conflicting edits we first harmonize the ranges of the edits so that in the end we have exactly two edits starting and ending at the same points in the common base. Then we write the two conclicting contents into the result stream. Change-Id: I411862393e7bf416b6f33ca55ec5af608ff4663 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> [sp: Fixed up two awkard comments in documentation.] Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
| * | Add performance tests for MyersDiffChristian Halstrick2009-11-053-0/+397
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add some tests which make sure that the diff algorithm really behaves in the promised O(N*D) manner. This tests compute diffs between multiple big chunks of data, measure time for computing the diffs and fail if the measured times are off O(N*D) by more than a factor 10 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Change-Id: I8e1e0be60299472828718371b231f1d8a9dc21a7 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
| * | Add a test class for Myers' diff algorithmJohannes Schindelin2009-10-061-0/+109
| | | | | | | | | | | | | | | | | | | | | | | | Bug: 291083 Eclipse-CQ: 3559 Change-Id: I5a10946637438052e7596489b9f9de3a0c6b2066 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
| * | Add set to IntListJohannes Schindelin2009-10-061-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some applications may wish to modify an int list. Bug: 291083 Eclipse-CQ: 3559 Change-Id: Iea871443ec661230aec92397229f1eda6c74216f Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Fix code formatter style referencesShawn O. Pearce2010-01-051-3/+3
| | | | | | | | | | | | | | | | | | | | | We call it "JGit Format", not "JGit". Change-Id: Idd20557d21fe20602c00a60bfeaea78d3c95fe5e Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | UnionInputStream: combines sequential InputStreams into oneShawn O. Pearce2010-01-041-0/+217
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UnionInputStream utility class combines multiple sequential InputStreams so they appear to the caller as a single stream with no gaps. This can be used to concentate streams coming from multiple independent HTTP connections (for example). The companion unit test covers the class's full functionality. Change-Id: I0676c7b5e082a5886bf0e8f43f9fd6c46a666228 Signed-off-by: Shawn O. Pearce <sop@google.com>
* | | Merge change I67d3ed54Code Review2009-12-281-0/+3
|\ \ \ | |_|/ |/| | | | | | | | * changes: Added -crfl attribute for DiffFormatterReflowTest test data
| * | Added -crfl attribute for DiffFormatterReflowTest test dataConstantine Plotnikov2009-12-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test data is expected to have unix new lines by tests, but it is converted to crlf on Windows platform (with msys git). As result DiffFormatterReflowTest tests fail. To prevent this problem, crlf conversion is disbled for test data related to that test. Bug: 295077 Change-Id: I67d3ed543fcc38647041896146de12b1781ec6be Signed-off-by: Constantine Plotnikov <constantine.plotnikov@gmail.com>
* | | Switch build to Apache Felix maven-bundle-pluginShawn O. Pearce2009-12-2811-103/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tycho isn't production ready for projects like JGit to be using as their primary build driver. Some problems we ran into with Tycho 0.6.0 that are preventing us from using it are: * Tycho can't run offline The P2 artifact resolver cannot perform its work offline. If the build system has no network connection, it cannot compile a project through Tycho. This is insane for a distributed version control system where developers are used to being offline during development and local testing. * Magic state in ~/.m2/repository/.meta/p2-metadata.properties Earlier iterations of this patch tried to use a hybrid build, where Tycho was only used for the Eclipse specific feature and P2 update site, and maven-bundle-plugin was used for the other code. This build seemed to work, but only due to magic Tycho specific state held in my local home directory. This means builds are not consistently repeatable across systems, and lead me to believe I had a valid build, when in fact I did not. * Manifest-first build produces incomplete POMs The POM created by the manifest-first build format does not contain the dependency chain, leading a downstream consumer to not import the runtime dependencies necessary to execute the bundle it has imported. In JGit's case, this means JSch isn't included in our dependency chain. * Manifest-first build produces POMs unreadable by Maven 2.x JGit has existing application consumers who are relying on Maven 2.x builds. Forcing them to step up to an alpha release of Maven 3 is simply unacceptable. * OSGi bundle export data management is tedious Editing each of our pom.xml files to mark a new release is difficult enough as it is. Editing every MANIFEST.MF file to list our exported packages and their current version number is something a machine should do, not a human. Yet the Tycho OSGi way unfortunately demands that a human do this work. * OSGi bundle import data management is tedious There isn't a way in the MANIFEST.MF file format to reuse the same version tags across all of our imports, but we want to have a consistent view of our dependencies when we compile JGit. After wasting more than 2 full days trying to get Tycho to work, I've decided its a lost cause right now. We need to be chasing down bugs and critical features, not trying to bridge the gap between the stable Maven repository format and the undocumented P2 format used only by Eclipse. So, switch the build to use Apache Felix's maven-bundle-plugin. This is the same plugin Jetty uses to produce their OSGi bundle manifests, and is the same plugin used by the Apache Felix project, which is an open-source OSGi runtime. It has a reasonable number of folks using it for production builds, and is running on top of the stable Maven 2.x code base. With this switch we get automatically generated MANIFEST.MF files based on reasonably sane default rules, which reduces the amount of things we have to maintain by hand. When necessary, we can add a few lines of XML to our POMs to tweak the output. Our build artifacts are still fully compatible with Maven 2.x, so any downstream consumers are still able to use our build products, without stepping up to Maven 3.x. Our artifacts are also valid as OSGi bundles, provided they are organized on disk into a repository that the runtime can read. With maven-bundle-plugin the build runs offline, as much as Maven 2.x is able to run offline anyway, so we're able to return to a distributed development environment again. By generating MANIFEST.MF at the top level of each project (and therefore outside of the target directory), we're still compatible with Eclipse's PDE tooling. Our projects can be imported as standard Maven projects using the m2eclipse plugin, but the PDE will think they are vaild plugins and make them available for plugin builds, or while debugging another workbench. This change also completely removes Tycho from the build. Unfortunately, Tycho 0.6.0's pom-first dependency resolver is broken when resolving a pom-first plugin bundle through a manifest-first feature package, so bundle org.eclipse.jgit can't be resolved, even though it might actually exist in the local Maven repository. Rather than fight with Tycho any further, I'm just declaring it plugina-non-grata and ripping it out of the build. Since there are very few tools to build a P2 format repository, and no documentation on how to create one without running the Eclipse UI manually by poking buttons, I'm declaring that we are not going to produce a P2 update site from our automated builds. Change-Id: If7938a86fb0cc8e25099028d832dbd38110b9124 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Recognize Git repository environment variablesRobin Rosenberg2009-12-281-1/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the jgit command line behave like the C Git implementation in the respect. These variables are not recognized in the core, though we add support to do the overrides there. Hence other users of the JGit library, like the Eclipse plugin and others, will not be affected. GIT_DIR The location of the ".git" directory. GIT_WORK_TREE The location of the work tree. GIT_INDEX_FILE The location of the index file. GIT_CEILING_DIRECTORIES A colon (semicolon on Windows) separated list of paths that which JGit will not cross when looking for the .git directory. GIT_OBJECT_DIRECTORY The location of the objects directory under which objects are stored. GIT_ALTERNATE_OBJECT_DIRECTORIES A colon (semicolon on Windows) separated list of object directories to search for objects. In addition to these we support the core.worktree config setting when the git directory is set deliberately instead of being found. Change-Id: I2b9bceb13c0f66b25e9e3cefd2e01534a286e04c Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Add support for creating detached headsRobin Rosenberg2009-12-281-0/+58
|/ / | | | | | | | | | | | | | | | | | | An extra flag when creating a RefUpdate object allows the caller to destroy the symref and replace it with an object ref, a.k.a. detached HEAD. Change-Id: Ia88d48eab1eb4861ebfa39e3be9258c3824a19db Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Method to get a 'humanish' name from a pathMykola Nikishov2009-12-191-0/+122
| | | | | | | | | | | | Change-Id: Iec0688232bd59d4626111d77633109918e8e1df3 Signed-off-by: Mykola Nikishov <mn@mn.com.ua> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* | Only import the sample data packs on tests that need themShawn O. Pearce2009-11-0216-40/+97
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Move T0007_Index to exttstShawn O. Pearce2009-11-021-18/+23
| | | | | | | | | | | | | | | | | | | | This test depends upon the external git binary, and this isn't really a pure Java test like our module tries to claim itself is. So we move it out to exttst with other tests that require additional external resources and/or executable code. Change-Id: Ic9be0280c8bb50a5768336c64de794eb0a492b3d Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Refactor RepositoryTestCase to use LocalDiskRepository insteadShawn O. Pearce2009-11-0211-359/+79
| | | | | | | | | | Change-Id: I07014d1b8cc2fab0761d644a12e4ae04f0adf3ef Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Refactor our Maven build to be modularShawn O. Pearce2009-11-022-3/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drop our simple and stupid jgit.sh and instead rely upon Maven for the command line based build. Maven is relatively simple to download and install, and doesn't require the entire Eclipse IDE. To avoid too much refactoring of the current code we reuse the existing src/ directory within each plugin, and treat each of the existing OSGI bundles as one Maven artifact. The command line wrapper jgit.sh no longer works in the uncompiled state, as we don't know where to obtain our JSch or args4j from. Developers will now need to compile it with `mvn package`, or run our Main class from within an IDE which has the proper classpath. Bug: 291265 Change-Id: I355e95fa92fa7502651091d2b651be6917a26805 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Switch pgm, test to proper plugin projectsShawn O. Pearce2009-11-022-2/+16
| | | | | | | | | | | | | | | | This way we depend upon the MANIFEST.MF to define our classpath and our build will act more like any other OSGI bundle build. Change-Id: I9e1f1f5a0bccb0ab0e39e49b75fb400fea446619 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Move pure IO utility functions to a utility class of its own.Robin Rosenberg2009-10-312-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | According the javadoc, and implied by the name of the class, NB is about network byte order. The purpose of moving the IO only, and non-byte order related functions to another class is to make it easier for new contributors to understand that they can use these functions in general and it's also makes it easier to understand where to put new IO related utility functions Change-Id: I4a9f6b39d5564bc8a694b366e7ff3cc758c5181b Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Eclipse IDE: Automatically remove trailing whitespace on saveShawn O. Pearce2009-10-311-1/+53
| | | | | | | | | | | | | | | | | | | | | | Our project coding conventions do not want trailing whitespace at the end of a source code line. Configure Eclipse to automatically remove them when saving any Java source file. Change-Id: I9701366b3b1240879761b30556e6ff416e969e1d Reviewed-by: Mykola Nikishov <mn@mn.com.ua> Reviewed-by: Alex Blewitt <alex.blewitt@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Remove trailing whitespace at end of lineAlex Blewitt2009-10-3111-118/+118
| | | | | | | | | | | | | | | | | | As discussed on the egit-dev mailing list, we prefer not to have trailing whitespace in our source code. Correct all currently offending lines by trimming them. Change-Id: I002b1d1980071084c0bc53242c8f5900970e6845 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Refactor org.eclipse.jgit.test to be a bundleChris Aniszczyk2009-10-165-2/+32
| | | | | | | | | | | | | | This way dependencies are described by the MANIFEST.MF, and the same build tools can be used to compile the tests. Change-Id: I4dc926148410ecbadcf71b9474aeeb509691aa32
* | Fix classpath to use jsch and args4j from orbitMatthias Sohn2009-10-121-1/+1
| | | | | | | | | | | | | | All 3rd party dependencies must come from orbit to comply with Eclipse development process. Change-Id: Ia43892ab6d0169f8335c1a41b37e8c12e94cafe2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Make the default encoding when reading commits UTF-8Constantine Plotnikov2009-10-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | When reading commits the system default encoding was used if no encoding was specified in the commit. The patch modifies the test to add a check that commit message was encoded correctly (the test fails on old implementation if system encoding is not UTF-8) and fixes Commit.decode() method to use UTF-8 if encoding is not specified in the commit object. Change-Id: I27101da3c2eb6edd0c4a9e4c0523e48b286e3cd5 Signed-off-by: Constantine Plotnikov <constantine.plotnikov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Remove a duplicate test from T0003_BasicRobin Rosenberg2009-10-071-10/+0
|/ | | | | | | | | In the pre-historic commit 6d87484b4dee5671a38e64a8e4990dff40a4874f two tests became identical. Remove one of them. Change-Id: I6182ecd4db0162d87a5f4577005b2bf4d5e8c89f Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* Move setupReflog test function to only test that caresShawn O. Pearce2009-10-052-19/+22
| | | | | | | | 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>
* Remove useless test005_todopack testShawn O. Pearce2009-10-051-28/+0
| | | | | | | | | | This test doesn't work because it requires a pack file which we have lost to the ages. We couldn't include it because the pack was actually a copy of the GPL'd C git.git project, and was there to test some sort of corner case that the test never documented properly. Change-Id: I282ee1c6a637a8654df93a3847507a6c60e4cfab Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add support for logAllRefUpdates configuration parameterChristian Halstrick2009-10-021-0/+122
| | | | | | | | | | | | | | | | | Honor the configuration parameter core.logAllRefUpdates when writing reflogs. Instead of writing reflog entries always only write reflogs if this parameter is set to true or if the corresponding file in the <git-dir>/logs directory already exists. In other words: if you are updating a ref and this parameter is set to false and there is no file corresponding to your ref in the <git-dir>/logs folder then no reflog will be written. This is a fix for the issue http://code.google.com/p/egit/issues/detail?id=4 Change-Id: I908e4c77e3630dc3223b2d2a47cb4534dbe4ed42 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Initial JGit contribution to eclipse.orgGit Development Community2009-09-29191-0/+27674
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>