]> source.dussan.org Git - jgit.git/log
jgit.git
12 years agoFix History rendering 19/4719/1
Christian Halstrick [Fri, 2 Dec 2011 13:27:51 +0000 (14:27 +0100)]
Fix History rendering

There was the possibility that during history rendering we draw a lane
"trough" a passed commit. Vadim Dmitriev found that out in bug 335818.
I added the needed check to that block of code where it was missing.

Bug: 335818
Change-Id: Ic944193b2aca55ff3eb0235d46afa60b7896aa0f
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
12 years agoFix HTTP unit tests 04/4704/1
Shawn O. Pearce [Thu, 1 Dec 2011 01:40:10 +0000 (17:40 -0800)]
Fix HTTP unit tests

I modified the way errors are returned, and this particular test is
now getting a different access denied response. The new text happens
to be what I intended to have here, so update the test.

Change-Id: I53f8410ca0a52755d80473cd5cbcdb4d8502febf

12 years agoMerge "RepositoryState: add method canAmend"
Christian Halstrick [Wed, 30 Nov 2011 09:55:58 +0000 (04:55 -0500)]
Merge "RepositoryState: add method canAmend"

12 years agoMerge "Always checkout master when it matches the advertised HEAD"
Shawn Pearce [Tue, 29 Nov 2011 02:59:52 +0000 (21:59 -0500)]
Merge "Always checkout master when it matches the advertised HEAD"

12 years agoMerge "Update maven plugin versions"
Shawn Pearce [Tue, 29 Nov 2011 02:51:31 +0000 (21:51 -0500)]
Merge "Update maven plugin versions"

12 years agoMerge "Implement Serializable interface in ReflogEntry"
Shawn Pearce [Tue, 29 Nov 2011 02:50:40 +0000 (21:50 -0500)]
Merge "Implement Serializable interface in ReflogEntry"

12 years agoRemove calls to printStackTrace in catch blocks 91/4691/1
Kevin Sawicki [Tue, 29 Nov 2011 02:07:52 +0000 (18:07 -0800)]
Remove calls to printStackTrace in catch blocks

Change-Id: I7a4179f10a4841e80b6546e1e7662cab71eac5e9

12 years agoUpdate maven plugin versions 89/4689/1
Matthias Sohn [Tue, 29 Nov 2011 00:16:47 +0000 (01:16 +0100)]
Update maven plugin versions

Change-Id: I7400e08a1059f57c85a53aebe2719f81c00f58e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoImplement Serializable interface in ReflogEntry 88/4688/1
Kevin Sawicki [Tue, 29 Nov 2011 00:14:21 +0000 (16:14 -0800)]
Implement Serializable interface in ReflogEntry

Change-Id: Idf798dd3981bef3dc9e17c13c12809f89089e96f

12 years agoAlways checkout master when it matches the advertised HEAD 87/4687/2
Kevin Sawicki [Mon, 28 Nov 2011 19:00:15 +0000 (11:00 -0800)]
Always checkout master when it matches the advertised HEAD

This parallels the CGit behavior of always using refs/heads/master
when it matches the remote advertised HEAD commit.

Change-Id: I5a5cd1516b58d116e334056aba1ef7990697ec30

12 years agoRepositoryState: add method canAmend 74/4674/3
Jens Baumgart [Mon, 28 Nov 2011 09:46:16 +0000 (10:46 +0100)]
RepositoryState: add method canAmend

The method canAmend was added to RepositoryState. It returns true if
amending the HEAD commit is allowed in the current repository state.

Change-Id: Idd0c4eea83a23c41340789b7b877959b457d951e
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
12 years agoMerge "Reset SSH connection and credentials on "Auth fail""
Shawn Pearce [Sun, 27 Nov 2011 00:24:09 +0000 (19:24 -0500)]
Merge "Reset SSH connection and credentials on "Auth fail""

12 years agoReset SSH connection and credentials on "Auth fail" 76/4676/2
Matthias Sohn [Sun, 27 Nov 2011 00:16:49 +0000 (01:16 +0100)]
Reset SSH connection and credentials on "Auth fail"

When SSH user/password authentication failed this may have been caused
by changed credentials on the server side. When the SSH credentials of a
user change the SSH connection needs to be re-established and
credentials which may have been stored by the credentials provider
need to be reset in order to enable prompting for the new credentials.

Bug: 356233
Change-Id: I7d64c5f39b68a9687c858bb68a961616eabbc751
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoDon't iterate over advertised refs when HEAD is null 81/4681/1
Kevin Sawicki [Sat, 26 Nov 2011 22:47:21 +0000 (14:47 -0800)]
Don't iterate over advertised refs when HEAD is null

Moves the check from inside the loop to outside the loop
and returns immediately if the HEAD advertisded ref is null

Change-Id: I539da6cafb4f73610b8e00259e32bd4d57f4f4cc

12 years agoMerge "tools/release: Handle v1.0.0.201106090707-r-NN-gdeadbeef"
Matthias Sohn [Thu, 24 Nov 2011 13:34:50 +0000 (08:34 -0500)]
Merge "tools/release: Handle v1.0.0.201106090707-r-NN-gdeadbeef"

12 years agoMerge "Adapt merge message to C Git for remote-tracking branch"
Shawn Pearce [Wed, 23 Nov 2011 23:09:06 +0000 (18:09 -0500)]
Merge "Adapt merge message to C Git for remote-tracking branch"

12 years agoMerge changes I828ac2de,I80e5b7cf
Shawn O. Pearce [Wed, 23 Nov 2011 23:08:28 +0000 (18:08 -0500)]
Merge changes I828ac2de,I80e5b7cf

* changes:
  Add utilities for smart HTTP error handling
  Strip leading slashes in RepositoryFilter

12 years agoAdapt merge message to C Git for remote-tracking branch 71/4671/1
Robin Stocker [Wed, 23 Nov 2011 16:03:21 +0000 (17:03 +0100)]
Adapt merge message to C Git for remote-tracking branch

