Commit Graph

1678 Commits

Author SHA1 Message Date
Shawn O. Pearce 6ec6169215 DHT: Replace TinyProtobuf with Google Protocol Buffers
The standard Google distribution of Protocol Buffers in Java is better
maintained than TinyProtobuf, and should be faster for most uses.  It
does use slightly more memory due to many of our key types being
stored as strings in protobuf messages, but this is probably worth the
small hit to memory in exchange for better maintained code that is
easier to reuse in other applications.

Exposing all of our data members to the underlying implementation
makes it easier to develop reporting and data mining tools, or to
expand out a nested structure like RefData into a flat format in a SQL
database table.

Since the C++ `protoc` tool is necessary to convert the protobuf
script into Java code, the generated files are committed as part of
the source repository to make it easier for developers who do not have
this tool installed to still build the overall JGit package and make
use of it.  Reviewers will need to be careful to ensure that any edits
made to a *.proto file come in a commit that also updates the
generated code to match.

CQ: 5135
Change-Id: I53e11e82c186b9cf0d7b368e0276519e6a0b2893
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-25 09:00:42 -05:00
Shawn O. Pearce 7cad0adc7d DHT: Remove per-process ChunkCache
Performance testing has indicated the per-process ChunkCache isn't
very effective for the DHT storage implementation.  If a server is
using the DHT storage backend, it is most likely part of a larger
cluster where requests are distributed in a round-robin fashion
between the member servers.

In such a scenario there is insufficient data locality between
requests to get a good hit ratio on the per-process ChunkCache.  A low
hit ratio means the cache is actually hurting performance by eating up
memory that could otherwise be used for transient request data, and
increasing pressure on the GC when it needs to find free space.

Remove all of the ChunkCache code.  Installations that want to cache
(to reduce database usage) should wrap their Database with a
CacheDatabase and use a network based CacheServer.

I left the ChunkCache in the original DHT storage commit because I
wanted to document in the history of the project that its probably
worth *not* having, but leave open a door for someone to revert this
change if they find otherwise at a later date.

Change-Id: I364d0725c46c5a19f7443642a40c89ba4d3fdd29
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-25 08:50:30 -05:00
Chris Aniszczyk aa05559fd6 Merge "Let RefDirectory use FileSnapShot to handle fast updates" 2011-05-25 09:46:49 -04:00
Stefan Lay 05fa1713da Add a DiffFormatter which calculates a patch-id
Adds a class which can be used to calculates a SHA1 of the diff
associated with a patch, similar to git patch-id.

In this version whitespace is not ignored.

Change-Id: I421d15ea905e23df543082786786841cbe3ef10d
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-24 18:08:47 -05:00
Abhishek Bhatnagar 7d380e9c5e Add CleanCommandTest and fix CleanCommand
Bug: 334767
Change-Id: I0a836451ceb668f943b1f353dc65420157810b23
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-24 17:32:19 -05:00
Abhishek Bhatnagar 08f0e1ffed Add CleanCommand to JGit API
Bug: 334767
Change-Id: I2650c77bc4af2d8f401bbcce5384b44ff2a64ba2
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-24 17:07:10 -05:00
Carsten Pfeiffer 486e22c91f Use the stored password instead of prompting for it all the time
EGit change Iba3b87293c22e5fe7d989fc312184aa7463c4387 is also required
to make this work for EGit.

Change-Id: Iedc80e133e66d72e78ff0980b6e12634f75eca36
Signed-off-by: Carsten Pfeiffer <carsten.pfeiffer@gebit.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-05-24 00:17:01 +02:00
Christian Halstrick 2302a6d3ce Let RefDirectory use FileSnapShot to handle fast updates
Since this change may affect performance and memory consumption on every
access to a loose ref I explicitly made it a RFC to collect opinions.

Previously RefDirectory.scanRef() was not detecting an update of a
loose ref when the update didn't changed the modification time of
the backing file. RefDirectory cached loose refs and the way to detect
outdated cache entries was to compare lastmodification timestamp on the
file representing the ref. If two updates to the same ref happen faster
than the filesystem-timer granularity (for linux this is 2 seconds)
there is the possiblity that we don't detect the update.

Because of this bug EGit's PushOperationTest only works with 2 second
sleeps inside.

This change let RefDirectory use FileSnapshot to detect such situations.
FileSnapshot helps to remember when a file was last read from disk and
therefore enables to decide when to load a file from disk although
modification time has not changed.

