Skip to main content
summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2010-09-15JGit 0.9.1v0.9.1Matthias Sohn2-31/+31
Change-Id: Ic411b1b8a7e6039ae3ff567e2c9cdd5db84f4d41 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-09-14Fix PlotCommitList to set lanes on child-less commitsChristian Halstrick1-0/+306
In PlotCommitList.enter() commits are positioned on lanes for visual presentation. This implementation was buggy: commits without children (often the starting points for the RevWalk) are not positioned on separate lanes. The problem was that when handling commits with multiple children (that's where branches fork out) it was not handled that some of the children may not have been positioned on a lane yet. I fixed that and added a number of tests which specifically test the layout of commits on lanes. Bug: 300282 Bug: 320263 Change-Id: I267b97ecccb5251cec54cec90207e075ab50503e Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-09-08Support core.autocrlf = inputShawn O. Pearce3-2/+36
The core.autocrlf variable can take on three values: false, true, and input. Parsing it as a boolean is wrong, we instead need to parse a tri-state enumeration. Add support for parsing and setting enum values from Java from and to the text based configuration file, and use that to handle the autocrlf variable. Bug: 301775 Change-Id: I81b9e33087a33d2ef2eac89ba93b9e83b7ecc223 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-07Refactor diff sequence APIShawn O. Pearce8-102/+128
Instead of making the sequence itself responsible for the equivalence function, use an external function that is supplied by the caller. This cleans up the code because we now say cmp.equals(a, ai, b, bi) instead of a.equals(ai, b, bi). This refactoring also removes the odd concept of creating different types of sequences to have different behaviors for whitespace ignoring. Instead DiffComparator now supports singleton functions that apply a particular equivalence algorithm to a type of sequence. Change-Id: I559f494d81cdc6f06bfb4208f60780c0ae251df9 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-06Fix checkReferencedIsReachable to use correct base listShawn O. Pearce1-4/+13
When checkReferencedIsReachable is set in ReceivePack we are trying to prove that the push client is permitted to access an object that it did not send to us, but that the received objects link to either via a link inside of an object (e.g. commit parent pointer or tree member) or by a delta base reference. To do this check we are making a list of every potential delta base, and then ensuring that every delta base used appears on this list. If a delta base does not appear on this list, we abort with an error, letting the client know we are missing a particular object. Preventing spurious errors about missing delta base objects requires us to use the exact same list of potential delta bases as the remote push client used. This means we must use TOPO ordering, and we need to enable BOUNDARY sorting so that ObjectWalk will correctly include any trees found during the enumeration back to the common merge base between the interesting and uninteresting heads. To ensure JGit's own push client matches this same potential delta base list, we need to undo 60aae90d4d15 ("Disable topological sorting in PackWriter") and switch back to using the conventional TOPO ordering for commits in a pack file. This ensures that our own push client will use the same potential base object list as checkReferencedIsReachable uses on the receiving side. Change-Id: I14d0a326deb62a43f987b375cfe519711031e172 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-06DeltaStream: Fix data corruption when reading large copiesShawn O. Pearce1-1/+18
If the copy instruction was larger than the input buffer given to us, we copied the wrong part of the base stream during the next read(). This occurred on really big binary files where a copy instruction of 64k wasn't unreasonable, but the caller's buffer was only 8192 bytes long. We copied the first 8192 bytes correctly, but then reseeked the base stream back to the start of the copy region on the second read of 8192 bytes. Instead of a sequence like ABCD being read into the caller, we read AAAA. Change-Id: I240a3f722a3eda1ce8ef5db93b380e3bceb1e201 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-06Merge "Add helper methods to Edit"Chris Aniszczyk1-1/+24
2010-09-04cleanup: Remove unnecessary @SuppressWarningsRobin Rosenberg1-1/+0
Change-Id: I1b239b587e1cc811bbd6e1513b07dc93a891a842 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2010-09-04Add helper methods to EditShawn O. Pearce1-1/+24
Exposing isEmpty, getLengthA, getLengthB make it easier to examine the state of an edit and work with it from higher level code. The before and after cut routines make it easy to split an edit that contains another edit, such as to decompose a REPLACE that contains a common sequence within it. Change-Id: Id63d6476a7a6b23acb7ab237d414a0a1a7200290 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-03Fix QuotedString.GIT_PATH escaping rulesShawn O. Pearce1-1/+6
We shouldn't escape non-special ASCII characters such as '@' or '~'. These are valid in a path name on POSIX systems, and may appear as part of a path in a GNU or Git style patch script. Escaping them into octal just obfuscates the user's intent, with no gain. When parsing an escaped octal sequence, we must parse no more than 3 digits. That is, "\1002" is actually "@2", not the Unicode character \u0202. Change-Id: I3a849a0d318e69b654f03fd559f5d7f99dd63e5c Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-03Merge branch 'unpack-error'Shawn O. Pearce1-5/+53
* unpack-error: ReceivePack: Rethrow exceptions caught during indexing Change-Id: I0d0239d69cb5cd1a622bdee879978f0299e0ca40
2010-09-03ReceivePack: Rethrow exceptions caught during indexingShawn O. Pearce1-5/+53
If we get an exception while indexing the incoming pack, its likely a stream corruption. We already report an error to the client, but we eat the stack trace, which makes debugging issues related to a bug inside of JGit nearly impossible. Rethrow it under a new type UnpackException, so embedding servers or applications can catch the error and provide it to a human who might be able to forward such traces onto a JGit developer for evaluation. Change-Id: Icad41148bbc0c76f284c7033a195a6b51911beab Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-02Move rename detection, path following into DiffFormatterShawn O. Pearce1-5/+12
Applications just want a quick way to configure our diff implementation, and then just want to use it without a lot of fuss. Move all of the rename detection logic and path following logic out of our pgm package and into DiffFormatter itself, making it much easier for a GUI to take advantage of the features without duplicating a lot of code. Change-Id: I4b54e987bb6dc804fb270cbc495fe4cae26c7b0e Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-02Merge "Correct diff header formatting"Chris Aniszczyk1-0/+70
2010-09-01Refactor Git API exceptions to a new packageChris Aniszczyk5-0/+15
Create a new 'org.eclipse.jgit.api.errors' package to contain exceptions related to using the Git porcelain API. Change-Id: Iac1781bd74fbd520dffac9d347616c3334994470 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-09-01Correct diff header formattingShawn O. Pearce1-0/+70
When adding or deleting a file, we shouldn't ever prefix /dev/null with the a/ or b/ prefixes. Doing so is a mistake and confuses a patch parser which handles /dev/null magically, while a/dev/null is a file called null in the dev directory of the project. Also when adding or deleting the "diff --git" line has the "real" path on both sides, so we should see the following when adding the file called foo: diff --git a/foo b/foo --- /dev/null +++ b/foo The --- and +++ lines do not appear in a pure rename or copy delta, C Git diff seems to omit these, so we now omit them as well. We also omit the index line when the ObjectIds are exactly equal. Change-Id: Ic46892dea935ee8bdee29088aab96307d7ec6d3d Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-09-01Avoid double quotes in Git ConfigMathias Kinzler1-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>
2010-08-31Extend DirCache test case to check "intent to add" flag.Marc Strapetz2-2/+5
2010-08-31Partial support for index file format "3".Marc Strapetz2-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
2010-08-31Add test for RawParseUtils.formatBase10Shawn O. Pearce1-0/+70
Change-Id: I3ad3533d03990c9e84186e53b9d755784b2a3758 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-08-31Improve MergeAlgorithm to produce smaller conflictsChristian Halstrick1-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>
2010-08-30Added merge strategy RESOLVEChristian Halstrick1-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>
2010-08-30Merge "Add one more test to ReadTreeTest"Chris Aniszczyk1-0/+14
2010-08-30Wait for JIT optimization before measuring diff performanceMatthias Sohn1-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>
2010-08-30Improve LargeObjectException reportingShawn O. Pearce2-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>
2010-08-30Add one more test to ReadTreeTestChristian Halstrick1-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>
2010-08-28Revert "Hide Maven target directories from Eclipse"Robin Rosenberg1-11/+0
This reverts commit db4c516f673e4c274e55adc27a95891c52a5aba8 since it breaks compatibility with Eclipse 3.5 which can no longer import the projects Bug: 323390 Change-Id: I3cc91364a6747cfcb4c611a9be5258f81562f726
2010-08-27Add TagCommandChris Aniszczyk1-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>
2010-08-27Implement a Dircache checkout (needed for merge)Christian Halstrick2-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>
2010-08-26Increase heap size for jgit testsMatthias Sohn2-1/+2
Otherwise PackFileTest.testDelta_LargeObjectChain() reproducibly fails with OutOfMemoryError on Mac OS X 10.6.4. Change-Id: I6a55ff9ba181102606a0d99ffd52392a1615a422 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2010-08-26Merge "Fix parsing of multiple authors in PersonIdent."Shawn Pearce4-83/+93
2010-08-26Merge "Use JUnit4 for tests"Shawn Pearce5-36/+36
2010-08-26Run formatter on edited lines via save actionChris Aniszczyk1-3/+4
Updates the project level settings to run the formatter on save on only on the edited lines. Change-Id: I26dd69d0c95e6d73f9fdf7031f3c1dbf3becbb79 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-08-26Use JUnit4 for testsChris Aniszczyk5-36/+36
We should use JUnit4 for tests. This patch updates the MANIFEST.MF and respective launch configurations. Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2010-08-26Fix parsing of multiple authors in PersonIdent.Marc Strapetz4-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
2010-08-26Increase temporary buffer for unit testShawn O. Pearce1-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>
2010-08-26Support parsing commit:path style blob referencesShawn O. Pearce1-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>
2010-08-26Support parsing git describe style outputShawn O. Pearce1-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>
2010-08-26Rename T0008_testparserev to RepositoryResolveTestShawn O. Pearce1-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>
2010-08-26Throw AmbiguousObjectException during resolve if its ambiguousShawn O. Pearce1-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>
2010-08-26Add brute force byte array loading to ObjectLoaderShawn O. Pearce1-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>
2010-08-25Fix ObjectDirectory abbreviation resolution to notice new packsShawn O. Pearce1-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>
2010-08-23Fully implement SHA-1 abbreviationsShawn O. Pearce3-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>
2010-08-23Delete deprecated ObjectWriterShawn O. Pearce9-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>
2010-08-23Move commit and tag formatting to CommitBuilder, TagBuilderShawn O. Pearce5-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>
2010-08-23Rename Commit, Tag to CommitBuilder, TagBuilderShawn O. Pearce6-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>
2010-08-21Perform automatic CRLF to LF conversion during WorkingTreeIteratorMarc Strapetz4-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>
2010-08-21Add a public RevTag.parse() methodShawn O. Pearce1-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>
2010-08-21Add a public RevCommit.parse() methodShawn O. Pearce1-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>
2010-08-21Make Tag class only for writingShawn O. Pearce1-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>

Back to the top