Commit 13931236b9ee2895a98ffdbdacbd0f895956d8a8 in C Git (2011-11-02)
changed the message format:

-Merge remote branch 'origin/foo'
+Merge remote-tracking branch 'origin/foo'

This change does the same in EGit to be consistent.

Change-Id: I7d9c5afa95771dbfe6079b5f89a10b248fee0172
Signed-off-by: Robin Stocker <robin@nibor.org>
12 years agoGuard against null branch in PullCommand 68/4668/2
Kevin Sawicki [Wed, 23 Nov 2011 00:29:28 +0000 (16:29 -0800)]
Guard against null branch in PullCommand

Throw a NoHeadException when Repository.getFullBranch
returns null

Bug: 351543
Change-Id: I666cd5b67781508a293ae553c6fe5c080c8f4d99
Signed-off-by: Kevin Sawicki <kevin@github.com>
12 years agoSupport adding all refs to LogCommand 65/4665/3
Kevin Sawicki [Wed, 23 Nov 2011 00:14:30 +0000 (16:14 -0800)]
Support adding all refs to LogCommand

Bug: 353310
Change-Id: Ifa2e7ed58c7f2bdfe3aafbd500b5a38c1f94c2ec
Signed-off-by: Kevin Sawicki <kevin@github.com>
12 years agoAdd utilities for smart HTTP error handling 67/4667/1
Shawn O. Pearce [Tue, 22 Nov 2011 23:51:11 +0000 (15:51 -0800)]
Add utilities for smart HTTP error handling

The GitSmartHttpTools class started as utility functions to help report
useful error messages to users of the android.googlesource.com service.

Now that the GitServlet and GitFilter classes support filters before a
git-upload-pack or git-receive-pack request, server implementors may
these routines helpful to report custom messages to clients.  Using the
sendError() method to return an HTTP 200 OK with error text embedded in
the payload prevents native Git clients from retrying the action with a
dumb Git or WebDAV HTTP request.

Refactor some of the existing code to use these new error functions and
protocol constants.  The new sendError() function is very close to being
identical to the old error handling code in RepositoryFilter, however we
now use the POST Content-Type rather than the Accept HTTP header to check
if the client will accept the error data in the response body rather than
using the HTTP status code.  This is a more reliable way of checking for
native Git clients, as the Accept header was not always populated with the
correct string in older versions of Git smart HTTP.

Change-Id: I828ac2deb085af12b6689c10f86662ddd39bd1a2

12 years agoStrip leading slashes in RepositoryFilter 66/4666/1
Shawn O. Pearce [Tue, 22 Nov 2011 23:18:32 +0000 (15:18 -0800)]
Strip leading slashes in RepositoryFilter

If removing the leading slash results in an empty string, return
with an HTTP 404 error before trying to use the RepositoryResolver.
Moving this into a loop ahead of the length check ensures there is
no empty string passed into the resolver.

Change-Id: I80e5b7cf25ae9f2164b5c396a29773e5c7d7286e

12 years agoMerge "Provide merge result when revert command fails"
Shawn Pearce [Tue, 22 Nov 2011 19:26:08 +0000 (14:26 -0500)]
Merge "Provide merge result when revert command fails"

12 years agomaxObjectSizeLimit for receive-pack. 50/4650/7
Sasa Zivkov [Tue, 22 Nov 2011 16:43:00 +0000 (17:43 +0100)]
maxObjectSizeLimit for receive-pack.

ReceivePack (and PackParser) can be configured with the
maxObjectSizeLimit in order to prevent users from pushing too large
objects to Git. The limit check is applied to all object types
although it is most likely that a BLOB will exceed the limit.  In all
cases the size of the object header is excluded from the object size
which is checked against the limit as this is the size of which a BLOB
object would take in the working tree when checked out as a file.
When an object exceeds the maxObjectSizeLimit the receive-pack will
abort immediately.

Delta objects (both offset and ref delta) are also checked against the
limit. However, for delta objects we will first check the size of the
inflated delta block against the maxObjectSizeLimit and abort
immediately if it exceeds the limit. In this case we even do not know
the exact size of the resolved delta object but we assume it will be
larger than the given maxObjectSizeLimit as delta is generally only
chosen if the delta can copy more data from the base object than the
delta needs to insert or needs to represent the copy ranges. Aborting
early, in this case, avoids unnecessary inflating of the (huge) delta
block.

Unfortunately, it is too expensive (especially for a large delta) to
compute SHA-1 of an object that causes the receive-pack to abort.
This would decrease the value of this feature whose main purpose is to
protect server resources from users pushing huge objects.  Therefore
we don't report the SHA-1 in the error message.

Change-Id: I177ef24553faacda444ed5895e40ac8925ca0d1e
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoProvide merge result when revert command fails 61/4661/1
Kevin Sawicki [Tue, 22 Nov 2011 01:14:11 +0000 (17:14 -0800)]
Provide merge result when revert command fails

This allows callers to determine why the revert
did not complete successfully

Change-Id: Ie44bb8523cac388b63748bc69ebdd3c3a3665d06
Signed-off-by: Kevin Sawicki <kevin@github.com>
12 years agoMerge "Add missing '' characters around quoted variables"
Shawn Pearce [Sat, 19 Nov 2011 00:11:47 +0000 (19:11 -0500)]
Merge "Add missing '' characters around quoted variables"

12 years agoFix duplicate objects in "thin+cached" packs from DFS 30/4630/6
Shawn O. Pearce [Wed, 16 Nov 2011 23:04:44 +0000 (15:04 -0800)]
Fix duplicate objects in "thin+cached" packs from DFS

The DfsReader must offer every representation of an object that
exists on the local repository when PackWriter asks for them. This
is necessary to identify objects in the thin pack part that are also
in the cached pack that will be appended onto the end of the stream.