Change-Id: I03b9a137af097ec69c4c5e2eaa512d2bdd7fe080
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-23 14:48:10 -05:00
Kevin Sawicki 16e810b2ec Add shortening of note ref names to NoteMap
Change-Id: I224190bbb41c7cbea38388d0148ecc6dc68f3a14
Signed-off-by: Kevin Sawicki <kevin@github.com>
2011-05-23 11:39:33 -07:00
Shawn Pearce c25c60061d Merge "Remove rebase temporary files on checkout failure" 2011-05-23 11:33:49 -04:00
Ketan Padegaonkar 3344b93c84 Add GitAddTask
Change-Id: Ia9a3c9f4728e13d1e62f530b1d843d09afb4eb42
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-23 08:39:40 -05:00
Bernard Leach cf846cfb0b Remove rebase temporary files on checkout failure
A checkout conflict during rebase setup should leave the repository
in SAFE state which means ensuring that the rebase temporary files
need to be removed.

Bug: 346813
Change-Id: If8b758fde73ed5a452a99a195a844825a03bae1a
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-23 08:24:30 -05:00
Chris Aniszczyk 40fa75feb4 Add LsRemoteCommandTest
Bug: 343801
Change-Id: I4a91d93428bbf7f74033fcea5823266fa52d7a0c
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-19 14:45:21 -05:00
Christoph Brill e170c314fb Add LsRemoteCommand to JGit API
Bug: 343801
Change-Id: Ic651e8e09143e15ed459461b50b2222e13da56c4
Also-by: Chris Aniszczyk <caniszczyk@gmail.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-19 14:43:23 -05:00
Chris Aniszczyk 844bd74818 Add org.eclipse.jgit.ant.test to parent pom.xml
Change-Id: I3fd0b509e03cbd5f2bf3bd6377287dab14e8728e
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-19 11:26:34 -05:00
Ketan Padegaonkar d60001c83b Add GitCloneTaskTest
Change-Id: Iec8cd032d8d659a896d909f9094f76b7d35147e6
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-19 11:13:12 -05:00
Bernard Leach 5ec4977bb5 Create a MergeResult for deleted/modified files
Change Ia2ab4f8dc95020f2914ff01c2bf3b1bc62a9d45d added merge
support for when OURS or THEIRS was simultaneously deleted
and modified.  That changeset however did not add create an
entry in the conflicts table so clients would see a CONFLICTING
result but getConflicts() would return null.

This change creates a MergeResult for the conflicting file.

Bug: 345684
Change-Id: I52acb81c1729b49c9fb3e7a477c6448d8e55c317
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-19 09:22:25 -05:00
Bernard Leach 37fe0988b2 Add reset with paths support to ResetCommand
Bug: 338701
Change-Id: Id7cbce47131b459e632ddc2c9a94628c7d0b75cd
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-19 09:04:09 -05:00
Ketan Padegaonkar f953a35e9a Fix NPE in URIish when parsing an empty URI
Change-Id: Id1c42dc9843f62c581b9904b02150de53cf7777c
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-19 08:58:17 -05:00
Ketan Padegaonkar dc30c95d97 Add org.eclipse.jgit.ant.test
Change-Id: I9bfb1298864294b8ce29b91660f1cf8316e5f620
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-19 08:55:17 -05:00
Bernard Leach e3c4610c74 Add tests for change If203ce5
Bug: 344779
Change-Id: I1628984479d93665bf4987d6a4ff8e67ad73eb36
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-18 11:43:57 -05:00
Chris Aniszczyk 557ea857e3 Implement rebase ff for upstream branches with merge commits
Change Ib9898fe0f982fa08e41f1dca9452c43de715fdb6 added support for
the 'cherry-pick' fast forward case where the upstream commit history
does not include any merge commits.  This change adds support for the
case where merge commits exist and the local branch has no changes.

Bug: 344779
Change-Id: If203ce5aa1b4e5d4d7982deb621b710e71f4ee10
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-18 11:40:21 -05:00
Piotr Janik 7449b9a297 Fix path filtering in LogCommand
Bug: 346257
Change-Id: Ib897e1b4962162da9670164479a844aeea7dfcd1
Signed-off-by: Piotr Janik <janikpiotrek@gmail.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-18 10:35:25 -05:00
Robin Rosenberg d781554b79 Merge "Optimize MergeAlgorithm if ours or theirs is empty" 2011-05-17 08:54:18 -04:00
Christian Halstrick 0461ff4f0c Optimize MergeAlgorithm if ours or theirs is empty
Previously when merging two contents with a non-empty base and one of
the contents was empty (size == 0) and the other was modified there
was a potentially expensive calculation until we finally always come
to the same result -> the complete non-deleted content should collide
with the empty content.

