aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Update Tag to use TagCommand APIChris Aniszczyk2010-09-221-55/+11
| | | | | Change-Id: I4f7f8e29c47980536398d73f2a71ed2b2c00f4f2 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Remove unnecessary hash cache from PatienceDiffIndexShawn O. Pearce2010-09-211-40/+15
| | | | | | | | | | PatienceDiff always uses a HashedSequence, which promises to provide constant time access for hash codes during the equals method and aborts fast if the hash codes don't match. Therefore we don't need to cache the hash codes inside of the index, saving us memory. Change-Id: I80bf1e95094b7670e6c0acc26546364a1012d60e Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Implement Bram Cohen's Patience DiffShawn O. Pearce2010-09-204-0/+925
| | | | | Change-Id: Ic7a76df2861ea6c569ab9756a62018987912bd13 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Move cached element hash codes to HashedSequenceShawn O. Pearce2010-09-207-49/+306
| | | | | | | | | | | | | | | | | | Most diff implementations really want to use cached hash codes for elements, rather than element equality, as they need to perform many compares and unique hash codes for elements can really speed that process up. To make it easier to define element hash functions, move the caching of hash codes into a wrapper sequence type, so that individual sequence types like RawText don't need to do this themselves. This has a nice property of also allowing the sequence to no longer care about the specific SequenceComparator that is going to be used, and permits the caching to only examine the middle region that isn't common to the two inputs. Change-Id: If8623556da9419117b07c5073e8bce39de02570e Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Micro-optimize reduceCommonStartEnd for RawTextShawn O. Pearce2010-09-202-0/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a faster exact match based form that tries to improve performance for the common case of the header and trailer of a text file not changing at all. After this fast path we use the slower path based on the super class' using equals() to allow for whitespace ignore modes to still work. Some simple performance testing showed a major improvement over the older implementation for a common edit we see in JGit. The test compared blob 29a89bc and 372a978, which is the ObjectDirectory.java file difference in commit 41dd9ed1c054f9f9e1ab52fc7bbf1a55a56cf543. The two text files are approximately 22 KiB in size. DEFAULT old 203900 ns DEFAULT new 100400 ns This new version is 2x faster for the DEFAULT comparator, which does not treat space specially. This is because we can now examine a larger swath of text with fewer instructions per byte compared. The older algorithm had to stop at each line break and recompute how to examine the next line, while the new algorithm only stops when the first difference is found. WS_IGNORE_ALL old 298500 ns WS_IGNORE_ALL new 63300 ns Its 4.7x faster for the whitespace ignore comparator, as the common header and footer do not have a whitespace difference. Avoiding the special case handling for whitespace on each byte considered saves a lot of time. Since most edits to source code (and other text like files) appears in the interior of the file, fast elimination of common header/footer means faster diff throughput. In the less common case of an actual header or footer edit, the common header/footer elimination is stopped rather quickly either way, so there is very little downside to the optimiation applied here. Change-Id: I1d501b4c3ff80ed086b20bf12faf51ae62167db7 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add Subsequence utility methodsShawn O. Pearce2010-09-201-0/+75
| | | | | | | | | | | | | | | | DiffAlgorithm implementations may find it useful to construct an Edit and use that to later subsequence the two base sequences, so define two new utility methods a() and b() to construct the A and B ranges. Once a subsequence has had Edits created for it the indexes are within the space of the subsequence. These must be shifted back to the original base sequence's indexes. Define toBase() as a utility method to perform that shifting work in-place, so DiffAlgorithm implementations have an efficient way to convert back to the caller's original space. Change-Id: I8d788e4d158b9f466fa9cb4a40865fb806376aee Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Remove duplicate resource bundle entryMatthias Sohn2010-09-191-1/+0
| | | | Change-Id: Ifdf9fa5dd49bc3f4a0cc8a1ed505d77ec3fa526b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix dependency to jgit source bundleMatthias Sohn2010-09-171-1/+1
| | | | | | | Missed to update version from 0.9.4 to 0.10.0 Change-Id: I50e4955141ef9dd0e1293f8c8c2c0dc7c3c7fd3f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge "Define a subsequence utility type"Chris Aniszczyk2010-09-172-0/+167
|\
| * Define a subsequence utility typeShawn O. Pearce2010-09-102-0/+167
| | | | | | | | | | | | | | | | | | A diff algorithm may find this type useful if it wants to delegate a particular range of elements to another algorithm, without changing the underlying sequence types. Change-Id: I4544467781233e21ac8b35081304b2bad7db00f6 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Merge "Define DiffAlgorithm as an abstract function"Chris Aniszczyk2010-09-177-19/+112
|\|
| * Define DiffAlgorithm as an abstract functionShawn O. Pearce2010-09-107-19/+112
| | | | | | | | | | | | | | | | This makes it easier to parametrize DiffFormatter with a different implementation, as we later plan to add PatienceDiff to JGit. Change-Id: Id35ef478d5fa20fe10a1ba297f9436fd7adde9ce Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Add FetchCommandChris Aniszczyk2010-09-176-0/+435
| | | | | | | | | | | | | | Adds API for performing git fetch operations. Change-Id: Idd95664fd4e3bca03211e4ffda3e354849f92a35 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Fix UnsupportedOperationException while fixing thin packShawn O. Pearce2010-09-171-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | If a thin pack has a large delta we need to be able to open its cached copy from the loose object directory through the CachedObjectDatabase handle. Unfortunately that did not support the openObject2 method, which the LargePackedDeltaObject used directly to bypass looking at the pack files. Bug: 324868 Change-Id: I1d5886a6c3254c6dea2852d50b8614c31a93e615 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Merge "Remove unnecessary failing test method"Shawn Pearce2010-09-171-11/+0
|\ \
| * | Remove unnecessary failing test methodStefan Lay2010-09-171-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Method test006_readCaseInsensitive in TestConfig already does the same thing, and doesn't require an OS specific test for the value being asserted. This is additionally a fast fix for the failing JUnit test after change 3fe5276. Change-Id: I96d2794dbc7db55bdd0fbfcf675aabb15cc8419f Signed-off-by: Stefan Lay <stefan.lay@sap.com>
* | | Merge "Probe filesystem and set core.filemode correctly"Stefan Lay2010-09-171-1/+17
|\| |
| * | Probe filesystem and set core.filemode correctlyShawn O. Pearce2010-09-151-1/+17
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When creating a new FileRepository, probe the capability of the local filesystem and set core.filemode based on how it reacts. We can't just rely on FS.supportsExecute() because a POSIX system (which usually does support execute) might be storing the repository on a partition that doesn't have execute support (e.g. plain FAT-32). Creating a temporary file, setting both states, checking we get the desired results will let us set the variable correctly on all systems. Change-Id: I551488ea8d352d2179c7b244f474d2e3d02567a2 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Qualify builds as 0.10.0Shawn O. Pearce2010-09-1627-167/+167
| | | | | | | | | | Change-Id: I54815c85b32b9492c059064b39f48677e68c5e90 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Merge branch 'stable-0.9'Shawn O. Pearce2010-09-1635-203/+617
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-0.9: Qualify post-0.9.3 builds JGit 0.9.3 clone: Correct formatting of init message Fix cloning of repositories with big objects Qualify post-0.9.1 builds JGit 0.9.1 Fix PlotCommitList to set lanes on child-less commits
| * | Qualify post-0.9.3 buildsstable-0.9Matthias Sohn2010-09-1627-168/+168
| | | | | | | | | | | | | | | Change-Id: Ideab4923a5d8055f0e8a36ddcf0bc8adbf71c329 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | JGit 0.9.3v0.9.3Matthias Sohn2010-09-1627-168/+168
| | | | | | | | | | | | | | | Change-Id: I114106f3286c36f7d5e136748a7e5130f4da163f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | Merge "Qualify post-0.9.1 builds" into stable-0.9Chris Aniszczyk2010-09-1527-168/+168
| |\ \
| | * | Qualify post-0.9.1 buildsMatthias Sohn2010-09-1527-168/+168
| | | | | | | | | | | | | | | | | | | | Change-Id: I07a3391de03379f32ecfd055d45750e3860b2be4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | | clone: Correct formatting of init messageShawn O. Pearce2010-09-152-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We used the wrong format method, which lead to this confusing output: $ ./jgit clone git://... Initialized empty Git repository in {0} remote: Counting objects: 201783 ... remote: {0} We need to use MessageFormat.format() as the message translations use {0} syntax and not %s syntax for placeholders. Change-Id: I8bf0fd3f7dbecf9edf47419c46aed0493d405f9e Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
| * | | Fix cloning of repositories with big objectsShawn O. Pearce2010-09-154-16/+54
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running IndexPack we use a CachedObjectDirectory, which knows what objects are loose and tries to avoid stat(2) calls for objects that do not exist in the repository, as stat(2) on Win32 is very slow. However large delta objects found in a pack file are expanded into a loose object, in order to avoid costly delta chain processing when that object is used as a base for another delta. If this expand occurs while working with the CachedObjectDirectory, we need to update the cached directory data to include this new object, otherwise it won't be available when we try to open it during the object verify phase. Bug: 324868 Change-Id: Idf0c76d4849d69aa415ead32e46a435622395d68 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
| * | JGit 0.9.1v0.9.1Matthias Sohn2010-09-1527-168/+168
| | | | | | | | | | | | | | | Change-Id: Ic411b1b8a7e6039ae3ff567e2c9cdd5db84f4d41 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | Fix PlotCommitList to set lanes on child-less commitsChristian Halstrick2010-09-142-15/+385
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Add --all option to RevWalkTextBuiltinChristian Halstrick2010-09-161-0/+17
| |/ |/| | | | | | | | | | | | | Allow our command line commands like Glog, Log to accept the --all option to walk all known refs. Change-Id: I6a0c84fc19e7fa80ddaa2315851c58ba89d43ca5 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | Merge branch 'stable-0.9'Shawn O. Pearce2010-09-101-1/+1
|\| | | | | | | | | * stable-0.9: Correct Javadoc for WS_IGNORE_CHANGE comparator
| * Correct Javadoc for WS_IGNORE_CHANGE comparatorShawn O. Pearce2010-09-101-1/+1
| | | | | | | | | | Change-Id: I8aa1e7c7ae192ed28b2c8aaa3c5884b7b4666e9c Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Allow ../relative paths in remotesChris West (Faux)2010-09-102-1/+16
|/ | | | | | | | | git allows remotes to be relative paths, but the regex validating urls wouldn't accept anything starting with "..". Other functionality works fine with these paths. Bug: 311300 Change-Id: Ib74de0450a1c602b22884e19d994ce2f52634c77
* Merge changes I3668a396,I18f48321,I121f356cMatthias Sohn2010-09-0910-192/+402
|\ | | | | | | | | | | | | * changes: Unpack and cache large deltas as loose objects Remember loose objects and fast-track their lookup Correctly name DeltaBaseCache
| * Unpack and cache large deltas as loose objectsShawn O. Pearce2010-09-075-61/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of spooling large delta bases into temporary files and then immediately deleting them afterwards, spool the large delta out to a normal loose object. Later any requests for that large delta can be answered by reading from the loose object, which is much easier to stream efficiently for readers. Since the object is now duplicated, once in the pack as a delta and again as a loose object, any future prune-packed will automatically delete the loose object variant, releasing the wasted disk space. As prune-packed is run automatically during either repack or gc, and gc --auto triggers automatically based on the number of loose objects, we get automatic cache management for free. Large objects that were unpacked will be periodically cleared out, and will simply be restored later if they are needed again. After a short offline discussion with Junio Hamano today, we may want to propose a change to prune-packed to hold onto larger loose objects which also exist in pack files as deltas, if the loose object was recently accessed or modified in the last 2 days. Change-Id: I3668a3967c807010f48cd69f994dcbaaf582337c Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
| * Remember loose objects and fast-track their lookupShawn O. Pearce2010-09-073-2/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recently created objects are usually what branches point to, and are usually written out as loose objects. But due to the high cost of asking the operating system if a file exists, these are the last thing that ObjectDirectory examines when looking for an object by its ObjectId. Caching recently seen loose objects permits the opening code to jump directly to the loose object, accelerating lookup for branch heads that are accessed often. To avoid exploding the cache its limited to approximately 2048 entries. When more ids are added, the table is simply cleared and reset in size. Change-Id: I18f483217412b102f754ffd496c87061d592e535 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
| * Correctly name DeltaBaseCacheShawn O. Pearce2010-09-074-16/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class is used only to cache the unpacked form of an object that was used as a base for another object. The theory goes that if an object is used as a delta base for A, it will probably also be a delta base for B, C, D, E, etc. and therefore having an unpacked copy of it on hand will make delta resolution for the others very fast. However since objects are usually only accessed once, we don't want to cache everything we unpack, just things that we are likely to need again. The only things we need again are the delta bases. Hence, its a delta base cache. This gets us the class name UnpackedObjectCache back, so we can use it to actually create a cache of unpacked object information. Change-Id: I121f356cf4eca7b80126497264eac22bd5825a1d Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Update .eclipse_iplog for 0.9Matthias Sohn2010-09-081-0/+5
|/ | | | Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Support core.autocrlf = inputShawn O. Pearce2010-09-079-11/+187
| | | | | | | | | | | | | | 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>
* Refactor diff sequence APIShawn O. Pearce2010-09-0626-688/+573
| | | | | | | | | | | | | | | 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>
* Merge "Reduce compares in Edit.getType"Chris Aniszczyk2010-09-061-7/+12
|\
| * Reduce compares in Edit.getTypeShawn O. Pearce2010-09-031-7/+12
| | | | | | | | | | | | | | | | | | | | We can slightly optimize this method by removing some compares based on knowledge of how the orderings have to work. This way a getType() invocation requires at most 2 int compares for any result, vs. the 6 required to find REPLACE before. Change-Id: I62a04cc513a6d28c300d1c1496a8608d5df4efa6 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Fix checkReferencedIsReachable to use correct base listShawn O. Pearce2010-09-063-14/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Discard object bodies when checking connectivityShawn O. Pearce2010-09-061-0/+2
| | | | | | | | | | | | | | | | | | | | Since we are only checking the links between objects we don't need to hold onto commit messages after their headers have been parsed by the walker. Dropping them saves a bit of memory, which is always good when accepting huge pack files. Change-Id: I378920409b6acf04a35cdf24f81567b1ce030e36 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | DeltaStream: Fix data corruption when reading large copiesShawn O. Pearce2010-09-062-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Use 8192 as default buffer size in ObjectLoader copyToShawn O. Pearce2010-09-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As ObjectStreams are supposed to be buffered, most implementors will be wrapping their underlying stream inside of a BufferedInputStream in order to satisfy this requirement. Because developers are by nature lazy, they will use the default buffer size rather than specify their own. The OpenJDk JRE implementations use 8192 as the default buffer size, and when the higher level reader uses the same buffer size the buffers "stack" nicely by avoiding a copy to the internal buffer array. As OpenJDK is a popular virtual machine, we should try to benefit from this nice stacking property during copyTo(). Change-Id: I69d53f273b870b841ced2be2e9debdfd987d98f4 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Merge "Add helper methods to Edit"Chris Aniszczyk2010-09-062-1/+65
|\|
| * Add helper methods to EditShawn O. Pearce2010-09-032-1/+65
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge "log: Fix commit headers and -p flag"Shawn O. Pearce2010-09-061-1/+1
|\|
| * log: Fix commit headers and -p flagShawn O. Pearce2010-09-031-1/+1
| | | | | | | | | | | | | | | | | | We weren't flushing the commit message before the diff output, which meant the headers and message showed randomly interleaved with the diff rather than immediately before. Change-Id: I6cefab8d40e9d40c937e9deb12911188fec41b26 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Merge "Use 5 MiB for RevWalk default limit"Shawn O. Pearce2010-09-062-27/+3
|\ \