Without looking at all alternatives, PackWriter may pack the same
object twice (once in the thin section, again in the cached base
pack). This may cause the command line C version to go into an
infinite loop when repacking the resulting repository, as it may see
a delta chain cycle with one of those duplicate copies of the object.

Previously the DfsReader tried to avoid looking at packs that it
might not care about, but this is insufficient, as all versions
must be considered during pack generation.

Change-Id: Ibf4a3e8ea5c42aef16404ffc42a5781edd97b18e

12 years agoDo not write edge objects to the pack stream 46/4646/5
Shawn O. Pearce [Thu, 17 Nov 2011 19:23:18 +0000 (11:23 -0800)]
Do not write edge objects to the pack stream

Consider two objects A->B where A uses B as a delta base, and these
are in the same source pack file ordered as "A B".

If cached packs is enabled and B is also in the cached pack that
will be appended onto the end of the thin pack, and both A, B are
supposed to be in the thin pack, PackWriter must consider the fact
that A's base B is an edge object that claims to be part of the
new pack, but is actually "external" and cannot be written first.

If the object reuse system considered B candidates fist this bug
does not arise, as B will be marked as edge due to it existing in
the cached pack. When the A candidates are later examined, A sees a
valid delta base is available as an edge, and will not later try to
"write base first" during the writing phase.

However, when the reuse system considers A candidates first they
see that B will be in the outgoing pack, as it is still part of
the thin pack, and arrange for A to be written first. Later when A
switches from being in-pack to being an edge object (as it is part
of the cached pack) the pointer in B does not get its type changed
from ObjectToPack to ObjectId, so B thinks A is non-edge.

We work around this case by also checking that the delta base B
is non-edge before writing the object to the pack. Later when A
writes its object header, delta base B's ObjectToPack will have
an offset == 0, which makes isWritten() = false, and the OBJ_REF
delta format will be used for A's header. This will be resolved by
the client to the copy of B that appears in the later cached pack.

Change-Id: Ifab6bfdf3c0aa93649468f49bcf91d67f90362ca

12 years agoUse long for more object counts in PackWriter 45/4645/4
Shawn O. Pearce [Thu, 17 Nov 2011 19:39:53 +0000 (11:39 -0800)]
Use long for more object counts in PackWriter

Packs can contain up to 2^32-1 objects, which exceeds the range of a
Java int. Try harder to accept higher object counts in some cases by
using long more often when we are working with the object count value.

This is a trivial refactoring, we may have to make even more changes
to the object handling code to support more than 2^31-1 objects.

Change-Id: I8cd8146e97cd1c738ad5b48fa9e33804982167e7

12 years agoSearch for annotated tag reuse first 44/4644/2
Shawn O. Pearce [Thu, 17 Nov 2011 19:44:43 +0000 (11:44 -0800)]
Search for annotated tag reuse first

Annotated tags are relatively rare and currently are scheduled in a
pack file near the commits, decreasing the time it takes to resolve
client requests reading tags as part of a history traversal.

Putting them first before the commits allows the storage system to
page in the tag area, and have it relatively hot in the LRU when
the nearby commit area gets examined too. Later looking at the
tree and blob data will pollute the cache, making it more likely
the tags are not loaded and would require file IO.

Change-Id: I425f1f63ef937b8447c396939222ea20fdda290f

12 years agoCorrect progress monitor on "Getting sizes:" phase 42/4642/2
Shawn O. Pearce [Thu, 17 Nov 2011 15:21:22 +0000 (07:21 -0800)]
Correct progress monitor on "Getting sizes:" phase

This counter always was running 1 higher, because it incremented
after the queue was exhausted (and every object was processed). Move
increments to be after the queue has provided a result, to ensure
we do not show a higher in-progress count than total count.

Change-Id: I97f815a0492c0957300475af409b6c6260008463

12 years agoRefactor DfsReader selection of cached packs 29/4629/2
Shawn O. Pearce [Wed, 16 Nov 2011 22:52:31 +0000 (14:52 -0800)]
Refactor DfsReader selection of cached packs

Make the code more clear with a simple refactoring of the boolean
logic into a method that describes the condition we are looking
for on each pack file. A cached pack is possible if there exists
a tips collection, and the collection is non-empty.

Change-Id: I4ac42b0622b39d159a0f4f223e291c35c71f672c

12 years agoAdd missing '' characters around quoted variables 24/4624/5
Kevin Sawicki [Wed, 16 Nov 2011 16:04:55 +0000 (08:04 -0800)]
Add missing '' characters around quoted variables

Double ' characters are needed for variables to appear in
single quotes.  Variables surrounded with a s single ' will
not be replaced when formatted

Change-Id: I0182c1f679ba879ca19dd81bf46924f415dc6003
Signed-off-by: Kevin Sawicki <kevin@github.com>
12 years agoMerge changes I366435e2,I64577f8f
Shawn Pearce [Fri, 18 Nov 2011 21:05:27 +0000 (16:05 -0500)]
Merge changes I366435e2,I64577f8f

* changes:
  [findBugs] Silence returning null for StringUtils.toBooleanOrNull()
  [findBugs] Prefer short-cut logic as it's more performant

12 years ago[findBugs] Silence returning null for StringUtils.toBooleanOrNull() 38/4638/1
Matthias Sohn [Wed, 16 Nov 2011 19:47:12 +0000 (20:47 +0100)]
[findBugs] Silence returning null for StringUtils.toBooleanOrNull()

As the method name and its javadoc clearly state that this method can
return null we can ignore this FindBugs warning.

Change-Id: I366435e26eda5d910f5d1a907db51f08efd4bb8c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years ago[findBugs] Prefer short-cut logic as it's more performant 37/4637/1
Matthias Sohn [Wed, 16 Nov 2011 19:54:40 +0000 (20:54 +0100)]
[findBugs] Prefer short-cut logic as it's more performant

