]> source.dussan.org Git - jgit.git/log
jgit.git
14 years agoFixed URI regexp regarding user/password part 02/1702/4
Christian Halstrick [Wed, 6 Oct 2010 13:43:42 +0000 (15:43 +0200)]
Fixed URI regexp regarding user/password part

The regular expression which should handle the
user/password part in an URI was potentially
processing too many chars. This led to problems
when user/pwd and port was specified

Change-Id: I87db02494c4b367283e1d00437b1c06d2c8fdd28
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoFix URIish tests to contain a hostname for git protocol 01/1701/3
Christian Halstrick [Wed, 6 Oct 2010 13:21:01 +0000 (15:21 +0200)]
Fix URIish tests to contain a hostname for git protocol

URIs for the git protocol have to have a hostname.
(see http://www.kernel.org/pub/software/scm/git/docs
/git-clone.html#_git_urls_a_id_urls_a) Some tests tested
URIs like git:/abc.git which is not allowed. Fixed this.

Change-Id: Ia3b8b681ad6592f03b090a874a6e91068a8301fe
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
14 years agoIntroduce commented constants for the segments of an URI regex 00/1700/3
Christian Halstrick [Wed, 6 Oct 2010 12:02:05 +0000 (14:02 +0200)]
Introduce commented constants for the segments of an URI regex

The regular expressions used to parse URI's are constructed by
concatenating different segments to a big String. Introduce
String constants for these segements and document them.

Change-Id: If8b9dbaaf57ca333ac0b6c9610c3d3a515c540f9
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
14 years agoExternalize strings in TransportHttp 10/1710/1
Matthias Sohn [Thu, 7 Oct 2010 22:03:17 +0000 (01:03 +0300)]
Externalize strings in TransportHttp

Some strings were not externalized. Also use them in HTTP tests to
ensure that they will also succeed when message bundles are
translated.

Change-Id: Id02717176557e7d57e676e1339cd89f2be88d330
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoFix HTTP tests 09/1709/1
Matthias Sohn [Thu, 7 Oct 2010 20:40:40 +0000 (23:40 +0300)]
Fix HTTP tests

Since 858b2c92 we have a HTTP authentication implementation hence
we now get different exception messages when required authentication
headers are not available. This broke the HTTP tests.

Change-Id: Ie08c1ec37e497c2a6f70a75f7c59f0805812a5cc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoMerge "Support HTTP basic and digest authentication"
Chris Aniszczyk [Thu, 7 Oct 2010 16:25:15 +0000 (12:25 -0400)]
Merge "Support HTTP basic and digest authentication"

14 years agoSplit URI regex strings differently 99/1699/2
Christian Halstrick [Wed, 6 Oct 2010 10:15:30 +0000 (12:15 +0200)]
Split URI regex strings differently

The strings used to construct the regex to parse
URIs are split differently. This makes it easier
to introduce meaningful String constants later on.

Change-Id: I9355fd42e57e0983204465c5d6fe5b6b93655074
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
14 years agoAdd pull operation related constants 06/1706/1
Chris Aniszczyk [Wed, 6 Oct 2010 16:46:13 +0000 (11:46 -0500)]
Add pull operation related constants

Change-Id: Idb7526800e80e17624ec05fb10bbc19e7f744f49
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agoAdd PushCommand API 72/1672/3
Chris Aniszczyk [Tue, 28 Sep 2010 14:54:44 +0000 (09:54 -0500)]
Add PushCommand API

Change-Id: Iff144a51fdc9a1112a21492c390a873a2b293bc9
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agoIncrease core.streamFileThreshold default to 50 MiB 10/1610/2
Shawn O. Pearce [Fri, 17 Sep 2010 00:02:27 +0000 (17:02 -0700)]
Increase core.streamFileThreshold default to 50 MiB

Projects like org.eclipse.mdt contain large XML files about 6 MiB
in size.  So does the Android project platform/frameworks/base.
Doing a clone of either project with JGit takes forever to checkout
the files into the working directory, because delta decompression
tends to be very expensive as we need to constantly reposition the
base stream for each copy instruction.  This can be made worse by
a very bad ordering of offsets, possibly due to an XML editor that
doesn't preserve the order of elements in the file very well.

Increasing the threshold to the same limit PackWriter uses when
doing delta compression (50 MiB) permits a default configured
JGit to decompress these XML file objects using the faster
random-access arrays, rather than re-seeking through an inflate
stream, significantly reducing checkout time after a clone.

Since this new limit may be dangerously close to the JVM maximum
heap size, every allocation attempt is now wrapped in a try/catch
so that JGit can degrade by switching to the large object stream
mode when the allocation is refused.  It will run slower, but the
operation will still complete.

The large stream mode will run very well for big objects that aren't
delta compressed, and is acceptable for delta compressed objects that
are using only forward referencing copy instructions.  Copies using
prior offsets are still going to be horrible, and there is nothing
we can do about it except increase core.streamFileThreshold.

We might in the future want to consider changing the way the delta
generators work in JGit and native C Git to avoid prior offsets once
an object reaches a certain size, even if that causes the delta
instruction stream to be slightly larger.  Unfortunately native
C Git won't want to do that until its also able to stream objects
rather than malloc them as contiguous blocks.

Change-Id: Ief7a3896afce15073e80d3691bed90c6a3897307
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agoMerge "Update Fetch to use FetchCommand API"
Chris Aniszczyk [Fri, 1 Oct 2010 16:02:25 +0000 (12:02 -0400)]
Merge "Update Fetch to use FetchCommand API"

14 years agoMerge "Add reflog message to TagCommand"
Chris Aniszczyk [Wed, 29 Sep 2010 14:09:43 +0000 (10:09 -0400)]
Merge "Add reflog message to TagCommand"

14 years agoComment the use of System.gc in LocalDiskRepositoryTestCase 66/1666/2
Robin Rosenberg [Thu, 9 Sep 2010 22:42:07 +0000 (00:42 +0200)]
Comment the use of System.gc in LocalDiskRepositoryTestCase

Change-Id: Ic5e9bda4275006ef3bf6ea6255ddf1c0eecc3770
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
14 years agoShut up findbugs/protect the shutdownHook in LocalDiskRepositoryTestcase 65/1665/2
Robin Rosenberg [Thu, 9 Sep 2010 22:38:58 +0000 (00:38 +0200)]
Shut up findbugs/protect the shutdownHook in LocalDiskRepositoryTestcase

Singleton references should be protected from multiple threads. As far as we
know this cannot happen as JUnit is used today since we currently don't run
tests in parallel, but now this code will not prevent anyone.

Change-Id: I29109344d2e8025fa2a3ccaf7c2c16469544ce05
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
14 years agoSupport HTTP basic and digest authentication 70/1670/1
Shawn O. Pearce [Sun, 21 Mar 2010 04:04:33 +0000 (21:04 -0700)]
Support HTTP basic and digest authentication

Natively support the HTTP basic and digest authentication methods
by setting the Authorization header without going through the JREs
java.net.Authenticator API.  The Authenticator API is difficult to
work with in a multi-threaded server environment, where its using
a singleton for the entire JVM.  Instead compute the Authorization
header from the URIish user and pass, if available.

Change-Id: Ibf83fea57cfb17964020d6aeb3363982be944f87
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoMerge "Use only a single instance for NLS translation bundles"
Chris Aniszczyk [Mon, 27 Sep 2010 21:59:36 +0000 (17:59 -0400)]
Merge "Use only a single instance for NLS translation  bundles"

14 years agoUpdate Fetch to use FetchCommand API 69/1669/2
Chris Aniszczyk [Fri, 24 Sep 2010 20:23:34 +0000 (15:23 -0500)]
Update Fetch to use FetchCommand API

Change-Id: I06ddc74f1ef658f4876e2bbcc3eaad3475a5371e
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agoMerge "Update FetchCommand with dry run and thin options"
Chris Aniszczyk [Mon, 27 Sep 2010 14:07:49 +0000 (10:07 -0400)]
Merge "Update FetchCommand with dry run and thin options"

14 years agoReturn the documented value from DirCacheCheckout.checkout 67/1667/2
Robin Rosenberg [Thu, 9 Sep 2010 22:55:29 +0000 (00:55 +0200)]
Return the documented value from DirCacheCheckout.checkout

Change-Id: I34d773b18e6a1ee05774d7b9471f9915c48aa63e
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
14 years agoMerge "Extend merge support for bare repositories"
Christian Halstrick [Mon, 27 Sep 2010 08:46:06 +0000 (04:46 -0400)]
Merge "Extend merge support for bare repositories"

14 years agoUse only a single instance for NLS translation bundles 64/1664/1
Robin Rosenberg [Thu, 9 Sep 2010 22:11:53 +0000 (00:11 +0200)]
Use only a single instance for NLS translation  bundles

As findbugs pointed out, there was a small risk for creating multiple instances of
translation bundles. If that happens, drop the second instance.

Change-Id: I3aacda86251d511f6bbc2ed7481d561449ce3b6c
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
14 years agoImplement HistogramDiff 43/1643/5
Shawn O. Pearce [Tue, 21 Sep 2010 20:41:47 +0000 (13:41 -0700)]
Implement HistogramDiff

HistogramDiff is an alternative implementation of patience diff,
performing a search over all matching locations and picking the
longest common subsequence that has the lowest occurrence count.
If there are unique common elements, its behavior is identical to
that of patience diff.

Actual performance on real-world source files usually beats
MyersDiff, sometimes by a factor of 3, especially for complex
comparators that ignore whitespace.

Change-Id: I1806cd708087e36d144fb824a0e5ab7cdd579d73
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoReuse DiffPerformanceTest support code to validate algorithms 41/1641/6
Shawn O. Pearce [Tue, 21 Sep 2010 21:47:33 +0000 (14:47 -0700)]
Reuse DiffPerformanceTest support code to validate algorithms

Each algorithm should produce a particular number of results
given one of the standard inputs used during the performance
tests.  To help ensure those tests are accurate, assert that
the edit list length is correct.

Change-Id: I292f8fde0cec6a60a75ce09e70814a00ca47cb99
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMicro-optimize EditList.addAll 42/1642/3
Shawn O. Pearce [Tue, 21 Sep 2010 15:23:12 +0000 (08:23 -0700)]
Micro-optimize EditList.addAll

Pass through the addAll request to our underlying ArrayList.

This way the underlying ArrayList grows no more than once during the
call, which may be important if the list was originally allocated
at the default size of 16, but 64 Edits are being added.

Change-Id: I31c3261e895766f82c3c832b251a09f6e37e8860
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoUpdate FetchCommand with dry run and thin options 61/1661/2
Chris Aniszczyk [Fri, 24 Sep 2010 20:32:36 +0000 (15:32 -0500)]
Update FetchCommand with dry run and thin options

FetchCommand was missing the ability to set dry run and thin
preferences on the transport operation.

Change-Id: I0bef388a9b8f2e3a01ecc9e7782aaed7f9ac82ce
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agodebug-text-hashfunctions: Test suite for content hashes 60/1660/1
Shawn O. Pearce [Fri, 24 Sep 2010 19:49:29 +0000 (12:49 -0700)]
debug-text-hashfunctions: Test suite for content hashes

This is the test suite I was using to help understand why we had
such a high collision rate with RawTextComparator, and to select
a replacement function.

Since its not something we will run very often, lets make it a
program in the debug package rather than a JUnit test.  This way
we can run it on demand against any corpus of files we choose,
but we aren't bottlenecking our daily builds running tests with
no assertions.

Adding a new hash function to this suite is simple, just define
a new instance member of type "Hash" with the logic applied to
the region passed in.

Change-Id: Iec0b176adb464cf95b06cda157932b79c0b59886
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoExtend merge support for bare repositories 29/1629/5
Dmitry Fink [Tue, 21 Sep 2010 16:37:01 +0000 (09:37 -0700)]
Extend merge support for bare repositories

Optional inCore parameter to Resolver/Strategy will
instruct it to perform all the operations in memory
and avoid modifying working folder even if there is one.

Change-Id: I5b873dead3682f79110f58d7806e43f50bcc5045

14 years agoReduce content hash function collisions 56/1656/1
Shawn O. Pearce [Fri, 24 Sep 2010 00:13:20 +0000 (17:13 -0700)]
Reduce content hash function collisions

The hash code returned by RawTextComparator (or that is used
by the SimilarityIndex) play an important role in the speed of
any algorithm that is based upon them.  The lower the number of
collisions produced by the hash function, the shorter the hash
chains within hash tables will be, and the less likely we are to
fall into O(N^2) runtime behaviors for algorithms like PatienceDiff.

Our prior hash function was absolutely horrid, so replace it with
the proper definition of the DJB hash that was originally published
by Professor Daniel J. Bernstein.

To support this assertion, below is a table listing the maximum
number of collisions that result when hashing the unique lines in
each source code file of 3 randomly chosen projects:

  test_jgit: 931 files; 122 avg. unique lines/file
   Algorithm    | Collisions
   -------------+-----------
   prior_hash            418
   djb                     5
   sha1                    6
   string_hash31          11

  test_linux26: 30198 files; 258 avg. unique lines/file
   Algorithm    | Collisions
   -------------+-----------
   prior_hash           8675
   djb                    32
   sha1                    8
   string_hash31          32

  test_frameworks_base: 8381 files; 184 avg. unique lines/file
   Algorithm    | Collisions
   -------------+-----------
   prior_hash           4615
   djb                    10
   sha1                    6
   string_hash31          13

We can clearly see that prior_hash performed very poorly, resulting
in 8,675 collisions (elements in the same hash bucket) for at least
one file in the Linux kernel repository.  This leads to some very
bad O(N) style insertion and lookup performance, even though the
hash table was sized to be the next power-of-2 larger than the
total number of unique lines in the file.

The djb hash we are replacing prior_hash with performs closer to
SHA-1 in terms of having very few collisions.  This indicates it
provides a reasonably distributed output for this type of input,
despite being a much simpler algorithm (and therefore will be much
faster to execute).

The string_hash31 function is provided just to compare results with,
it is the algorithm commonly used by java.lang.String hashCode().

However, life isn't quite this simple.

djb produces a 32 bit hash code, but our hash tables are always
smaller than 2^32 buckets.  Mashing the 32 bit code into an array
index used to be done by simply taking the lower bits of the hash
code by a bitwise and operator.  This unfortuntely still produces
many collisions, e.g. 32 on the linux-2.6 repository files.

From [1] we can apply a final "cleanup" step to the hash code to
mix the bits together a little better, and give priority to the
higher order bits as they include data from more bytes of input:

  test_jgit: 931 files; 122 avg. unique lines/file
   Algorithm    | Collisions
   -------------+-----------
   prior_hash            418
   djb                     5
   djb + cleanup           6

  test_linux26: 30198 files; 258 avg. unique lines/file
   Algorithm    | Collisions
   -------------+-----------
   prior_hash           8675
   djb                    32
   djb + cleanup           7

  test_frameworks_base: 8381 files; 184 avg. unique lines/file
   Algorithm    | Collisions
   -------------+-----------
   prior_hash           4615
   djb                    10
   djb + cleanup           7

This is a massive improvement, as the number of collisions for
common inputs drops to acceptable levels, and we haven't really
made the hash functions any more complex than they were before.

[1] http://lkml.org/lkml/2009/10/27/404

Change-Id: Ia753b695de9526a157ddba265824240bd05dead1
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoFix PatienceDiffTest 55/1655/1
Shawn O. Pearce [Thu, 23 Sep 2010 21:45:07 +0000 (14:45 -0700)]
Fix PatienceDiffTest

Because PatienceDiff works by looking for common unique lines within
the region, the DiffTestDataGenerator needs to be modified to produce
a unique character for each region.  If we don't give PatienceDiff
a few unique points, it will just offer back a single REPLACE edit
that covers the entire files, and this doesn't tell us very much.

Change-Id: I5129faea1e763c74739118ca20d86bd62e0deaef
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoAdd reflog message to TagCommand 48/1648/1
Chris Aniszczyk [Wed, 22 Sep 2010 15:47:44 +0000 (10:47 -0500)]
Add reflog message to TagCommand

Ensure we update the reflog when tagging.

Change-Id: I3f4a4d68cbfc62d2276e3a47e3e3720f02cb2522
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agoDefine an abstract DiffAlgorithm test framework 40/1640/2
Shawn O. Pearce [Tue, 21 Sep 2010 16:24:12 +0000 (09:24 -0700)]
Define an abstract DiffAlgorithm test framework

For certain tiny input sequences, every DiffAlgorithm should produce
exactly the same results, as there should be no ambiguity.  Package
these up in an abstract TestCase that algorithms can extend from in
order to perform basic validation of their implementation.

Since these tests are more complete than what we used to have for
the MyersDiff algorithm, throw away Johannes' tests and only use
this new package.

Change-Id: I9a044330887c849ad4c78aa5c7aa04c783c10252
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoPerform common start/end elimination by default for DiffAlgorithm 39/1639/2
Shawn O. Pearce [Tue, 21 Sep 2010 15:12:51 +0000 (08:12 -0700)]
Perform common start/end elimination by default for DiffAlgorithm

As it turns out, every single diff algorithm we might try to
implement can benfit from using the SequenceComparator's native
concept of the simple reduceCommonStartEnd() step.  For most inputs,
there can be a significant number of elements that can be removed
from the space the DiffAlgorithm needs to consider, which will
reduce the overall running time for the final solution.

Pool this logic inside of DiffAlgorithm itself as a default, but
permit a specific algorithm to override it when necessary.

Convert MyersDiff to use this reduction to reduce the space it
needs to search, making it perform slightly better on common inputs.

Change-Id: I14004d771117e4a4ab2a02cace8deaeda9814bc1
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoRemove unnecessary hash cache from PatienceDiffIndex 38/1638/2
Shawn O. Pearce [Tue, 21 Sep 2010 20:53:56 +0000 (13:53 -0700)]
Remove unnecessary hash cache from PatienceDiffIndex

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>
14 years agoImplement Bram Cohen's Patience Diff 99/1499/10
Shawn O. Pearce [Thu, 2 Sep 2010 21:41:15 +0000 (14:41 -0700)]
Implement Bram Cohen's Patience Diff

Change-Id: Ic7a76df2861ea6c569ab9756a62018987912bd13
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMove cached element hash codes to HashedSequence 85/1585/2
Shawn O. Pearce [Sat, 11 Sep 2010 00:48:24 +0000 (17:48 -0700)]
Move cached element hash codes to HashedSequence

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>
14 years agoMicro-optimize reduceCommonStartEnd for RawText 86/1586/3
Shawn O. Pearce [Sat, 11 Sep 2010 05:14:57 +0000 (22:14 -0700)]
Micro-optimize reduceCommonStartEnd for RawText

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>
14 years agoAdd Subsequence utility methods 35/1635/1
Shawn O. Pearce [Tue, 21 Sep 2010 01:04:00 +0000 (18:04 -0700)]
Add Subsequence utility methods

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>
14 years agoRemove duplicate resource bundle entry 28/1628/1
Matthias Sohn [Sun, 19 Sep 2010 06:36:52 +0000 (08:36 +0200)]
Remove duplicate resource bundle entry

Change-Id: Ifdf9fa5dd49bc3f4a0cc8a1ed505d77ec3fa526b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoFix dependency to jgit source bundle 20/1620/1
Matthias Sohn [Fri, 17 Sep 2010 19:58:26 +0000 (21:58 +0200)]
Fix dependency to jgit source bundle

Missed to update version from 0.9.4 to 0.10.0

Change-Id: I50e4955141ef9dd0e1293f8c8c2c0dc7c3c7fd3f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoMerge "Define a subsequence utility type"
Chris Aniszczyk [Fri, 17 Sep 2010 19:10:15 +0000 (15:10 -0400)]
Merge "Define a subsequence utility type"

14 years agoMerge "Define DiffAlgorithm as an abstract function"
Chris Aniszczyk [Fri, 17 Sep 2010 19:08:27 +0000 (15:08 -0400)]
Merge "Define DiffAlgorithm as an abstract function"

14 years agoAdd FetchCommand 50/1550/7
Chris Aniszczyk [Tue, 7 Sep 2010 14:21:12 +0000 (09:21 -0500)]
Add FetchCommand

Adds API for performing git fetch operations.

Change-Id: Idd95664fd4e3bca03211e4ffda3e354849f92a35
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
14 years agoFix UnsupportedOperationException while fixing thin pack 19/1619/1
Shawn O. Pearce [Fri, 17 Sep 2010 16:11:26 +0000 (09:11 -0700)]
Fix UnsupportedOperationException while fixing thin pack

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>
14 years agoMerge "Remove unnecessary failing test method"
Shawn Pearce [Fri, 17 Sep 2010 14:28:39 +0000 (10:28 -0400)]
Merge "Remove unnecessary failing test method"

14 years agoRemove unnecessary failing test method 13/1613/2
Stefan Lay [Fri, 17 Sep 2010 14:24:08 +0000 (16:24 +0200)]
Remove unnecessary failing test method

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>
14 years agoMerge "Probe filesystem and set core.filemode correctly"
Stefan Lay [Fri, 17 Sep 2010 13:32:28 +0000 (09:32 -0400)]
Merge "Probe filesystem and set core.filemode correctly"

14 years agoQualify builds as 0.10.0 09/1609/1
Shawn O. Pearce [Fri, 17 Sep 2010 00:26:53 +0000 (17:26 -0700)]
Qualify builds as 0.10.0

Change-Id: I54815c85b32b9492c059064b39f48677e68c5e90
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMerge branch 'stable-0.9' 08/1608/1
Shawn O. Pearce [Fri, 17 Sep 2010 00:22:37 +0000 (17:22 -0700)]
Merge branch 'stable-0.9'

* 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

14 years agoAdd --all option to RevWalkTextBuiltin 87/1587/2
Christian Halstrick [Mon, 13 Sep 2010 07:39:53 +0000 (09:39 +0200)]
Add --all option to RevWalkTextBuiltin

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>
14 years agoQualify post-0.9.3 builds 06/1606/1 stable-0.9
Matthias Sohn [Wed, 15 Sep 2010 23:49:03 +0000 (01:49 +0200)]
Qualify post-0.9.3 builds

Change-Id: Ideab4923a5d8055f0e8a36ddcf0bc8adbf71c329
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoJGit 0.9.3 04/1604/1 v0.9.3
Matthias Sohn [Wed, 15 Sep 2010 23:02:53 +0000 (01:02 +0200)]
JGit 0.9.3

Change-Id: I114106f3286c36f7d5e136748a7e5130f4da163f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoMerge "Qualify post-0.9.1 builds" into stable-0.9
Chris Aniszczyk [Wed, 15 Sep 2010 19:56:53 +0000 (15:56 -0400)]
Merge "Qualify post-0.9.1 builds" into stable-0.9

14 years agoclone: Correct formatting of init message 03/1603/1
Shawn O. Pearce [Wed, 15 Sep 2010 15:44:27 +0000 (08:44 -0700)]
clone: Correct formatting of init message

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>
14 years agoFix cloning of repositories with big objects 02/1602/2
Shawn O. Pearce [Wed, 15 Sep 2010 15:38:02 +0000 (08:38 -0700)]
Fix cloning of repositories with big objects

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>
14 years agoProbe filesystem and set core.filemode correctly 01/1601/1
Shawn O. Pearce [Wed, 15 Sep 2010 14:59:38 +0000 (07:59 -0700)]
Probe filesystem and set core.filemode correctly

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>
14 years agoQualify post-0.9.1 builds 99/1599/1
Matthias Sohn [Wed, 15 Sep 2010 09:31:05 +0000 (11:31 +0200)]
Qualify post-0.9.1 builds

Change-Id: I07a3391de03379f32ecfd055d45750e3860b2be4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoJGit 0.9.1 97/1597/1 v0.9.1
Matthias Sohn [Wed, 15 Sep 2010 07:38:38 +0000 (09:38 +0200)]
JGit 0.9.1

Change-Id: Ic411b1b8a7e6039ae3ff567e2c9cdd5db84f4d41
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoFix PlotCommitList to set lanes on child-less commits 80/1580/5
Christian Halstrick [Tue, 14 Sep 2010 16:19:44 +0000 (18:19 +0200)]
Fix PlotCommitList to set lanes on child-less commits

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>
14 years agoDefine a subsequence utility type 48/1548/2
Shawn O. Pearce [Mon, 6 Sep 2010 21:00:34 +0000 (14:00 -0700)]
Define a subsequence utility type

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>
14 years agoDefine DiffAlgorithm as an abstract function 47/1547/2
Shawn O. Pearce [Mon, 6 Sep 2010 20:33:31 +0000 (13:33 -0700)]
Define DiffAlgorithm as an abstract function

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>
14 years agoMerge branch 'stable-0.9' 84/1584/1
Shawn O. Pearce [Sat, 11 Sep 2010 05:17:50 +0000 (22:17 -0700)]
Merge branch 'stable-0.9'

* stable-0.9:
  Correct Javadoc for WS_IGNORE_CHANGE comparator

14 years agoCorrect Javadoc for WS_IGNORE_CHANGE comparator 83/1583/1
Shawn O. Pearce [Sat, 11 Sep 2010 05:13:30 +0000 (22:13 -0700)]
Correct Javadoc for WS_IGNORE_CHANGE comparator

Change-Id: I8aa1e7c7ae192ed28b2c8aaa3c5884b7b4666e9c
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoAllow ../relative paths in remotes 75/1575/2
Chris West (Faux) [Thu, 9 Sep 2010 00:15:27 +0000 (01:15 +0100)]
Allow ../relative paths in remotes

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

14 years agoMerge changes I3668a396,I18f48321,I121f356c
Matthias Sohn [Thu, 9 Sep 2010 12:29:08 +0000 (08:29 -0400)]
Merge changes I3668a396,I18f48321,I121f356c

* changes:
  Unpack and cache large deltas as loose objects
  Remember loose objects and fast-track their lookup
  Correctly name DeltaBaseCache

14 years agoUpdate .eclipse_iplog for 0.9 67/1567/1
Matthias Sohn [Wed, 8 Sep 2010 21:17:54 +0000 (23:17 +0200)]
Update .eclipse_iplog for 0.9

Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
14 years agoUnpack and cache large deltas as loose objects 56/1556/4
Shawn O. Pearce [Wed, 8 Sep 2010 02:47:23 +0000 (19:47 -0700)]
Unpack and cache large deltas as loose objects

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>
14 years agoRemember loose objects and fast-track their lookup 55/1555/3
Shawn O. Pearce [Wed, 8 Sep 2010 02:16:39 +0000 (19:16 -0700)]
Remember loose objects and fast-track their lookup

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>
14 years agoCorrectly name DeltaBaseCache 54/1554/1
Shawn O. Pearce [Wed, 8 Sep 2010 01:18:55 +0000 (18:18 -0700)]
Correctly name DeltaBaseCache

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>
14 years agoSupport core.autocrlf = input 52/1552/1
Shawn O. Pearce [Wed, 8 Sep 2010 00:14:27 +0000 (17:14 -0700)]
Support core.autocrlf = input

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>
14 years agoRefactor diff sequence API 02/1502/6
Shawn O. Pearce [Thu, 2 Sep 2010 19:53:27 +0000 (12:53 -0700)]
Refactor diff sequence API

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>
14 years agoMerge "Reduce compares in Edit.getType"
Chris Aniszczyk [Tue, 7 Sep 2010 02:33:09 +0000 (22:33 -0400)]
Merge "Reduce compares in Edit.getType"

14 years agoFix checkReferencedIsReachable to use correct base list 45/1545/1
Shawn O. Pearce [Mon, 6 Sep 2010 18:59:23 +0000 (11:59 -0700)]
Fix checkReferencedIsReachable to use correct base list

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>
14 years agoDiscard object bodies when checking connectivity 44/1544/1
Shawn O. Pearce [Mon, 6 Sep 2010 18:36:08 +0000 (11:36 -0700)]
Discard object bodies when checking connectivity

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>
14 years agoDeltaStream: Fix data corruption when reading large copies 43/1543/1
Shawn O. Pearce [Mon, 6 Sep 2010 17:06:37 +0000 (10:06 -0700)]
DeltaStream: Fix data corruption when reading large copies

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>
14 years agoUse 8192 as default buffer size in ObjectLoader copyTo 42/1542/1
Shawn O. Pearce [Mon, 6 Sep 2010 16:59:35 +0000 (09:59 -0700)]
Use 8192 as default buffer size in ObjectLoader copyTo

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>
14 years agoMerge "Add helper methods to Edit"
Chris Aniszczyk [Mon, 6 Sep 2010 17:04:51 +0000 (13:04 -0400)]
Merge "Add helper methods to Edit"

14 years agoMerge "log: Fix commit headers and -p flag"
Shawn O. Pearce [Mon, 6 Sep 2010 16:06:17 +0000 (12:06 -0400)]
Merge "log: Fix commit headers and -p flag"

14 years agoMerge "Use 5 MiB for RevWalk default limit"
Shawn O. Pearce [Mon, 6 Sep 2010 15:37:29 +0000 (11:37 -0400)]
Merge "Use 5 MiB for RevWalk default limit"

14 years agocleanup: Remove unnecessary @SuppressWarnings 34/1534/2
Robin Rosenberg [Sat, 4 Sep 2010 21:58:50 +0000 (23:58 +0200)]
cleanup: Remove unnecessary @SuppressWarnings

Change-Id: I1b239b587e1cc811bbd6e1513b07dc93a891a842
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
14 years agoReduce compares in Edit.getType 11/1511/2
Shawn O. Pearce [Thu, 2 Sep 2010 20:07:23 +0000 (13:07 -0700)]
Reduce compares in Edit.getType

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>
14 years agoAdd helper methods to Edit 01/1501/3
Shawn O. Pearce [Thu, 2 Sep 2010 06:09:48 +0000 (23:09 -0700)]
Add helper methods to Edit

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>
14 years agolog: Fix commit headers and -p flag 29/1529/1
Shawn O. Pearce [Sat, 4 Sep 2010 06:33:28 +0000 (23:33 -0700)]
log: Fix commit headers and -p flag

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>
14 years agoFix QuotedString.GIT_PATH escaping rules 28/1528/1
Shawn O. Pearce [Fri, 3 Sep 2010 20:01:57 +0000 (13:01 -0700)]
Fix QuotedString.GIT_PATH escaping rules

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>
14 years agoRemove costly quoting test in DiffFormatter 27/1527/1
Shawn O. Pearce [Fri, 3 Sep 2010 19:59:53 +0000 (12:59 -0700)]
Remove costly quoting test in DiffFormatter

QuotedString.GIT_PATH returns the input reference exactly if
the string does not require quoting, otherwise it returns a
copy that contains the quotes on either end, plus escapes in
the middle where necessary to meet conventions.

Testing the return against '"' + name + '"' is always false,
because GIT_PATH will never return it that way.  The only way
we have quotes on either end is if there is an escape in the
middle, in which case the string isn't equal anyway.

Change-Id: I4d21d8e5c7da0d7df9792c01ce719548fa2df16b
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMerge branch 'unpack-error' 25/1525/1
Shawn O. Pearce [Fri, 3 Sep 2010 18:09:45 +0000 (11:09 -0700)]
Merge branch 'unpack-error'

* unpack-error:
  ReceivePack: Rethrow exceptions caught during indexing

Change-Id: I0d0239d69cb5cd1a622bdee879978f0299e0ca40

14 years agoReceivePack: Rethrow exceptions caught during indexing 24/1524/1
Shawn O. Pearce [Fri, 3 Sep 2010 16:38:30 +0000 (09:38 -0700)]
ReceivePack: Rethrow exceptions caught during indexing

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>
14 years agoUse 5 MiB for RevWalk default limit 93/1493/3
Shawn O. Pearce [Wed, 1 Sep 2010 21:14:54 +0000 (14:14 -0700)]
Use 5 MiB for RevWalk default limit

Instead of getting the limit from CoreConfig, use the larger of the
reader's limit or 5 MiB, under the assumption that any annotated tag
or commit of interest should be under 5 MiB.  But if a repository
was really insane and had bigger objects, the reader implementation
can set its streaming limit higher in order to allow RevWalk to
still process it.

Change-Id: If2c15235daa3e2d1f7167e781aa83fedb5af9a30
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMove ObjectDirectory streaming limit to WindowCacheConfig 94/1494/3
Shawn O. Pearce [Tue, 31 Aug 2010 20:13:28 +0000 (13:13 -0700)]
Move ObjectDirectory streaming limit to WindowCacheConfig

IDEs like Eclipse offer up the settings in WindowCacheConfig to the
user as a global set of options that are configured for the entire
JVM process, not per-repository, as the cache is shared across the
entire JVM.  The limit on how much we are willing to allocate for
an object buffer is similar to the limit on how much we can use for
data caches, allocating that much space impacts the entire JVM and
not just a single repository, so it should be a global limit.

Change-Id: I22eafb3e223bf8dea57ece82cd5df8bfe5badebc
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agodiff: Default arguments to HEAD, working directory 92/1492/2
Shawn O. Pearce [Wed, 1 Sep 2010 19:29:40 +0000 (12:29 -0700)]
diff: Default arguments to HEAD, working directory

Similar to C Git, default our difference when no trees are given
to us to something that makes a tiny bit of sense to the human.

We also now support the --cached flag, and have its meaning work the
same way as C Git.

Change-Id: I2f19dad4e018404e280ea3e95ebd448a4b667f59
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoSupport creating the working directory difference 91/1491/2
Shawn O. Pearce [Wed, 1 Sep 2010 19:30:11 +0000 (12:30 -0700)]
Support creating the working directory difference

If the iterators passed into a diff formatter are working tree
iterators, we should enable ignoring files that are ignored, as
well as actually pull up the current content from the working tree
rather than getting it from the repository.

Because we abstract away the working directory access logic,
we can now actually support rename detection between the working
directory and the local repository when using a DiffFormatter.
This means its possible for an application to show an unstaged
delete-add pair as a rename if the add path is not ignored.
(Because the ignored file wouldn't show up in our difference output.)

Even more interesting is we can now do rename detection between any
two working trees, if both input iterators are WorkingTreeIterators.

Unfortunately we don't (yet) optimize for comparing the working
tree with the index involved so we can take advantage of cached
stat data to rule out non-dirty paths.

Change-Id: I4c0598afe48d8f99257266bf447a0ecd23ca7f5e
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoFix TreeWalk bug comparing DirCache and WorkingTree with ANY_DIFF 90/1490/2
Shawn O. Pearce [Wed, 1 Sep 2010 19:31:37 +0000 (12:31 -0700)]
Fix TreeWalk bug comparing DirCache and WorkingTree with ANY_DIFF

When comparing a DirCache and a WorkingTree using ANY_DIFF we
sometimes didn't recursive into a subtree of both sides gave us
zeroId() back for the identity of a subtree.  This happens when the
DirCache doesn't have a valid cache tree for the subtree, as then
it uses zeroId() for the ObjectId of the subtree, which then appears
to be equal to the zeroId() of the WorkingTreeIterator's subtree.

We work around this by adding a hasId() method that returns true
only if this iterator has a valid ObjectId.  The idEquals method
on TreeWalk than only performs a compare between two iterators if
both iterators have a valid id.

Change-Id: I695f7fafbeb452e8c0703a05c02921fae0822d3f
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agolog, diff: Add --src-prefix, --dst-prefix, --no-prefix 89/1489/2
Shawn O. Pearce [Wed, 1 Sep 2010 16:34:43 +0000 (09:34 -0700)]
log, diff: Add --src-prefix, --dst-prefix, --no-prefix

Change-Id: I0c7154a51143d56362f12ee4fa93133778d3a9eb
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
14 years agoMove rename detection, path following into DiffFormatter 88/1488/2
Shawn O. Pearce [Wed, 1 Sep 2010 16:23:18 +0000 (09:23 -0700)]
Move rename detection, path following into DiffFormatter

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>
14 years agoMerge "Fix RepositoryState.MERGING"
Chris Aniszczyk [Thu, 2 Sep 2010 16:10:09 +0000 (12:10 -0400)]
Merge "Fix RepositoryState.MERGING"

14 years agoFix RepositoryState.MERGING 09/1509/1
Jens Baumgart [Thu, 2 Sep 2010 16:01:47 +0000 (18:01 +0200)]
Fix RepositoryState.MERGING

canResetHead now returns true.
Resetting mixed / hard works in EGit in merging state.

Change-Id: I1512145bbd831bb9734528ce8b71b1701e3e6aa9
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
14 years agoMerge "Add reset() to AbstractTreeIterator API"
Chris Aniszczyk [Thu, 2 Sep 2010 15:30:31 +0000 (11:30 -0400)]
Merge "Add reset() to AbstractTreeIterator API"

14 years agoMerge "Improve DiffFormatter text file access"
Chris Aniszczyk [Thu, 2 Sep 2010 15:29:58 +0000 (11:29 -0400)]
Merge "Improve DiffFormatter text file access"

14 years agoMerge "Correct diff header formatting"
Chris Aniszczyk [Thu, 2 Sep 2010 15:28:33 +0000 (11:28 -0400)]
Merge "Correct diff header formatting"

14 years agoMerge "Remove duplicated code in DiffFormatter"
Chris Aniszczyk [Thu, 2 Sep 2010 15:20:43 +0000 (11:20 -0400)]
Merge "Remove duplicated code in DiffFormatter"

14 years agoMerge "Adding sorting to LongList"
Christian Halstrick [Thu, 2 Sep 2010 11:53:15 +0000 (07:53 -0400)]
Merge "Adding sorting to LongList"