This proposal adds an optimization to detect empty input content and
to produce the appropriate result immediatly.

Change-Id: Ie6a837260c19d808f0e99173f570ff96dd22acd3
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2011-05-17 10:59:17 +02:00
Stefan Lay b13ca9121b Merge "Fix diff bug on inserted line" 2011-05-16 21:15:25 -04:00
Shawn O. Pearce c2b87d59a0 Fix diff bug on inserted line
For the following patch on the linux 2.6.32 tag:
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -685,6 +685,7 @@ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sc

 static void check_spread(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
+#if 0
 #ifdef CONFIG_SCHED_DEBUG
        s64 d = se->vruntime - cfs_rq->min_vruntime;

@@ -694,6 +695,7 @@ static void check_spread(struct cfs_rq *cfs_rq, struct
sched
        if (d > 3*sysctl_sched_latency)
                schedstat_inc(cfs_rq, nr_spread_over);
 #endif
+#endif
 }

 static void

JGit produced an incorrect diff, attempting to add a new "}" instead
of the new "#endif" at the end of the hunk. This was caused by a prior
fix for bug 328895 where we wanted to "slide" a diff down in the file
when adding a new method/function and want to show the closing curly
brace as being added after the new method, rather than added onto the
end of the prior function or method just before the insertion point.

Bug: 345956
Change-Id: I32b9e24f1e2980258b1b39dd1807919ab1c5f9b2
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-05-16 11:28:23 -07:00
Piotr Janik 2e43e1e904 Add getConflicting() method in Status API
Bug: 345899
Change-Id: I133b9dd3e9a9c3c749547a884df3ce371929f38e
Signed-off-by: Piotr Janik <janikpiotrek@gmail.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-16 08:45:19 -05:00
Shawn Pearce 4b4df4ccf8 Merge "Fix diff when first text is the start of the other" 2011-05-15 15:17:52 -04:00
Robin Rosenberg 51a5cc7f1a Fix diff when first text is the start of the other
The problem occurred when the first text ends in the middle
of the last line of the other text and the first text has no
end of line.

Bug: 344975
Change-Id: I1f0dd9f8062f2148a7c1341c9122202e082ad19d
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-05-15 20:34:05 +02:00
Chris Aniszczyk 24ce43de0c Merge "Add test for reflog part of ResetCommand" 2011-05-13 18:05:58 -04:00
Robin Rosenberg e9311e526c Add test for reflog part of ResetCommand
The reflog message fix was done in
I4f1c3cd6b2cf543be213f061afb94223062dde51

Change-Id: I44817ccf4bf226ed3e4ce6fb2d923e88788221dd
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-05-13 23:45:54 +02:00
Chris Aniszczyk c22eab4948 Add RebaseResult.FAST_FORWARD_RESULT
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-13 09:56:09 -05:00
Robin Stocker a31590ff63 RevertCommand: Add "." after reverted commit id
This makes the message look the same as in C Git (the "."):

  This reverts commit <sha1>.

Change-Id: I4c254c122277b127e7b039c0d1c7f7a0d691530d
Signed-off-by: Robin Stocker <robin@nibor.org>
2011-05-13 13:39:54 +02:00
Chris Aniszczyk 4e7c2f807d Update tycho version to 0.12
Following migration instructions [1].

[1] http://dev.eclipse.org/mhonarc/lists/tycho-user/msg00080.html

Change-Id: I9e54f3e7e96892b64546270cbdf0308046e1d40c
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-05-12 13:25:05 -05:00
Chris Aniszczyk 0ea6d9c8d9 Update findbugs-maven-plugin to the official 2.3.2 release
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-10 15:43:40 -05:00
Christian Halstrick 858408f8c3 Merge "Formatter for relative dates" 2011-05-09 09:23:37 -04:00
Matthias Sohn c05c6f3327 Formatter for relative dates
Change-Id: I78b307177c68c578e10101a0ee7b6306880a08f7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-05-09 14:46:38 +02:00
Kevin Sawicki 425d17b72d Remove unused serialVersionUID from non-serializable classes.
Change-Id: I819e2ca88577382b54d38b7a1247e94a5127ef9e
Signed-off-by: Kevin Sawicki <kevin@github.com>
2011-05-08 17:51:45 -07:00
Stefan Lay 05bb92980b Fix getHumanishName broken for windows paths
Since d1718a the method getHumanishName was broken on windows since
the URIish is not normalized anymore. For a path like
"C:\gitRepositories\egit" the whole path was returned instead of
"egit".

Bug: 343519
Change-Id: I95056009072b99d32f288966302d0f8188b47836
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2011-05-06 10:42:51 +02:00
Chris Aniszczyk b8fdda11cc Merge "IndexDiff: conflicting files aren't properly shown" 2011-05-05 15:34:49 -04:00
Shawn O. Pearce c36a892e7f Correct tabs in top-level pom.xml
Change-Id: I55900b335f2056093e0a32086afb429a4bc183d3
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-05-05 12:00:52 -07:00
Bernard Leach 298486a7c3 IndexDiff: conflicting files aren't properly shown
Before this change any files in the conflicting set would
also be listed in the the other IndexDiff Sets which is
confusing.  With this change a conflicting file will not
be included in any of the other sets.

Change-Id: Ife9f2652685220bcfddc1f9820423acdcd5acfdc
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2011-05-05 13:48:57 -05:00
Shawn O. Pearce e435f7de77 Update IP log to include Ant 1.8.2 (CQ 5111)
Change-Id: I953720b88d34e74509b115dcd2c1eb48d3587484
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-05-05 10:58:03 -07:00
Robin Rosenberg 5f22d67270 Ignore submodule commits during checkout
Submodules are supposed to be handled by separate operations, so
we should ignore them on checkout, just like C Git does.

This fix does not add submodule support. We just try harder
to ignore them.

Bug: 343566
Change-Id: I2c5ae1024ea7bb57adf27072da6acc9643018eda
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2011-05-05 10:45:57 -07:00
Shawn Pearce 18b7e9400e Merge "Fix "into" part of merge message for HEAD" 2011-05-05 13:38:40 -04:00
Shawn O. Pearce de8946c0c2 Store Git on any DHT
jgit.storage.dht is a storage provider implementation for JGit that
permits storing the Git repository in a distributed hashtable, NoSQL
system, or other database.  The actual underlying storage system is
undefined, and can be plugged in by implementing 7 small interfaces:

  *  Database
  *  RepositoryIndexTable
  *  RepositoryTable
  *  RefTable
  *  ChunkTable
  *  ObjectIndexTable
  *  WriteBuffer

The storage provider interface tries to assume very little about the
underlying storage system, and requires only three key features:

  *  key -> value lookup (a hashtable is suitable)
  *  atomic updates on single rows
  *  asynchronous operations (Java's ExecutorService is easy to use)

Most NoSQL database products offer all 3 of these features in their
clients, and so does any decent network based cache system like the
open source memcache product.  Relying only on key equality for data
retrevial makes it simple for the storage engine to distribute across
multiple machines.  Traditional SQL systems could also be used with a
JDBC based spi implementation.

Before submitting this change I have implemented six storage systems
for the spi layer:

  * Apache HBase[1]
  * Apache Cassandra[2]
  * Google Bigtable[3]
  * an in-memory implementation for unit testing
  * a JDBC implementation for SQL
  * a generic cache provider that can ride on top of memcache

All six systems came in with an spi layer around 1000 lines of code to
implement the above 7 interfaces.  This is a huge reduction in size
compared to prior attempts to implement a new JGit storage layer.  As
this package shows, a complete JGit storage implementation is more
than 17,000 lines of fairly complex code.

A simple cache is provided in storage.dht.spi.cache.  Implementers can
use CacheDatabase to wrap any other type of Database and perform fast
reads against a network based cache service, such as the open source
memcached[4].  An implementation of CacheService must be provided to
glue this spi onto the network cache.

[1] https://github.com/spearce/jgit_hbase
[2] https://github.com/spearce/jgit_cassandra
[3] http://labs.google.com/papers/bigtable.html
[4] http://memcached.org/

Change-Id: I0aa4072781f5ccc019ca421c036adff2c40c4295
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2011-05-05 10:21:12 -07:00
Chris Aniszczyk 87455127a3 Add org.eclipse.jgit.ant to parent pom.xml
Bug: 321237
Change-Id: Idd106f2700740db07f41f6d31f50d6b2a30fa732
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2011-05-05 18:33:16 +02:00
Robin Stocker 7546e3b4c5 Fix "into" part of merge message for HEAD
Merging into a non-master branch would result in the following message:

  Merge branch 'a' into HEAD

Now the merge message is correct:

  Merge branch 'a' into b

Change-Id: I488f97190e4c1711c23a7a3cbd64f8b13a87bbac
Signed-off-by: Robin Stocker <robin@nibor.org>
2011-05-05 17:50:44 +02:00
Chris Aniszczyk eb9dba2fde Merge "Fix error handling in RepositoryFilter" 2011-05-05 10:35:55 -04:00