Change-Id: I64577f8fd19ee0d2d407479cc70e521adc367f37
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoKeep track of a static collection of all PackWriter instances 95/4595/2
Dave Borowitz [Thu, 10 Nov 2011 20:58:13 +0000 (12:58 -0800)]
Keep track of a static collection of all PackWriter instances

Stored in a weak concurrent hash map, which we clean up while iterating.
Usually the weak reference behavior should not be necessary because
PackWriters should be released with release(), but we still want to
avoid leaks when dealing with broken client code.

Change-Id: I337abb952ac6524f7f920fedf04065edf84d01d2

12 years agoEstimate the amount of memory used by a PackWriter 94/4594/2
Dave Borowitz [Thu, 10 Nov 2011 20:53:50 +0000 (12:53 -0800)]
Estimate the amount of memory used by a PackWriter

Memory usage is dominated by three terms:
 - The maximum memory allocated to each delta window.
 - The maximum size of a single file held in memory during delta search.
 - ObjectToPack instances owned by the writer.

For the first two terms, rather than doing complex instrumentation of
the DeltaWindows, we just overestimate based on the config parameters
(though we may underestimate if the maximum size is not set).

For the ObjectToPack instances, we do some rough byte accounting of the
underlying Java object representation.

Change-Id: I23fe3cf9d260a91f1aeb6ea22d75af8ddb9b1939

12 years agoAdd an object encapsulating the state of a PackWriter 93/4593/2
Dave Borowitz [Thu, 10 Nov 2011 20:49:15 +0000 (12:49 -0800)]
Add an object encapsulating the state of a PackWriter

Exposes essentially the same state machine to the programmer as is
exposed to the client via a ProgressMonitor, using a wrapper around
beginTask()/endTask().

Change-Id: Ic3622b4acea65d2b9b3551c668806981fa7293e3

12 years agoMerge "Implement DirCacheEntry.toString() to ease debugging"
Christian Halstrick [Fri, 11 Nov 2011 08:21:29 +0000 (03:21 -0500)]
Merge "Implement DirCacheEntry.toString() to ease debugging"

12 years agoClean up tab usage in Directory/File conflict table 29/4529/2
Robin Rosenberg [Sun, 30 Oct 2011 20:51:22 +0000 (21:51 +0100)]
Clean up tab usage in Directory/File conflict table

Change-Id: I394fc1ef714c8465cbd5af9c73338b9a324ad9c4
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoAdd detection of untracked folders to IndexDiffFilter 85/4385/6
Jens Baumgart [Wed, 26 Oct 2011 12:00:48 +0000 (14:00 +0200)]
Add detection of untracked folders to IndexDiffFilter

Decorators need to know whether folders in the working tree contain only
untracked files. This change enhances IndexDiffFilter to report such
folders. This works only together with treewalks which operate in
default traversal mode. For treewalks which process entries in
postorder mode (files are walked before their parent folder is walked)
this detection doesn't work.

Bug: 359264
Change-Id: I9298d1e3ccac0aec8bbd4e8ac867bc06a5c89c9f
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years ago[blame] Fix blame following renames in non-toplevel directories 68/4368/4
Carsten Pfeiffer [Thu, 27 Oct 2011 22:15:27 +0000 (00:15 +0200)]
[blame] Fix blame following renames in non-toplevel directories

Mark the treeWalk as recursive; otherwise following renames only works
for toplevel files.

Bug: 302549
Change-Id: I70867928eadf332b0942f8bf6877a3acb3828c87
Signed-off-by: Carsten Pfeiffer <carsten.pfeiffer@gebit.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoSupport a configured credentials provider in LsRemoteCommand 71/4571/4
Kevin Sawicki [Tue, 8 Nov 2011 20:49:16 +0000 (12:49 -0800)]
Support a configured credentials provider in LsRemoteCommand

Refactored the three common transport configuration options:
credentials provider, timeout, and transport config callback
into a new TransportCommand base class which is now extended
by all commands that use a Transport object during execution.

Bug: 349188
Change-Id: I90c2c14fb4e3cc4712905158f9047153a0c235c2
Signed-off-by: Kevin Sawicki <kevin@github.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
12 years agoImplement DirCacheEntry.toString() to ease debugging 96/4596/1
Matthias Sohn [Thu, 10 Nov 2011 12:34:59 +0000 (13:34 +0100)]
Implement DirCacheEntry.toString() to ease debugging

Change-Id: I9aa1b5817a18fb340411f47b25b6711d533590fd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoMerge changes Ibb3467f7,I2af99903
Robin Rosenberg [Thu, 10 Nov 2011 07:07:04 +0000 (02:07 -0500)]
Merge changes Ibb3467f7,I2af99903

* changes:
  Always use try/finally around DfsBlockCache.clockLock
  DfsBlockCache: Fix NPE when evicting empty cell

12 years agoMerge "Do not use the deprecated Tree class internally"
Christian Halstrick [Wed, 9 Nov 2011 08:40:45 +0000 (03:40 -0500)]
Merge "Do not use the deprecated Tree class internally"

12 years agoDo not use the deprecated Tree class internally 51/4551/3
Robin Rosenberg [Tue, 8 Nov 2011 21:07:59 +0000 (22:07 +0100)]
Do not use the deprecated Tree class internally

Replace it with DirCache, like we did to remove GitIndex.

Change-Id: Ia354770cee5c68f19945279b34aef6de54697435

12 years agoKill GitIndex 55/4355/5
Robin Rosenberg [Sun, 16 Oct 2011 05:01:21 +0000 (07:01 +0200)]
Kill GitIndex

A few places were still using GitIndex. Replacing it was fairly
simple, but there is a difference in test outcome in
ReadTreeTest.testUntrackedConflicts. I believe the new behavior
is good, since we do not update neither the index, not the worktree.

Change-Id: I4be5357b7b3139dded17f77e07a140addb213ea7
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
12 years agoDeprecate GitIndex more by using only DirCache internally. 56/4356/6
Robin Rosenberg [Wed, 19 Oct 2011 21:14:41 +0000 (23:14 +0200)]
Deprecate GitIndex more by using only DirCache internally.

