aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
Commit message (Collapse)AuthorAgeFilesLines
...
* | Rename PlotWalk.getTags() to getRefs()Roberto Tyley2011-01-261-2/+2
| | | | | | | | | | Change-Id: I170685e70d9ac09a010df69d26ec1c38bde60174 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Provide access to the Refs of a PlotCommitRoberto Tyley2011-01-261-0/+23
| | | | | | | | | | | | | | | | This information is generally useful - have followed the accessor pattern of 'children' and 'parents' Change-Id: I79b3ddd6f390152aa49e6b7a4c72a4aca0d6bc72 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Fix tests broken by fix for adding files in a network shareRobin Rosenberg2011-01-261-1/+2
| | | | | | | | | | | | | | | | | | | | The change Ie0350e032a97e0d09626d6143c5c692873a5f6a2 was not done properly. The renamed file was not write protected, and this broke a test. Bug: 335388 Change-Id: I41b2235b7677bc5fddc70dda2a56cdd2cb53ce5d Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* | FetchCommand: allow to set "TagOpt"Mathias Kinzler2011-01-261-0/+16
| | | | | | | | | | | | | | This is needed for implementing Fetch in EGit using the API. Change-Id: Ibdcc95906ef0f93e3798ae20d4de353fb394f2e2 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* | Make sure not to overwrite untracked not-ignored filesChristian Halstrick2011-01-261-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When DirCacheCheckout was checking out it was silently overwriting untracked files. This is only ok if the files are also ignored. Untracked and not ignored files should not be overwritten. This fix adds checks for this situation. Because this change in the behaviour also broke tests which expected that a checkout will overwrite untracked files (PullCommandTest) these tests have to be modified also. Bug: 333093 Change-Id: I26806d2108ceb64c51abaa877e11b584bf527fc9 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Fix adding files in a network shareRobin Rosenberg2011-01-261-2/+1
| | | | | | | | | | | | | | | | | | | | | | We cannot always rename read-only files on network shares, so rename the temp file for a new loose object first, and then set it as read-only. Bug: 335388 Change-Id: Ie0350e032a97e0d09626d6143c5c692873a5f6a2 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Merge "Refactor and comment complicated if statements"Chris Aniszczyk2011-01-261-8/+35
|\ \
| * | Refactor and comment complicated if statementsChristian Halstrick2011-01-261-8/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When debugging and enhancing DirCacheCheckout.processEntry() I found that some of if-statements where hard to read/understand. This change just splits some long if statements and adds more comments explaining in which state we are. This change is only a preparation for followup commits which introduce checks for untracked+ignored files. Change-Id: I670ff08310b72c858709b9e395f0aebb4b290a56 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | | Merge "MergeCommand should create missing branches"Chris Aniszczyk2011-01-261-2/+25
|\| |
| * | MergeCommand should create missing branchesChristian Halstrick2011-01-261-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If HEAD exists but points to an not-existing branch the merge command should silently create the missing branch and check it out. This happens if you pull into freshly initalized repo. HEAD points to refs/heads/master but refs/heads/master doesn't exist. If you know merge a commit X into HEAD then the branch master should be created (pointing to X) the working tree should be updated to reflect X. That is achieved by checkout with one tree only (HEAD is missing). A test for this functionality will come the the next proposal in PullCommandTest. Change-Id: Id4a0d56d944e0acebd4b3157428bb50bd3fdd872 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | | Make setCredentialsProvider more convenient to useMathias Kinzler2011-01-262-2/+10
|/ / | | | | | | | | Change-Id: I984836ea7d6a67fd2d1d05f270afa7c29f30971c Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* | Permit disabling birthday attack checks in PackParserShawn O. Pearce2011-01-251-11/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reading a repository for millions of missing objects might be very expensive to perform, especially if the repository is on a network filesystem or some other costly RPC backend. A repository owner might choose to accept some risk in return for better performance, so allow disabling collision checking when receiving a pack. Currently there is no way for an end-user to disable this feature. This is intentional, because it is generally *NOT* a good idea to skip this check. Instead this feature is supplied for storage implementations to bypass the default checking logic, should they have their own custom routines that is just as effective but can be handled more efficiently. Change-Id: I90c801bb40e86412209de0c43e294a28f6a767a5 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Ensure all deltas were resolved in a packShawn O. Pearce2011-01-251-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a pack uses OFS_DELTA only (e.g. its an initial push to a repository) and PackParser's implementation is broken such that the delta chain that hangs below a particular object offset is empty, the entryCount won't match the expected objectCount. Fail fast rather than claiming the stream was parsed correctly. The current implementation is not broken as described above. I broke the code when I implemented my own new subclass of PackParser (which incorrectly mucked with the object offset information), leading me to discover this consistency check was missing. Change-Id: I07540f0ae1144ef6f3bda48774dbdefb8876e1d3 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Refactor IndexPack to not require local filesystemShawn O. Pearce2011-01-2514-1434/+2097
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By moving the logic that parses a pack stream from the network (or a bundle) into a type that can be constructed by an ObjectInserter, repository implementations have a chance to inject their own logic for storing object data received into the destination repository. The API isn't completely generic yet, there are still quite a few assumptions that the PackParser subclass is storing the data onto the local filesystem as a single file. But its about the simplest split of IndexPack I can come up with without completely ripping the code apart. Change-Id: I5b167c9cc6d7a7c56d0197c62c0fd0036a83ec6c Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Parse RevCommit bodies before calling RevFilter.include()Jesse Greenwald2011-01-251-1/+3
| | | | | | | | | | | | | | | | | | | | RevFilter.include()'s documentation promises the RevCommit's body is parsed before include is invoked. This wasn't always true if the commit was parsed once, had its body discarded, the RevWalk was reset() and started a new traversal. Change-Id: Ie5cafde09ae870712b165d8a97a2c9daf90b1dbd Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Allow to set a CredentialsProvider on relevant API commandsMathias Kinzler2011-01-252-0/+22
| | | | | | | | | | | | | | | | This is needed for commands that use Transport internally. Change-Id: I9417c85255b160723968c647063b9c7e05995ea4 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Exposed the constructor of Note classSasa Zivkov2011-01-255-9/+25
|/ | | | | | | | | | | | | | | Additionally, defined the NoteMap.getNote method which returns a Note instance. These changes were necessary to enable implementation of the NoteMerger interface (the merge method needs to instantiate a Note) and to enable direct use of NoteMerger which expects instances of Note class as its paramters. Implementing creation of code review summary notes in Gerrit [1] will make use of both of these features. [1] https://review.source.android.com/#change,20045 Change-Id: I627aefcedcd3434deecd63fa1d3e90e303b385ac Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Introduce metaData compare between working tree and index entriesChristian Halstrick2011-01-213-32/+81
| | | | | | | | | | | Instead of offering only a high-level isModified() method a new method compareMetadata() is introduced which compares a working tree entry and a index entry by looking at metadata only. Some use-cases (e.g. computing the content-id in idBuffer()) may use this new method instead of isModified(). Change-Id: I4de7501d159889fbac5ae6951f4fef8340461b47 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Add progress reporting to IndexDiffRobin Rosenberg2011-01-211-1/+94
| | | | | | Change-Id: I4f05bdb0c58b039bd379341a6093f06a2cdfec6e Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix misc spelling errors in comments and method namesRobin Rosenberg2011-01-174-17/+17
| | | | | Change-Id: I24552443710075856540696717ac4068dfe6a7f2 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* Merge "File utility for creating a new empty file"Matthias Sohn2011-01-163-0/+25
|\
| * File utility for creating a new empty fileMatthias Sohn2011-01-143-0/+25
| | | | | | | | | | | | | | | | | | | | The java.io.File.createNewFile() method for creating new empty files reports failure by returning false. To ease proper checking of return values provide a utility method wrapping createNewFile() throwing IOException on failure. Change-Id: I42a3dc9d8ff70af62e84de396e6a740050afa896 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Merge "ConfigConstants: expose some constants for user name and email."Shawn Pearce2011-01-121-0/+9
|\ \
| * | ConfigConstants: expose some constants for user name and email.Mathias Kinzler2011-01-121-0/+9
| |/ | | | | | | | | | | | | | | | | This is needed by a EGit change http://egit.eclipse.org/r/#change,2232 Change-Id: I3d62f904b769fc2f1b7b8f0f24f7dd757fc9c379 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* | Merge "CheckoutCommand: fix reflog message"Shawn Pearce2011-01-121-1/+1
|\ \
| * | CheckoutCommand: fix reflog messageMathias Kinzler2011-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a space missing between <from> and "to" in the reflog message produced by the CheckoutCommand, which is of the form moving from <from> to <to> Change-Id: I3dc57ab0a6589292db77a17d9029ee9499dfc725 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* | | Merge "Locate $HOME like C Git does on Windows"Shawn Pearce2011-01-121-0/+18
|\ \ \
| * | | Locate $HOME like C Git does on WindowsRobin Rosenberg2011-01-121-0/+18
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | Java's user.home is not the same as $HOME so EGit did see the same global configuration as C Git does. Bug: 333269 Change-Id: Id54fc5292bf8c5a67177f9097ee692717a7df336 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* / / Fix API ListBranchCommand for listmode 'all'Roberto Tyley2011-01-121-1/+3
|/ / | | | | | | | | | | | | If remote branches are present they can not be added to the RefMap from the local branches - the two RefMaps have a different value of 'prefix' and consequently an IllegalArgumentException is thrown.
* | Merge "Do not cherry-pick or revert commit more than once"Matthias Sohn2011-01-102-0/+10
|\ \ | |/ |/|
| * Do not cherry-pick or revert commit more than onceRobin Rosenberg2011-01-102-0/+10
| | | | | | | | | | | | | | | | | | Instead just return success. In the case that no commit has been cherry-picked or reverted, just return the old HEAD. Bug: 333814 Change-Id: I67db2b77b52c43932436d22a8daa5a6556423484 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* | Merge "Use heap based stack for PackFile deltas"Shawn O. Pearce2011-01-091-98/+167
|\ \
| * | Use heap based stack for PackFile deltasShawn O. Pearce2011-01-061-98/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using the current thread's stack to recurse through the delta chain, use a linked list that is stored in the heap. This permits the any thread to load a deep delta chain without running out of thread stack space. Despite needing to allocate a stack entry object for each delta visited along the chain being loaded, the object allocation count is kept the same as in the prior version by removing the transient ObjectLoaders from the intermediate objects accessed in the chain. Instead the byte[] for the raw data is passed, and null is used as a magic value to signal isLarge() and enter the large object code path. Like the old version, this implementation minimizes the amount of memory that must be live at once. The current delta instruction sequence, the base it applies onto, and the result are the only live data arrays. As each level is processed, the prior base is discarded and replaced with the new result. Each Delta frame on the stack is slightly larger than the standard ObjectLoader.SmallObject type that was used before, however the Delta instances should be smaller than the old method stack frames, so total memory usage should actually be lower with this new implementation. Change-Id: I6faca2a440020309658ca23fbec4c95aa637051c Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Merge "Config: Preserve existing case of names in sections"Shawn O. Pearce2011-01-091-14/+49
|\ \ \
| * | | Config: Preserve existing case of names in sectionsShawn O. Pearce2011-01-061-14/+49
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an application asks for the names in a section, it may want to see the existing case that was stored by the user. For example, Gerrit Code Review wants to store a configuration block like: [access "refs/heads/master"] label-Code-Review = group Developers and although the name label-Code-Review is case-insensitive, it wants to display the case as it appeared in the configuration file. When enumerating section names or variable names (both of which are case-insensitive), Config now keeps track of the string that first appeared, and presents them in file order, permitting applications to use this information. To maintain case-insensitive behavior, the contains() method of the returned Set<String> still performs a case-insensitive compare. This is a behavior change if the caller enumerates the returned Set<String> and copies it to his own Set<String>, and then performs contains() tests against that, as the strings are now the original case from the configuration block. But I don't think anyone actually does this, as the returned sets are immutable and are cached. Change-Id: Ie4e060ef7772958b2062679e462c34c506371740 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Merging Git notesSasa Zivkov2011-01-0913-20/+781
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merging Git notes branches has several differences from merging "normal" branches. Although Git notes are initially stored as one flat tree the tree may fanout when the number of notes becomes too large for efficient access. In this case the first two hex digits of the note name will be used as a subdirectory name and the rest 38 hex digits as the file name under that directory. Similarly, when number of notes decreases a fanout tree may collapse back into a flat tree. The Git notes merge algorithm must take into account possibly different tree structures in different note branches and must properly match them against each other. Any conflict on a Git note is, by default, resolved by concatenating the two conflicting versions of the note. A delete-edit conflict is, by default, resolved by keeping the edit version. The note merge logic is pluggable and the caller may provide custom note merger that will perform different merging strategy. Additionally, it is possible to have non-note entries inside a notes tree. The merge algorithm must also take this fact into account and will try to merge such non-note entries. However, in case of any merge conflicts the merge operation will fail. Git notes merge algorithm is currently not trying to do content merge of non-note entries. Thanks to Shawn Pearce for patiently answering my questions related to this topic, giving hints and providing code snippets. Change-Id: I3b2335c76c766fd7ea25752e54087f9b19d69c88 Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Fix IgnoreRule for directory-only patternsMarc Strapetz2011-01-071-10/+29
|/ / | | | | | | | | | | Patterns containing only a trailing slash have to be treated as "global" patterns. For example: "classes/" matches "classes" as well as "dir/classes" directory.
* / NoteMap implements Iterable<Note>Sasa Zivkov2011-01-052-3/+18
|/ | | | | | | | | We will need to iterate over all notes of a NoteMap, at least this will be needed for testing purposes. This change also implied making the Note class public. Change-Id: I9b0639f9843f457ee9de43504b2499a673cd0e77 Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
* Implement a revert commandRobin Rosenberg2011-01-024-1/+225
| | | | | | | | | | This is almost reverted cherry-pick, and the implementation is almost identical. It orders the input to merge differently to get the effect and produces a different commit message with the default author, rather than the original author. Change-Id: I39970091d9f7406ae7168b8efaab23a5e2c16bad Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* Merge "[findbugs] Make CheckoutResult constants final"Shawn Pearce2010-12-311-3/+4
|\
| * [findbugs] Make CheckoutResult constants finalMatthias Sohn2010-12-301-3/+4
| | | | | | | | Change-Id: I9117f212e2ad7051fdc6e7417ebc7c2d15b357a8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Convert all JGit unit tests to JUnit 4Robin Rosenberg2010-12-312-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge "Add support for getting the system wide configuration"Shawn Pearce2010-12-319-8/+172
|\ \
| * | Add support for getting the system wide configurationRobin Rosenberg2010-12-319-8/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These settings are stored in <prefix>/etc/gitconfig. The C Git binary is installed in <prefix>/bin, so we look for the C Git executable to find this location, first by looking at the PATH environment variable and then by attemting to launch bash as a login shell to find out. Bug: 333216 Change-Id: I1bbee9fb123a81714a34a9cc242b92beacfbb4a8 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* | | Merge "IndexPack: Use stack-based recursion for delta resolution"Shawn Pearce2010-12-301-52/+131
|\ \ \ | |/ / |/| |
| * | IndexPack: Use stack-based recursion for delta resolutionroberto2010-12-301-52/+131
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace 'method' with 'heap'-based recursion for resolving deltas. Git packfile delta-chain depth can exceed 50 levels in certain files (the packfile of the JGit project itself has >800 objects with chain-length >50). Using method-based recursion on such packfiles will quickly throw a StackOverflowError on VMs with constrained stack. Benefits: * packfile delta-resolution no longer limited by the maximum number of stack frames permitted on the current thread. * slight performance improvement (3% speed increase on the packfile of the JGit project) Change-Id: I1d9b3a8ba3c6d874d83cb93ebf171c6ab193e6cc Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Refactor exec of a command and reading one line into utilityRobin Rosenberg2010-12-302-33/+47
| | | | | | | | | | Change-Id: Ia9e5afe7f29c3e5e74b8d226441ed429fb229c82 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* | Refactor search for a file within a PATHRobin Rosenberg2010-12-302-8/+15
| | | | | | | | Change-Id: I785ab6bf1823d174394b1d2b25c5bb202535e943
* | Merge "Fix FileSnapShot"Shawn Pearce2010-12-301-5/+9
|\ \ | |/ |/|
| * Fix FileSnapShotRobin Rosenberg2010-12-301-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We cannot use SystemReader to get the time, unless we do that consistently, which is harder to do and be sure we are really testing what we want. Then we need to update our lastRead variable whenever we conclude that our file is not racily clean according to lastRead. It may well be clean, but we do not know that until we check the system clock again. Finally add a test for this class. Change-Id: I1894b032b9bd359d1b5325e5472d48e372599e4c Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>