This includes merging ReadTreeTest into DirCacheCheckoutTest and
converting IndexDiffTest to use DirCache only. The GitIndex specific
T0007GitIndex test remains.

GitIndex is deprecated. Let us speed up its demise by focusing the
DirCacheCheckout tests to using DirCache instead.

This also add explicit deprecation comments to methods that depend
on GitIndex in Repository and TreeEntry. The latter is deprecated in
itself.

Change-Id: Id89262f7fbfee07871f444378f196ded444f2783
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
12 years agoAlways use try/finally around DfsBlockCache.clockLock 73/4573/1
Shawn O. Pearce [Mon, 7 Nov 2011 20:06:56 +0000 (12:06 -0800)]
Always use try/finally around DfsBlockCache.clockLock

Any RuntimeException or Error in this block will leave the lock
held by the caller thread, which can later result in deadlock or
just cache requests hanging forever because they cannot get to
the lock object.

Wrap everything in try/finally to prevent the lock from hanging,
even though a RuntimeException or Error should never happen in
any of these code paths.

Change-Id: Ibb3467f7ee4c06f617b737858b4be17b10d936e0

12 years agoDfsBlockCache: Fix NPE when evicting empty cell 72/4572/1
Shawn O. Pearce [Tue, 8 Nov 2011 20:22:37 +0000 (12:22 -0800)]
DfsBlockCache: Fix NPE when evicting empty cell

The cache starts with a single empty Ref that has no data, as the
clock list does not support being empty. When this Ref is removed,
the size has to be decremented from the associated DfsPackKey,
which was previously null. Make it always be non-null.

Change-Id: I2af99903e8039405ea6d67f383576ffa43839cff

12 years agoDon't throw away the stack trace when tests fail 49/4549/1
Robin Rosenberg [Sat, 5 Nov 2011 15:52:24 +0000 (16:52 +0100)]
Don't throw away the stack trace when tests fail

Most unexpected exceptions are completely useless yielding message
like "null" or "3" or in the best cases something reasonable, but
still out of context.

Just declare the test as throwing an exception. That will retain
the full stack trace leading to the point of failure without using
a debugger or changing the code.

Change-Id: Id2454d328d1aa665606ae002de2c3805fe7baa8e

12 years agoMerge "Do not resolve path using cygwin unless told to"
Shawn Pearce [Fri, 4 Nov 2011 22:09:56 +0000 (18:09 -0400)]
Merge "Do not resolve path using cygwin unless told to"

12 years agoMerge changes Icea2572d,I2633e472,I207c0c93,I10cee76c,Ifd78e8ce,I890b5fcc,Ia0b01f5d...
Shawn Pearce [Fri, 4 Nov 2011 22:06:30 +0000 (18:06 -0400)]
Merge changes Icea2572d,I2633e472,I207c0c93,I10cee76c,Ifd78e8ce,I890b5fcc,Ia0b01f5d,Iec524abd

* changes:
  DfsBlockCache: Update hits to not include contains()
  Add a listener for changes to a DfsObjDatabase's pack files
  Expose the reverse index size in the DfsPackDescription
  Add a DfsPackFile method to get the number of cached bytes
  Expose the list of pack files in the DfsBlockCache
  Add a DFS repository description and reference it in each pack
  Clarify the docstring of DfsBlockCache.reconfigure()
  DFS: A storage layer for JGit

12 years agoMerge "Refactor HTTP server stack to use Filter as base"
Shawn O. Pearce [Fri, 4 Nov 2011 22:05:09 +0000 (18:05 -0400)]
Merge "Refactor HTTP server stack to use Filter as base"

12 years agoDfsBlockCache: Update hits to not include contains() 46/4546/2
Colby Ranger [Thu, 3 Nov 2011 22:30:17 +0000 (15:30 -0700)]
DfsBlockCache: Update hits to not include contains()

Also expose the underlying hit and miss counters, in
addition to the hit ratio.

Change-Id: Icea2572d62e59318133b0a88848019f34ad70975

12 years agoAdd a listener for changes to a DfsObjDatabase's pack files 45/4545/3
Dave Borowitz [Wed, 19 Oct 2011 22:55:14 +0000 (15:55 -0700)]
Add a listener for changes to a DfsObjDatabase's pack files

Intended for cross-request use, so only refers to
DfsRepositoryDescriptions rather than DfsRepositorys.

Change-Id: I2633e472c9264d91d632069f608d53d4bdd0fc09

12 years agoExpose the reverse index size in the DfsPackDescription 44/4544/3
Dave Borowitz [Thu, 3 Nov 2011 19:57:58 +0000 (12:57 -0700)]
Expose the reverse index size in the DfsPackDescription

This is analogous to the getPackSize() and getIndexSize() methods.

Change-Id: I207c0c93f9145826d84b3610eb4319fca074ee0d

12 years agoAdd a DfsPackFile method to get the number of cached bytes 43/4543/3
Dave Borowitz [Thu, 3 Nov 2011 19:54:21 +0000 (12:54 -0700)]
Add a DfsPackFile method to get the number of cached bytes

The counter is actually stored in the DfsPackKey so it can be
manipulated by the cache.

Change-Id: I10cee76c92d65c68d1aa1a9dd0c4fd7173c4cede

12 years agoExpose the list of pack files in the DfsBlockCache 42/4542/3
Dave Borowitz [Thu, 3 Nov 2011 19:52:19 +0000 (12:52 -0700)]
Expose the list of pack files in the DfsBlockCache

Callers may want to inspect the contents of the cache, which this allows
them to do in a read-only fashion without any locking.

Change-Id: Ifd78e8ce34e26e5cc33e9dd61d70c593ce479ee0

12 years agoAdd a DFS repository description and reference it in each pack 41/4541/3
Dave Borowitz [Fri, 7 Oct 2011 22:31:19 +0000 (15:31 -0700)]
Add a DFS repository description and reference it in each pack

Just as DfsPackDescription describes a pack but does not imply it is
open in memory, a DfsRepositoryDescription describes a repository at a
basic level without it necessarily being open.

Change-Id: I890b5fccdda12c1090cfabf4083b5c0e98d717f6

12 years agoClarify the docstring of DfsBlockCache.reconfigure() 40/4540/2
Dave Borowitz [Thu, 3 Nov 2011 19:43:03 +0000 (12:43 -0700)]
Clarify the docstring of DfsBlockCache.reconfigure()

The docstring was copied from the local filesystem cache code, which
actually attempted to reconfigure the cache on the fly. The DFS cache is
designed to be "reconfigured" exactly once.

Change-Id: Ia0b01f5d6b6b3d3a68d65a5c229ff67c1cede5bc

12 years agoDFS: A storage layer for JGit 30/3930/8
Shawn O. Pearce [Sat, 2 Jul 2011 01:31:53 +0000 (18:31 -0700)]
DFS: A storage layer for JGit

In practice the DHT storage layer has not been performing as well as
large scale server environments want to see from a Git server.

The performance of the DHT schema degrades rapidly as small changes
are pushed into the repository due to the chunk size being less than
1/3 of the pushed pack size.  Small chunks cause poor prefetch
performance during reading, and require significantly longer prefetch
lists inside of the chunk meta field to work around the small size.

The DHT code is very complex (>17,000 lines of code) and is very
sensitive to the underlying database round-trip time, as well as the
way objects were written into the pack stream that was chunked and
stored on the database.  A poor pack layout (from any version of C Git
prior to Junio reworking it) can cause the DHT code to be unable to
enumerate the objects of the linux-2.6 repository in a completable
time scale.

Performing a clone from a DHT stored repository of 2 million objects
takes 2 million row lookups in the DHT to locate the OBJECT_INDEX row
for each object being cloned. This is very difficult for some DHTs to
scale, even at 5000 rows/second the lookup stage alone takes 6 minutes
(on local filesystem, this is almost too fast to bother measuring).
Some servers like Apache Cassandra just fall over and cannot complete
the 2 million lookups in rapid fire.

On a ~400 MiB repository, the DHT schema has an extra 25 MiB of
redundant data that gets downloaded to the JGit process, and that is
before you consider the cost of the OBJECT_INDEX table also being
fully loaded, which is at least 223 MiB of data for the linux kernel
repository.  In the DHT schema answering a `git clone` of the ~400 MiB
linux kernel needs to load 248 MiB of "index" data from the DHT, in
addition to the ~400 MiB of pack data that gets sent to the client.
This is 193 MiB more data to be accessed than the native filesystem
format, but it needs to come over a much smaller pipe (local Ethernet
typically) than the local SATA disk drive.

I also never got around to writing the "repack" support for the DHT
schema, as it turns out to be fairly complex to safely repack data in
the repository while also trying to minimize the amount of changes
made to the database, due to very common limitations on database
mutation rates..

This new DFS storage layer fixes a lot of those issues by taking the
simple approach for storing relatively standard Git pack and index
files on an abstract filesystem. Packs are accessed by an in-process
buffer cache, similar to the WindowCache used by the local filesystem
storage layer. Unlike the local file IO, there are some assumptions
that the storage system has relatively high latency and no concept of
"file handles". Instead it looks at the file more like HTTP byte range
requests, where a read channel is a simply a thunk to trigger a read
request over the network.

The DFS code in this change is still abstract, it does not store on
any particular filesystem, but is fairly well suited to the Amazon S3
or Apache Hadoop HDFS. Storing packs directly on HDFS rather than
HBase removes a layer of abstraction, as most HBase row reads turn
into an HDFS read.

Most of the DFS code in this change was blatently copied from the
local filesystem code. Most parts should be refactored to be shared
between the two storage systems, but right now I am hesistent to do
this due to how well tuned the local filesystem code currently is.

Change-Id: Iec524abdf172e9ec5485d6c88ca6512cd8a6eafb

12 years agoMerge "Allow '\' in user names in URI-ish"
Shawn Pearce [Fri, 4 Nov 2011 17:10:47 +0000 (13:10 -0400)]
Merge "Allow '\' in user names in URI-ish"

12 years agoAllow '\' in user names in URI-ish 48/4548/1
Robin Rosenberg [Fri, 4 Nov 2011 16:53:44 +0000 (17:53 +0100)]
Allow '\' in user names in URI-ish

Actually this is not ok according to the RFC, but this implementation is
ment to be Git compatible. A '\' is needed when the authentication
requires or allows authentication to a Windows domain where the
user name can be specified as DOMAIN\user.

Change-Id: If02f258c032486f1afd2e09592a3c7069942eb8b

12 years agoMerge "Provide an id for submodule entries."
Shawn Pearce [Fri, 4 Nov 2011 14:14:46 +0000 (10:14 -0400)]
Merge "Provide an id for submodule entries."

12 years agoFix NPE when PATH environment variable is empty 28/4528/5
Carl Myers [Fri, 4 Nov 2011 13:42:12 +0000 (14:42 +0100)]
Fix NPE when PATH environment variable is empty

Change-Id: Ic27d509cd5e2d6c855e7d355fc308399d9dc01c9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoProvide an id for submodule entries. 04/4304/12
Kevin Sawicki [Fri, 4 Nov 2011 07:14:53 +0000 (08:14 +0100)]
Provide an id for submodule entries.

Open a repository for submodule entries that have a child .git
directory and use the resolved HEAD commit as the entry's id.

Change-Id: I68d6e127f018b24ee865865a2dd3011a0e21453c
Signed-off-by: Kevin Sawicki <kevin@github.com>
12 years agoMerge "Implement Config.Entry.toString() to help debugging"
Shawn Pearce [Thu, 3 Nov 2011 20:19:17 +0000 (16:19 -0400)]
Merge "Implement Config.Entry.toString() to help debugging"

12 years agoMerge "DirCacheEntry: accessors for cached creation time (CTIME)"
Shawn Pearce [Thu, 3 Nov 2011 20:18:43 +0000 (16:18 -0400)]
Merge "DirCacheEntry: accessors for cached creation time (CTIME)"

12 years agoSuppress unused and unchecked warnings 32/4532/1
Kevin Sawicki [Thu, 3 Nov 2011 10:03:01 +0000 (11:03 +0100)]
Suppress unused and unchecked warnings

Change-Id: I9f51cc749f5cb9d2e3aa86874e60fca29b779565
Signed-off-by: Kevin Sawicki <kevin@github.com>
12 years agoDirCacheEntry: accessors for cached creation time (CTIME) 50/4450/1
Marc Strapetz [Mon, 31 Oct 2011 16:45:51 +0000 (17:45 +0100)]
DirCacheEntry: accessors for cached creation time (CTIME)

Change-Id: I986d5fff63ff1a86cca6bab49c744ea673fe4892

12 years agoMerge "Ensure the ObjectInserter flushes after a merge"
Shawn O. Pearce [Sat, 29 Oct 2011 01:14:26 +0000 (21:14 -0400)]
Merge "Ensure the ObjectInserter flushes after a merge"

12 years agoDo not resolve path using cygwin unless told to 31/4431/1
Robin Rosenberg [Fri, 28 Oct 2011 12:58:32 +0000 (14:58 +0200)]
Do not resolve path using cygwin unless told to

The system property jgit.cygpath must be set to true in order
for cygwin's cygpath to be used to translate path from cygwin
namespace to Windows namespace.

The cygwin path translation should be considered deprecated.

Bug: 353389
Change-Id: I2b5234c0ab936dac67d1e232f4cd28331bf3226d
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
12 years agoImplement Config.Entry.toString() to help debugging 01/4401/2
Matthias Sohn [Thu, 27 Oct 2011 20:55:59 +0000 (22:55 +0200)]
Implement Config.Entry.toString() to help debugging

Change-Id: I86f6359d955d39ab033848b87ed39d20378d3c1f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
12 years agoMerge "Enable full Transport configuration for JGit API commands"
Shawn Pearce [Thu, 27 Oct 2011 14:25:18 +0000 (10:25 -0400)]
Merge "Enable full Transport configuration for JGit API commands"

12 years agoMerge "Close the repo in CloneCommandTest"
Christian Halstrick [Thu, 27 Oct 2011 12:57:06 +0000 (08:57 -0400)]
Merge "Close the repo in CloneCommandTest"

12 years agoEnsure the ObjectInserter flushes after a merge 12/4412/2
Shawn O. Pearce [Wed, 26 Oct 2011 21:42:51 +0000 (14:42 -0700)]
Ensure the ObjectInserter flushes after a merge

If this does not happen some databases may discard
objects and not make them available.

Change-Id: I347b3c3724db52c8a6c09f4804071497a3a377ab

12 years agoMerge changes I488e9c97,I30f1049f,I1c088dce
Matthias Sohn [Wed, 26 Oct 2011 21:29:23 +0000 (17:29 -0400)]
Merge changes I488e9c97,I30f1049f,I1c088dce

* changes:
  Cosmetic adjustment of relative date format, do not display "0 months"
  Make use of the many date formatting options in the log command
  Define a utility class for handling Git date formats

12 years agoCosmetic adjustment of relative date format, do not display "0 months" 83/4383/7
Robin Rosenberg [Thu, 20 Oct 2011 22:23:57 +0000 (00:23 +0200)]
Cosmetic adjustment of relative date format, do not display "0 months"

Though it may seem less precise, "0 months" looks bad and the reference
Git implementation also does not display "0 months"

Change-Id: I488e9c97656f9941788ae88d7c5c1562ab6c26f0

12 years agoMake use of the many date formatting options in the log command 82/4382/6
Robin Rosenberg [Sun, 9 Oct 2011 20:01:39 +0000 (22:01 +0200)]
Make use of the many date formatting options in the log command

Change-Id: I30f1049fce086f2cf7e39ba3ad8b335df3a7b827

12 years agoClose the repo in CloneCommandTest 10/4410/1
Robin Rosenberg [Wed, 26 Oct 2011 20:14:20 +0000 (22:14 +0200)]
Close the repo in CloneCommandTest

The test failed on Windows only

Change-Id: Ibff5308b33deb73570626a08a04e86ad8f418023

12 years agoMerge "Allow detecting which files were renamed during a revwalk"
Matthias Sohn [Wed, 26 Oct 2011 20:18:21 +0000 (16:18 -0400)]
Merge "Allow detecting which files were renamed during a revwalk"

12 years agoAllow detecting which files were renamed during a revwalk 69/4369/3
Carsten Pfeiffer [Tue, 25 Oct 2011 07:22:11 +0000 (09:22 +0200)]
Allow detecting which files were renamed during a revwalk

The egit history view shows the files associated with a commit by using
a PathFilter. When following renames with a FollowFilter, the PathFilter
cannot be configured anymore because the affected files are simply not
known.

Thus, it should be possible to get to know which files are renamed.

Bug: 302549
Change-Id: I4761e9f5cfb4f0ef0b0e1e38991401a1d5003bea

12 years agoFix compatibilty breakage for SystemReader 98/4398/1
Robin Rosenberg [Sun, 23 Oct 2011 20:53:17 +0000 (22:53 +0200)]
Fix compatibilty breakage for SystemReader

Introducing a new abstract method is not nice when one
expects other to subclass them. Create default implementations
so old code that implements SystemReader does not break.
The default methods just delegate to the JVM.

Change-Id: I42cdfdcb6b29f7203697a23833dca85185b0b9b3
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
12 years agoDefine a utility class for handling Git date formats 81/4381/4
Robin Rosenberg [Sat, 22 Oct 2011 23:51:30 +0000 (01:51 +0200)]
Define a utility class for handling Git date formats

Besides the formats known by git-log(1) we also add "locale"
and "localelocal" that formats dates according to the user's locale.
"locale" does not translate into local timezone, while
localelocal does.

Change-Id: I1c088dcec992c107e43f6c17be4ac9ed6eb428bf

13 years agoAdd locale to the properties manageable by SystemReader 80/4380/1
Robin Rosenberg [Sun, 9 Oct 2011 16:43:16 +0000 (18:43 +0200)]
Add locale to the properties manageable by SystemReader

Change-Id: I5e9af40d38bb671cb9fcdb0fa3b4eb3af5f36f6c

13 years agoAdd a method to SystemReader to get the time zone 79/4379/1
Robin Rosenberg [Sun, 9 Oct 2011 12:47:19 +0000 (14:47 +0200)]
Add a method to SystemReader to get the time zone

Change-Id: Ifd31f408ed2c5b7869694b715fea3219e74963ef

13 years agoUse the SystemReader to get system time 78/4378/1
Robin Rosenberg [Sun, 9 Oct 2011 12:47:49 +0000 (14:47 +0200)]
Use the SystemReader to get system time

Change-Id: Ib79c0cc964bfe799b204419e552b9aa6243966ce

13 years agoFix bad checkout behaviour when a file is removed 58/4358/4
Robin Rosenberg [Mon, 17 Oct 2011 06:28:19 +0000 (08:28 +0200)]
Fix bad checkout behaviour when a file is removed

We deleted the entry if there was a file and an index
entry, but not when there was just an index entry. Now
delete the file in both cases since the missing file
just means our worktree is dirty. This affected the
implementation of reset --hard.

Bug: 347574
Change-Id: Ie66fa61303472422830f5e33614e93ad65094e5d

13 years agoCorrect typo in RevWalk.parseBody comment 52/4352/2
Kevin Sawicki [Fri, 14 Oct 2011 15:49:17 +0000 (08:49 -0700)]
Correct typo in RevWalk.parseBody comment

Change-Id: I0e65a5a6809a8d32d256322dbcae94b6aa603e5e
Signed-off-by: Kevin Sawicki <kevin@github.com>
13 years agoMerge "Extend IndexDiff to calculate ignored files and folders"
Christian Halstrick [Mon, 10 Oct 2011 13:01:49 +0000 (09:01 -0400)]
Merge "Extend IndexDiff to calculate ignored files and folders"

13 years agoRefactor HTTP server stack to use Filter as base 32/4332/1
Shawn O. Pearce [Sat, 8 Oct 2011 00:23:58 +0000 (17:23 -0700)]
Refactor HTTP server stack to use Filter as base

All Git URLs operate off a suffix approach, for example the default
binding is for paths such as:

  */info/refs
  */git-upload-pack
  */git-receive-pack

These names are not common on project hosting servers, especially
one like Gerrit Code Review.

In addition to offering Git-over-HTTP as a servlet, offer it as a
filter that triggers when a matching suffix appears, but otherwise
delegates the request through the chain.  This filter would permit
Gerrit Code Review to place projects at the root of the server,
rather than within the "/p/" subdirectory, making the HTTP and SSH
URL structure exactly match each other.

To prevent breakage with existing users, the MetaServlet and
GitServlet are kept as wrappers delegating to their filters,
returning 404 Not Found when the filter has no match.

Change-Id: I2465c15c086497e0faaae5941159d80c028fa8b1

13 years agoMerge changes I7cdb563b,I7f60ae68,I7bd1e769,I92683805,I0e51a8e6
Shawn O. Pearce [Fri, 7 Oct 2011 20:00:21 +0000 (16:00 -0400)]
Merge changes I7cdb563b,I7f60ae68,I7bd1e769,I92683805,I0e51a8e6

* changes:
  UploadPack: Fix races in smart HTTP negotiation
  PackWriter: Export more statistics
  Do not requeue state vector in stateless RPC fetch
  Wrap excessively long line in BasePackFetchConnection
  Fix smart HTTP client stream alignment errors

13 years agoExtend IndexDiff to calculate ignored files and folders 20/4320/4
Jens Baumgart [Wed, 5 Oct 2011 11:56:23 +0000 (13:56 +0200)]
Extend IndexDiff to calculate ignored files and folders

IndexDiff was extended to calculate ignored files and folders.
The calculation only considers files that are NOT in the index.
This functionality is required by the new EGit decorator implementation.

Bug: 359264
Change-Id: I8f09d6a4d61b64aeea80fd22bf3a2963c2bca347
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
13 years agoMerge "Fix DirCacheEdtor.DeleteTree for empty string argument"
Christian Halstrick [Wed, 5 Oct 2011 10:21:01 +0000 (06:21 -0400)]
Merge "Fix DirCacheEdtor.DeleteTree for empty string argument"

13 years agoAdd missing comment text for mergeCommitTree parameter 62/4062/2
Kevin Sawicki [Wed, 24 Aug 2011 01:41:05 +0000 (18:41 -0700)]
Add missing comment text for mergeCommitTree parameter

Change-Id: I35cef13d8be4f06515668f710fd508700b90f44d
Signed-off-by: Kevin Sawicki <kevin@github.com>
13 years agoDo not attempt to resolve describe-labels with less than four digits 70/4170/2
Robin Rosenberg [Tue, 6 Sep 2011 15:37:53 +0000 (17:37 +0200)]
Do not attempt to resolve describe-labels with less than four digits

Change-Id: I21dcd3cca3b41102fd898238d8d640dea25e0caf
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
13 years agoFix DirCacheEdtor.DeleteTree for empty string argument 90/4290/2
Robin Rosenberg [Sat, 24 Sep 2011 22:18:24 +0000 (00:18 +0200)]
Fix DirCacheEdtor.DeleteTree for empty string argument

Change-Id: I7425da91c0752ae82484e3c29d21b57402d30c61