]> source.dussan.org Git - jgit.git/log
jgit.git
11 years agoAvoid TemporaryBuffer.Heap on very small deltas 07/11807/4
Shawn Pearce [Thu, 11 Apr 2013 07:49:42 +0000 (00:49 -0700)]
Avoid TemporaryBuffer.Heap on very small deltas

TemporaryBuffer is great when the output size is not known, but must
be bound by a relatively large upper limit that fits in memory, e.g.
64 KiB or 20 MiB.  The buffer gracefully supports growing storage by
allocating 8 KiB blocks and storing them in an ArrayList.

In a Git repository many deltas are less than 8 KiB.  Typical tree
objects are well below this threshold, and their deltas must be
encoded even smaller.

For these much smaller cases avoid the 8 KiB minimum allocation used
by TemporaryBuffer.  Instead allocate a very small OutputStream
writing to an array that is sized at the limit.

Change-Id: Ie25c6d3a8cf4604e0f8cd9a3b5b701a592d6ffca

11 years agoCorrect distribution of allowed delta size along chain length 06/11806/4
Shawn Pearce [Thu, 11 Apr 2013 07:30:15 +0000 (00:30 -0700)]
Correct distribution of allowed delta size along chain length

Nicolas Pitre discovered a very simple rule for selecting between two
different delta base candidates:

  - if based whole object, must be <= 50% of target
  - if at end of a chain, must be <= 1/depth * 50% of target

The rule penalizes deltas near the end of the chain, requiring them to
be very small in order to be kept by the packer.  This favors deltas
that are based on a shorter chain, where the read-time unpack cost is
much lower.  Fewer bytes need to be consulted from the source pack
file, and less copying is required in memory to rebuild the object.

Junio Hamano explained Nico's rule to me today, and this commit fixes
DeltaWindow to implement it as described.

When no base has been chosen the computation is simply the statements
denoted above.  However once a base with depth of 9 has been chosen
(e.g.  when pack.depth is limited to 10), a non-delta source may
create a new delta that is up to 10x larger than the already selected
base.  This reflects the intent of Nico's size distribution rule no
matter what order objects are visited in the DeltaWindow.

With this patch and my other patches applied, repacking JGit with:

  [pack]
    reuseObjects = false
    reuseDeltas = false
    depth = 50
    window = 250
    threads = 4
    compression = 9

  CGit (all) 5,711,735 bytes; real 0m13.942s user 0m47.722s [1]
  JGit heads 5,718,295 bytes; real 0m11.880s user 0m38.177s [2]
       rest      9,809 bytes

The improved JGit result for the head pack is only 6.4 KiB larger than
CGit's resulting pack.  This patch allowed JGit to find an additional
39.7 KiB worth of space savings.  JGit now also often runs 2s faster
than CGit, despite also creating bitmaps and pruning objects after the
head pack creation.

[1] time git repack -a -d -F --window=250 --depth=50
[2] time java -Xmx128m -jar jgit debug-gc

Change-Id: I5caec31359bf7248cabdd2a3254c84d4ee3cd96b

11 years agoSplit remaining delta work on path boundaries 38/11838/4
Shawn Pearce [Thu, 11 Apr 2013 22:32:07 +0000 (15:32 -0700)]
Split remaining delta work on path boundaries

When an idle thread tries to steal work from a sibling's remaining
toSearch queue, always try to split along a path boundary. This
avoids missing delta opportunities in the current window of the
thread whose work is being taken.

The search order is reversed to walk further down the chain from
current position, avoiding the risk of splitting the list within
the path the thread is currently processing.

When selecting which thread to split from use an accurate estimate
of the size to be taken. This avoids selecting a thread that has
only one path remaining but may contain more pending entries than
another thread with several paths remaining.

As there is now a race condition where the straggling thread can
start the next path before the split can finish, the stealWork()
loop spins until it is able to acquire a split or there is only
one path remaining in the siblings.

Change-Id: Ib11ff99f90a4d9efab24bf4a85342cc63203dba5

11 years agoReplace DeltaWindow array with circularly linked list 04/11804/2
Shawn Pearce [Thu, 11 Apr 2013 05:29:32 +0000 (22:29 -0700)]
Replace DeltaWindow array with circularly linked list

Typical window sizes are 10 and 250 (although others are accepted).
In either case the pointer overhead of 1 pointer in an array or
2 pointers for a double linked list is trivial.  A doubly linked
list as used here for window=250 is only another 1024 bytes on a
32 bit machine, or 2048 bytes on a 64 bit machine.

The critical search loops scan through the array in either the
previous direction or the next direction until the cycle is finished,
or some other scan abort condition is reached.  Loading the next
object's pointer from a field in the current object avoids the
branch required to test for wrapping around the edge of the array.
It also saves the array bounds check on each access.

When a delta is chosen the window is shuffled to hoist the currently
selected base as an earlier candidate for the next object. Moving
the window entry is easier in a double-linked list than sliding a
group of array entries.

Change-Id: I9ccf20c3362a78678aede0f0f2cda165e509adff

11 years agoMicro-optimize copy instructions in DeltaEncoder 03/11803/1
Shawn Pearce [Thu, 11 Apr 2013 08:11:11 +0000 (01:11 -0700)]
Micro-optimize copy instructions in DeltaEncoder

The copy instruction formatter should not to compute the shifts and
masks twice.  Instead compute them once and assume there is a register
available to store the temporary "b" for compare with 0.

Change-Id: Ic7826f29dca67b16903d8f790bdf785eb478c10d

11 years agoMicro-optimize DeltaWindow primary loop 02/11802/1
Shawn Pearce [Thu, 11 Apr 2013 04:27:54 +0000 (21:27 -0700)]
Micro-optimize DeltaWindow primary loop

javac and the JIT are more likely to understand a boolean being
used as a branch conditional than comparing int against 0 and 1.
Rewrite NEXT_RES and NEXT_SRC constants to be booleans so the
code is clarified for the JIT.

Change-Id: I1bdd8b587a69572975a84609c779b9ebf877b85d

11 years agoMicro-optimize DeltaWindow maxMemory test to be != 0 01/11801/1
Shawn Pearce [Thu, 11 Apr 2013 05:21:18 +0000 (22:21 -0700)]
Micro-optimize DeltaWindow maxMemory test to be != 0

Instead of using a compare-with-0 use a does not equal 0.
javac bytecode has a special instruction for this, as it
is very common in software. We can assume the JIT knows
how to efficiently translate the opcode to machine code,
and processors can do != 0 very quickly.

Change-Id: Idb84c1d744d2874517fd4bfa1db390e2dbf64eac

11 years agoMark DeltaWindowEntry methods final 00/11800/1
Shawn Pearce [Thu, 11 Apr 2013 04:19:46 +0000 (21:19 -0700)]
Mark DeltaWindowEntry methods final

This class and all of its methods are only package visible.
Clarify the methods as final for the benefit of the JIT to
inline trivial code.

Change-Id: I078841f9900dbf299fbe6abf2599f0208ae96856

11 years agoMerge changes Ideecc472,I2b12788a,I6cb9382d,I12cd3326,I200baa0b,I05626f2e,I65e45422
Shawn Pearce [Thu, 11 Apr 2013 00:56:13 +0000 (20:56 -0400)]
Merge changes Ideecc472,I2b12788a,I6cb9382d,I12cd3326,I200baa0b,I05626f2e,I65e45422

* changes:
  Increase PackOutputStream copy buffer to 64 KiB
  Tighten object header writing in PackOutuptStream
  Skip main thread test in ThreadSafeProgressMonitor
  Declare members of PackOutputStream final
  Always allocate the PackOutputStream copyBuffer
  Disable CRC32 computation when no PackIndex will be created
  Steal work from delta threads to rebalance CPU load

11 years agoMerge "LogCommand.all(): filter out refs that do not refer to commit objects"
Robin Rosenberg [Wed, 10 Apr 2013 21:30:18 +0000 (17:30 -0400)]
Merge "LogCommand.all(): filter out refs that do not refer to commit objects"

11 years agoMerge "LogCommand.all(), peel references before using them"
Robin Rosenberg [Wed, 10 Apr 2013 21:29:58 +0000 (17:29 -0400)]
Merge "LogCommand.all(), peel references before using them"

11 years agoIncrease PackOutputStream copy buffer to 64 KiB 85/11785/1
Shawn Pearce [Wed, 10 Apr 2013 20:05:58 +0000 (13:05 -0700)]
Increase PackOutputStream copy buffer to 64 KiB

Colby just pointed out to me the buffer was 16 KiB. This may
be very small for common objects. Increase to 64 KiB.

Change-Id: Ideecc4720655a57673252f7adb8eebdf2fda230d

11 years agoTighten object header writing in PackOutuptStream 84/11784/3
Shawn Pearce [Wed, 10 Apr 2013 17:17:25 +0000 (10:17 -0700)]
Tighten object header writing in PackOutuptStream

Most objects are written as OFS_DELTA with the base in the pack,
that is why this case comes first in writeHeader(). Rewrite the
condition to always examine this first and cache the PackWriter's
formatting flag for use of OFS_DELTA headers, in modern Git networks
this is true more often then it it is false.

Assume the cost of write() is high, especially due to entering the
MessageDigest to update the pack footer SHA-1 computation. Combine
the OFS_DELTA information as part of the header buffer so that the
entire burst is a single write call, rather than two relatively
small ones. Most OFS_DELTA headers are <= 6 bytes, so this rewrite
tranforms 2 writes of 3 bytes each into 1 write of ~6 bytes.

Try to simplify the objectHeader code to reduce branches and use
more local registers. This shouldn't really be necessary if the
compiler is well optimized, but it isn't very hard to clarify data
usage to either javac or the JIT, which may make it easier for the
JIT to produce better machine code for this method.

Change-Id: I2b12788ad6866076fabbf7fa11f8cce44e963f35

11 years agoSkip main thread test in ThreadSafeProgressMonitor 82/11782/3
Shawn Pearce [Wed, 10 Apr 2013 16:41:55 +0000 (09:41 -0700)]
Skip main thread test in ThreadSafeProgressMonitor

update(int) is only invoked from a worker thread, in JGit's case
this is DeltaTask. The Javadoc of TSPM suggests update should only
ever be used by a worker thread.

Skip the main thread check, saving some cycles on each run of the
progress monitor.

Change-Id: I6cb9382d71b4cb3f8e8981c7ac382da25304dfcb

11 years agoDeclare members of PackOutputStream final 81/11781/2
Shawn Pearce [Wed, 10 Apr 2013 16:37:19 +0000 (09:37 -0700)]
Declare members of PackOutputStream final

These methods cannot be sanely overridden anywhere. Most methods
are package visible only, or are private. A few public methods do
exist but there is no useful way to override them since creation
of PackOutputStream is managed by PackWriter and cannot be delegated.

Change-Id: I12cd3326b78d497c1f9751014d04d1460b46e0b0

11 years agoAlways allocate the PackOutputStream copyBuffer 80/11780/2
Shawn Pearce [Wed, 10 Apr 2013 16:33:56 +0000 (09:33 -0700)]
Always allocate the PackOutputStream copyBuffer

The getCopyBuffer() is almost always used during output. All known
implementations of ObjectReuseAsIs rely on the buffer to be present,
and the only sane way to get good performance from PackWriter is to
reuse objects during packing.

Avoid a branch and test when obtaining this buffer by making sure
it is always populated.

Change-Id: I200baa0bde5dcdd11bab7787291ad64535c9f7fb

11 years agoDisable CRC32 computation when no PackIndex will be created 79/11779/2
Shawn Pearce [Wed, 10 Apr 2013 16:30:23 +0000 (09:30 -0700)]
Disable CRC32 computation when no PackIndex will be created

If a server is streaming 3GiB worth of pack data to a client there
is no reason to compute the CRC32 checksum on the objects. The
CRC32 code computed by PackWriter is used only in the new index
created by writeIndex(), which is never invoked for the native Git
network protocols.

Object reuse may still compute its own CRC32 to verify the data
being copied from an existing pack has not been corrupted. This
check is done by the ObjectReader that implements ObjectReuseAsIs
and has no relationship to the CRC32 being skipped during output.

Change-Id: I05626f2e0d6ce19119b57d8a27193922636d60a7

11 years agoSteal work from delta threads to rebalance CPU load 39/11739/5
Shawn Pearce [Tue, 9 Apr 2013 01:11:30 +0000 (18:11 -0700)]
Steal work from delta threads to rebalance CPU load

If the configuration wants to run 4 threads the delta search work
is initially split somewhat evenly across the 4 threads. During
execution some threads will finish early due to the work not being
split fairly, as the initial partitions were based on object count
and not cost to inflate or size of DeltaIndex.

When a thread finishes early it now tries to take 50% of the work
remaining on a sibling thread, and executes that before exiting.
This repeats as each thread completes until a thread has only 1
object remaining.

Repacking Blink, Chromium's new fork of WebKit (2.2M objects 3.9G):

  [pack]
    reuseDeltas = false
    reuseObjects = false
    depth = 50
    threads = 8
    window = 250
    windowMemory = 800m

  before: ~105% CPU after 80%
  after:  >780% CPU to 100%

Change-Id: I65e45422edd96778aba4b6e5a0fd489ea48e8ca3

11 years agoMerge "clean up merge squash and no-commit messages in pgm"
Christian Halstrick [Tue, 9 Apr 2013 07:09:33 +0000 (03:09 -0400)]
Merge "clean up merge squash and no-commit messages in pgm"

11 years agoAdd a constant for info/exclude 64/11564/3
Robin Rosenberg [Fri, 29 Mar 2013 23:03:08 +0000 (00:03 +0100)]
Add a constant for info/exclude

Change-Id: Ifd537ce4e726cb9460ea332f683428689bd3d7f4

11 years agoMerge changes I8445070d,I38f10d62,I2af0bf68
Matthias Sohn [Mon, 8 Apr 2013 21:25:01 +0000 (17:25 -0400)]
Merge changes I8445070d,I38f10d62,I2af0bf68

* changes:
  Fix plugin provider names to conform with release train requirement
  Add missing @since tags for new API methods
  DfsReaderOptions are options for a DFS stored repository

11 years agoFix plugin provider names to conform with release train requirement 35/11735/1
Matthias Sohn [Mon, 8 Apr 2013 20:54:45 +0000 (22:54 +0200)]
Fix plugin provider names to conform with release train requirement

According to release train requirements [1] the provider name for all
artifacts of Eclipse projects is "Eclipse <project name>".

[1] http://wiki.eclipse.org/Development_Resources/HOWTO/Release_Reviews#Checklist

Change-Id: I8445070d1d96896d378bfc49ed062a5e7e0f201f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoclean up merge squash and no-commit messages in pgm 39/11639/2
Tomasz Zarna [Thu, 4 Apr 2013 14:31:07 +0000 (16:31 +0200)]
clean up merge squash and no-commit messages in pgm

Change-Id: Iffa6e8752fbd94f3ef69f49df772be82e3da5d05

11 years agoDetect and handle a checkout conflict during merge nicely 00/11700/2
Robin Rosenberg [Sat, 6 Apr 2013 12:03:24 +0000 (14:03 +0200)]
Detect and handle a checkout conflict during merge nicely

Report the conflicting files nicely and inform the user.

Change-Id: I75d464d4156d10c6cc6c7ce5a321e2c9fb0df375

11 years agoAdd missing @since tags for new API methods 08/11708/3
Matthias Sohn [Sun, 7 Apr 2013 21:17:02 +0000 (23:17 +0200)]
Add missing @since tags for new API methods

Change-Id: I38f10d622c30f19d1154a4901477e844cb411707
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoDfsReaderOptions are options for a DFS stored repository 07/11707/1
Matthias Sohn [Wed, 3 Apr 2013 22:40:33 +0000 (00:40 +0200)]
DfsReaderOptions are options for a DFS stored repository

Change-Id: I2af0bf686188f1402fb53bf6dbe0ecb228069ace
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoSupport cutting existing delta chains longer than the max depth 85/11685/1
Shawn Pearce [Fri, 5 Apr 2013 17:02:01 +0000 (10:02 -0700)]
Support cutting existing delta chains longer than the max depth

Some packs built by JGit have incredibly long delta chains due to a
long standing bug in PackWriter. Google has packs created by JGit's
DfsGarbageCollector with chains of 6000 objects long, or more.

Inflating objects at the end of this 6000 long chain is impossible
to complete within a reasonable time bound. It could take a beefy
system hours to perform even using the heavily optimized native C
implementation of Git, let alone with JGit.

Enable pack.cutDeltaChains to be set in a configuration file to
permit the PackWriter to determine the length of each delta chain
and clip the chain at arbitrary points to fit within pack.depth.

Delta chain cycles are still possible, but no attempt is made to
detect them. A trivial chain of A->B->A will iterate for the full
pack.depth configured limit (e.g. 50) and then pick an object to
store as non-delta.

When cutting chains the object list is walked in reverse to try
and take advantage of existing chain computations. The assumption
here is most deltas are near the end of the list, and their bases
are near the front of the list. Going up from the tail attempts to
reuse chainLength computations by relying on the memoized value in
the delta base.

The chainLength field in ObjectToPack is overloaded into the depth
field normally used by DeltaWindow. This is acceptable because the
chain cut happens before delta search, and the chainLength is reset
to 0 if delta search will follow.

Change-Id: Ida4fde9558f3abbbb77ade398d2af3941de9c812

11 years agoMicro-optimize reuseDeltaFor in PackWriter 84/11684/1
Shawn Pearce [Fri, 5 Apr 2013 16:42:29 +0000 (09:42 -0700)]
Micro-optimize reuseDeltaFor in PackWriter

This switch is called mostly for OBJ_TREE and OBJ_BLOB types, which
typically make up 66% of the objects in a repository. Simplify the
test for these common types by testing for the one bit they have in
common and returning early.

Object type 5 is currently undefined. In the old code it would hit
the default and return true. In the new code it will match the early
case and also return true. In either implementation 5 should never show
up as it is not a valid type known to Git.

Object type 6 OFS_DELTA is not permitted to be supplied here.
Object type 7 REF_DELTA is not permitted to be supplied here.

Change-Id: I0ede8acee928bb3e73c744450863942064864e9c

11 years agoStatic import OBJ_* constants into PackWriter 83/11683/1
Shawn Pearce [Fri, 5 Apr 2013 16:38:04 +0000 (09:38 -0700)]
Static import OBJ_* constants into PackWriter

Shortens most of the code that touches the objectLists.

Change-Id: Ib14d366dd311e544e7ba50e9ce07a6f3ce0cf254

11 years agoRenumber internal ObjectToPack flags 69/11669/1
Shawn Pearce [Fri, 5 Apr 2013 02:43:12 +0000 (19:43 -0700)]
Renumber internal ObjectToPack flags

Now that WANT_WRITE is gone renumber the flags to move the unused
bit next to the type. Recluster AS_IS and DELTA_ATTEMPTED to be
next to each other since these bits are tested as a pair.

Change-Id: I42994b5ff1f67435e15c3f06d02e3b82141e8f08

11 years agoMove wantWrite flag to be special offset 1 68/11668/1
Shawn Pearce [Fri, 5 Apr 2013 00:50:32 +0000 (17:50 -0700)]
Move wantWrite flag to be special offset 1

Free up the WANT_WRITE flag in ObjectToPack by switching the test
to use the special offset value of 1. The Git pack file format
calls for the first 4 bytes to be 'PACK', which means any object
must start at an offset >= 4. Current versions require another 8
bytes in the header, placing the first object at offset = 12.

So offset = 1 is an invalid location for an object, and can be
used as a marker signal to indicate the writing loop has tried
to write the object, but recursed into the base first. When an
object is visited with offset == 1 it means there is a cycle in
the delta base path, and the cycle must be broken.

Change-Id: I2d05b9017c5f9bd9464b91d43e8d4b4a085e55bc

11 years agoDon't delta compress garbage objects 65/11665/1
Shawn Pearce [Thu, 4 Apr 2013 22:23:08 +0000 (15:23 -0700)]
Don't delta compress garbage objects

Garbage is randomly ordered and unlikely to delta compress against
other garbage. Disable delta compression allowing objects to switch
to whole form when moving to the garbage pack.

Because the garbage is not well compressed assume deltas were not
attempted during a normal GC cycle.

Override the reuse settings, garbage that can be reused should be
reused as-is into the garbage pack rather than switching something
like the compression level during a GC. It is intended that garbage
will eventually be removed from the repository so expending CPU
time on a compression switch is not worthwhile.

Change-Id: I0e8e58ee99e5011d375d3d89c94f2957de8402b9

11 years agoDelete broken DFS read-ahead support 64/11664/1
Shawn Pearce [Thu, 4 Apr 2013 22:06:57 +0000 (15:06 -0700)]
Delete broken DFS read-ahead support

This implementation has been proven to deadlock in production server
loads. Google has been running with it disabled for a quite a while,
as the bugs have been difficult to identify and fix.

Instead of suggesting it works and is useful, drop the code. JGit
should not advertise support for functionality that is known to
be broken.

In a few of the places where read-ahead was enabled by DfsReader
there is more information about what blocks should be loaded when.
During object representation selection, or size lookup, or sending
object as-is to a PackWriter, or sending an entire pack as-is the
reader knows exactly which blocks are required in the cache, and it
also can compute when those will be needed. The broken read-ahead
code was stupid and just read a fixed amount ahead of the current
offset, which can waste IOs if more precise data was available.

DFS systems are usually slow to respond so read-ahead is still
a desired feature, but it needs to be rebuilt from scratch and
make better use of the offset information.

Change-Id: Ibaed8288ec3340cf93eb269dc0f1f23ab5ab1aea

11 years agoOptimize DFS object reuse selection code 55/11655/4
Shawn Pearce [Thu, 4 Apr 2013 19:18:22 +0000 (12:18 -0700)]
Optimize DFS object reuse selection code

Rewrite this complicated logic to examine each pack file exactly
once. This reduces thrashing when there are many large pack files
present and the reader needs to locate each object's header.

The intermediate temporary list is now smaller, it is bounded to
the same length as the input object list. In the prior version of
this code the list contained one entry for every representation of
every object being packed.

Only one representation object is allocated, reducing the overall
memory footprint to be approximately one reference per object found
in the current pack file (the pointer in the BlockList). This saves
considerable working set memory compared to the prior version that
made and held onto a new representation for every ObjectToPack.

Change-Id: I2c1f18cd6755643ac4c2cf1f23b5464ca9d91b22

11 years agoSimplify size test in PackWriter 54/11654/1
Shawn Pearce [Thu, 4 Apr 2013 18:23:16 +0000 (11:23 -0700)]
Simplify size test in PackWriter

Clip the configured limit to Integer.MAX_VALUE at the top of the
loop, saving a compare branch per object considered. This can cut
2M branches out of a repacking of the Linux kernel.

Rewrite the logic so the primary path is to match the conditional;
most objects are larger than BLKSZ (16 bytes) and less than limit.
This may help branch prediction on CPUs if the CPU tries to assume
execution takes the side of the branch and not the second.

Change-Id: I5133d1651640939afe9fbcfd8cfdb59965c57d5a

11 years agoDeclare critical exposed methods of ObjectToPack final 53/11653/1
Shawn Pearce [Thu, 4 Apr 2013 18:17:07 +0000 (11:17 -0700)]
Declare critical exposed methods of ObjectToPack final

There is no reasonable way for a subclass to correctly override and
implement these methods. They depend on internal state that cannot
otherwise be managed.

Most of these methods are also in critical paths of PackWriter.
Declare them final so subclasses do not try to replace them,
and so the JIT knows the smaller ones can be safely inlined.

Change-Id: I9026938e5833ac0b94246d21c69a143a9224626c

11 years agoDeclare internal flag accessors of ObjectToPack final 52/11652/1
Shawn Pearce [Thu, 4 Apr 2013 18:14:38 +0000 (11:14 -0700)]
Declare internal flag accessors of ObjectToPack final

None of these methods should ever be overridden at runtime by an
extension class. Given how small they are the JIT should perform
inlining where reasonable. Hint this is possible by marking all
methods final so its clear no replacement can be loaded later on.

Change-Id: Ia75a5d36c6bd25b24169e2bdfa360c8f52b669cd

11 years agoRemove unused method isDeltaAttempted() 51/11651/1
Shawn Pearce [Thu, 4 Apr 2013 18:03:30 +0000 (11:03 -0700)]
Remove unused method isDeltaAttempted()

This flag is never checked on its own. It is only checked as part
of a pair through the doNotAttemptDelta() method. Delete the method
so there is less confusion about the flag being used on its own.

Change-Id: Id7088caa649599f4f11d633412c2a2af0fd45dd8

11 years agoSimplify setDoNotDelta() to always set the flag 50/11650/1
Shawn Pearce [Thu, 4 Apr 2013 17:53:22 +0000 (10:53 -0700)]
Simplify setDoNotDelta() to always set the flag

This method is only invoked with true as the argument.
Remove the unnecessary parameter and branch, making
the code easier for the JIT to optimize.

Change-Id: I68a9cd82f197b7d00a524ea3354260a0828083c6

11 years agoAdd the no-commit option to MergeCommand 45/4945/6
Tomasz Zarna [Thu, 12 Jan 2012 17:32:53 +0000 (18:32 +0100)]
Add the no-commit option to MergeCommand

Added also tests and the associated option for the command line Merge
command.

Bug: 335091
Change-Id: Ie321c572284a6f64765a81674089fc408a10d059
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoMerge "Fix PathFilterGroup not to throw StopWalkException too early"
Christian Halstrick [Thu, 4 Apr 2013 07:42:25 +0000 (03:42 -0400)]
Merge "Fix PathFilterGroup not to throw StopWalkException too early"

11 years agoMerge "Indicate initial commit on a branch in the reflog"
Christian Halstrick [Thu, 4 Apr 2013 07:41:56 +0000 (03:41 -0400)]
Merge "Indicate initial commit on a branch in the reflog"

11 years agoFix PathFilterGroup not to throw StopWalkException too early 97/11597/3
Robin Rosenberg [Tue, 2 Apr 2013 07:00:58 +0000 (09:00 +0200)]
Fix PathFilterGroup not to throw StopWalkException too early

Due to the Git internal sort order a directory is sorted as if it ended
with a '/', this means that the path filter didn't set the last possible
matching entry to the correct value. In the reported issue we had the
following filters.

org.eclipse.jgit.console
org.eclipse.jgit

As an optimization we throw a StopWalkException when the walked tree
passes the last possible filter, which was this:
org.eclipse.jgit.console

Due to the git sorting order, the tree was processed in this order:
org.eclipse.jgit.console
org.eclipse.jgit.test
org.eclipse.jgit

At org.eclipse.jgit.test we threw the StopWalkException preventing the
walk from completing successfully.

A correct last possible match should be:
org.eclipse.jgit/

For simplicit we define it as:
org/eclipse/jgit/

This filter would be the maximum if we also had e.g. org and org.eclipse
in the filter, but that would require more work so we simply replace all
characters lower than '/' by a slash.

We believe the possible extra walking does not not warrant the extra
analysis.

Bug: 362430
Change-Id: I4869019ea57ca07d4dff6bfa8e81725f56596d9f

11 years agoIndicate initial commit on a branch in the reflog 65/11565/4
Robin Rosenberg [Fri, 29 Mar 2013 22:59:21 +0000 (23:59 +0100)]
Indicate initial commit on a branch in the reflog

Bug: 393463
Change-Id: I4733d6f719bc0dc694e7a6a6ad2092de6364898c

11 years agoLogCommand.all(): filter out refs that do not refer to commit objects 69/11569/1
Arthur Baars [Sun, 31 Mar 2013 14:28:47 +0000 (15:28 +0100)]
LogCommand.all(): filter out refs that do not refer to commit objects

 1. I have authored 100% of the content I'm contributing,
 2. I have the rights to donate the content to Eclipse,
 3. I contribute the content under the EDL

Change-Id: I48b1828e0b1304f76276ec07ebac7ee9f521b194

11 years agoLogCommand.all(), peel references before using them 13/10813/5
Arthur Baars [Mon, 4 Mar 2013 11:14:16 +0000 (11:14 +0000)]
LogCommand.all(), peel references before using them

Problem:
LogCommand.all() throws an IncorrectObjectTypeException when
there are tag references, and the repository does not contain
the file "packed-refs". It seems that the references were not properly
peeled before being added to the markStart() method.

Solution:
Call getRepository().peel() on every Ref that has isPeeled()==false
in LogCommand.all() .

Added test case for LogCommand.all() on repo with a tag.

 1. I have authored 100% of the content I'm contributing,
 2. I have the rights to donate the content to Eclipse,
 3. I contribute the content under the EDL

Bug: 402025
Change-Id: Idb8881eeb6ccce8530f2837b25296e8e83636eb7

11 years agoSpeed up clone/fetch with large number of refs 48/10448/4
Robin Rosenberg [Mon, 18 Feb 2013 19:25:00 +0000 (20:25 +0100)]
Speed up clone/fetch with large number of refs

Instead of re-reading all refs after each update, execute
the deletes first, then read all refs once and perform
the check for conflicting ref names in memory.

Change-Id: I17d0b3ccc27f868c8497607d8e57bf7082e65ba3

11 years agoMerge "When renaming the lock file succeeds the lock isn't held anymore"
Robin Rosenberg [Thu, 28 Mar 2013 19:57:38 +0000 (15:57 -0400)]
Merge "When renaming the lock file succeeds the lock isn't held anymore"

11 years agoFix CommitCommand amend mode to preserve parent order 53/11553/1
Shawn Pearce [Thu, 28 Mar 2013 17:58:21 +0000 (13:58 -0400)]
Fix CommitCommand amend mode to preserve parent order

Change-Id: I476921ff8dfa6a357932d42ee59340873502b582

11 years agoFixed parsing of URI with a IPv6-address 28/9228/2
Andreas König [Thu, 13 Dec 2012 16:43:59 +0000 (17:43 +0100)]
Fixed parsing of URI with a IPv6-address

Allowed ipv6-address in a uri like:
  http://[::1]:8080/repo.git

Change-Id: Ia00a20f694b2e9314892df77f9b11f551bb1d34e
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
11 years agoNew functions to facilitate the writing of CLI test cases 63/5963/6
François Rey [Thu, 13 Sep 2012 22:11:18 +0000 (00:11 +0200)]
New functions to facilitate the writing of CLI test cases

Writing CLI test cases is tedious because of all the formatting and
escaping subtleties needed when comparing actual output with what's
expected. While creating a test case the two new functions are to be
used instead of the existing execute() in order to prepare the correct
command and expected output and to generate the corresponding test code
that can be pasted into the test case function.

Change-Id: Ia66dc449d3f6fb861c300fef8b56fba83a56c94c
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
11 years agoMerge "File.renameTo behaves differently on Unix and Windows"
Matthias Sohn [Wed, 27 Mar 2013 13:09:04 +0000 (09:09 -0400)]
Merge "File.renameTo behaves differently on Unix and Windows"

11 years agoMerge "Extend FileUtils.rename to common git semantics"
Matthias Sohn [Wed, 27 Mar 2013 13:03:23 +0000 (09:03 -0400)]
Merge "Extend FileUtils.rename to common git semantics"

11 years agoWhen renaming the lock file succeeds the lock isn't held anymore 98/11498/1
Matthias Sohn [Tue, 26 Mar 2013 20:20:19 +0000 (21:20 +0100)]
When renaming the lock file succeeds the lock isn't held anymore

This wrong book-keeping caused IOExceptions to be thrown because
LockFile.unlock() erroneously tried to delete the non-existing lock
file. These IOExeptions were hidden since they were silently caught.

Change-Id: If42b6192d92c5a2d8f2bf904b16567ef08c32e89
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoAlways add FileExt to DfsPackDescription 82/11482/1
Shawn Pearce [Tue, 26 Mar 2013 17:57:19 +0000 (13:57 -0400)]
Always add FileExt to DfsPackDescription

Instead of forcing the implementation of the DFS backend to handle
making sure the extension bits are set correctly, have the common
callers in JGit set the extension at the same time they supply the
file sizes to the pack description. This simplifies assumptions for
an implementation of the DFS backend.

Change-Id: I55142ad8ea08a3e2e8349f72b3714578eba9c342

11 years agoFile.renameTo behaves differently on Unix and Windows 21/11321/4
Robin Rosenberg [Tue, 19 Mar 2013 13:19:28 +0000 (14:19 +0100)]
File.renameTo behaves differently on Unix and Windows

On Windows renameTo will not overwrite a file, so it must be deleted
first. The fix for Bug 402834 did not account for that.

Bug: 403685
Change-Id: I3453342c17e064dcb50906a540172978941a10a6

11 years agoExtend FileUtils.rename to common git semantics 14/11414/3
Robin Rosenberg [Sun, 24 Mar 2013 00:06:29 +0000 (01:06 +0100)]
Extend FileUtils.rename to common git semantics

Unlike the OS or Java rename this method will (on *nix) try (on Windows)
replace the target with the source provided the target does not exist,
the target does exist and is a file, or if it is a directory which only
contains directories. In the latter case the directory hierarchy will be
deleted.
If the initial rename fails and the target is an existing file the the
target file will be deleted first and then the rename is retried.

Change-Id: Iae75c49c85445ada7795246a02ce02f7c248d956
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
11 years agoMerge "Add tests for FileUtils.delete and EMPTY_DIREECTORIES_ONLY"
Christian Halstrick [Sun, 24 Mar 2013 22:59:31 +0000 (18:59 -0400)]
Merge "Add tests for FileUtils.delete and EMPTY_DIREECTORIES_ONLY"

11 years agoUpdate build to Tycho 0.17 16/11416/1
Matthias Sohn [Sun, 24 Mar 2013 03:31:23 +0000 (04:31 +0100)]
Update build to Tycho 0.17

Change-Id: I92c9757a37644ec48ed1d785f4dacd6c44276632
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoAdd tests for FileUtils.delete and EMPTY_DIREECTORIES_ONLY 12/11412/3
Robin Rosenberg [Sat, 23 Mar 2013 23:49:23 +0000 (00:49 +0100)]
Add tests for FileUtils.delete and EMPTY_DIREECTORIES_ONLY

Change-Id: I54a46c29df5eafc7739a6ef29e5dc80fa2f6d9ba

11 years agoSimpleHttpServer API shouldn't expose internals 01/11401/1
Matthias Sohn [Fri, 22 Mar 2013 20:36:10 +0000 (21:36 +0100)]
SimpleHttpServer API shouldn't expose internals

Change-Id: I5963ae720f33cb148de08b4c64d02c81d6791139
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoGrant access to jgit internals to junit and http.server bundles 00/11400/1
Matthias Sohn [Fri, 22 Mar 2013 20:35:16 +0000 (21:35 +0100)]
Grant access to jgit internals to junit and http.server bundles

Change-Id: Ib34f9635b4d060f5d17a6c823ec91af1d934a180
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoAdd missing @since tags 99/11399/1
Matthias Sohn [Fri, 22 Mar 2013 20:15:48 +0000 (21:15 +0100)]
Add missing @since tags

Change-Id: I6b20d78e6bd1f245fdca331554c106f8bae44b9c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoFix @since tags in JGit, version 2.4 never existed 53/11353/4
Tomasz Zarna [Wed, 20 Mar 2013 22:48:34 +0000 (23:48 +0100)]
Fix @since tags in JGit, version 2.4 never existed

Change-Id: Iaca88ec28b412e6b58e7b39a0762ba54b25f9471
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoMerge changes If98b0b97,I7c9c09b4
Shawn Pearce [Thu, 21 Mar 2013 07:52:33 +0000 (03:52 -0400)]
Merge changes If98b0b97,I7c9c09b4

* changes:
  Add convenience factory method for most used builder pattern
  Don't use internal type FileRepository in public API

11 years agoAllow users to show server messages while pushing 32/9732/10
André Dietisheim [Fri, 1 Feb 2013 14:58:44 +0000 (15:58 +0100)]
Allow users to show server messages while pushing

Allow users to provide their OutputStream (via Transport#
push(monitor, refUpdates, out)) so that server messages can be written
to it (in SideBandInputStream) while they're coming in.

CQ: 7065
Bug: 398404
Change-Id: I670782784b38702d52bca98203909aca0496d1c0
Signed-off-by: Andre Dietisheim <andre.dietisheim@gmail.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoDon't verify host name when sslVerify is false 09/10809/2
Matthias Sohn [Sun, 3 Mar 2013 20:54:48 +0000 (21:54 +0100)]
Don't verify host name when sslVerify is false

Native git also doesn't verify host names when http.sslVerify=false.
See native git's commit a5ccc597.

See: http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02047.html
Change-Id: I42f509fea8e4ac89fad646aec3dfbf1753ae7e3d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoFix line endings and whitespace errors in jgit feature 96/11096/4
Matthias Sohn [Tue, 12 Mar 2013 21:59:20 +0000 (22:59 +0100)]
Fix line endings and whitespace errors in jgit feature

Change-Id: I9fc69fccedf362453f74f1e09d2b50ac705a9cac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoFix formatting of PackConfig.toString() & GC.RepoStatistics.toString() 95/11295/4
Edwin Kempin [Tue, 19 Mar 2013 05:59:52 +0000 (06:59 +0100)]
Fix formatting of PackConfig.toString() & GC.RepoStatistics.toString()

Change-Id: I7e0c74ecfd0e0615d10fb582b2897d33be23440a
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoAllow to get repo statistics from GarbageCollectionCommand before gc 96/11296/6
Edwin Kempin [Tue, 19 Mar 2013 06:28:36 +0000 (07:28 +0100)]
Allow to get repo statistics from GarbageCollectionCommand before gc

When running the garbage collection for a repository it is often
interesting to compare the repository statistics from before and after
the garbage collection to understand the effect of the garbage
collection. This is why it makes sense that the
GarbageCollectionCommand provides a method to retrieve the repository
statistics before running the garbage collection.

So far without running the garbage collection the repository statistics
can only be retrieved by using JGit internal classes. This is what EGit
and Gerrit do at the moment, but it would be better to have an API for
this.

Change-Id: Id7e579157e9fbef5cfd1fc9f97ada45f0ca8c379
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoAdd convenience factory method for most used builder pattern 25/11325/3
Matthias Sohn [Tue, 19 Mar 2013 22:26:17 +0000 (23:26 +0100)]
Add convenience factory method for most used builder pattern

This will simplify to adapt EGit to the removal of FileRepository from
jgit's public API in change I2ab1327c202ef2003565e1b0770a583970e432e9.

Change-Id: If98b0b97e8f13a94d4ea7ba1be0f90d82b0fba4b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoDon't use internal type FileRepository in public API 24/11324/3
Matthias Sohn [Tue, 19 Mar 2013 22:23:59 +0000 (23:23 +0100)]
Don't use internal type FileRepository in public API

Change-Id: I7c9c09b4f190fa7cb830563bcdf2071407ee2ce0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoMerge "Fix GC for FileRepo in case packfile renames fail"
Matthias Sohn [Tue, 19 Mar 2013 17:07:47 +0000 (13:07 -0400)]
Merge "Fix GC for FileRepo in case packfile renames fail"

11 years agoFix location of DfsText.properties 07/11307/1
Shawn Pearce [Tue, 19 Mar 2013 14:16:48 +0000 (07:16 -0700)]
Fix location of DfsText.properties

The file was not moved when the package was renamed to internal.

Change-Id: I29a078d6316daa4e4407db9ecedc8b7ed05535cd

11 years agoFix GC for FileRepo in case packfile renames fail 88/11188/3
Christian Halstrick [Fri, 15 Mar 2013 10:08:17 +0000 (11:08 +0100)]
Fix GC for FileRepo in case packfile renames fail

Only on Windows the rename operation which renames temporary Packfiles
(and index-files and bitmap-files) sometime fails. This happens only
when renaming a temporary Packfile to a Packfile which already exists.
Such situations occur if you run GC twice on a repo without modifying
the repo inbetween.

In such situations there was bug in GC which led to a corrupted repo
whithout any packfiles anymore. This commit fixes the problem by
introducing a utility method which renames a file and throws an
IOException if it fails. This method also takes care to repeat a
failing rename if our FS class has found out we are running on a
platform with a unreliable File.renameTo() method.

I am searching for a better solution because even with this utility
method in hand a GC on a already GC'ed repo will fail on Windows. But
at least with this fix we will not produce corrupted repos anymore.

Bug: 389305
Change-Id: Iac1ab3e0b8c419c90404f2e2f3559672eb8f6d28
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoMake GC more robust against corrupt reflogs 65/11265/3
Christian Halstrick [Mon, 18 Mar 2013 12:20:11 +0000 (13:20 +0100)]
Make GC more robust against corrupt reflogs

With JGit it is possible to write reflog entries where new objectid and
old objectid is null. Such reflogs cause FileRepository GC to crash
because it doesn't expect the new objectid to be null. One case where
this happened is in Gerrit's allProjects repo. In the same way as we
expect the old objectid to be potentially null we should also ignore
null values in the new objectid column.

Change-Id: Icf666c7ef803179b84306ca8deb602369b8df16e

11 years agoJGit 3.0: move internal classes into an internal subpackage 73/11273/2
Shawn Pearce [Mon, 18 Mar 2013 14:44:48 +0000 (07:44 -0700)]
JGit 3.0: move internal classes into an internal subpackage

This breaks all existing callers once. Applications are not supposed
to build against the internal storage API unless they can accept API
churn and make necessary updates as versions change.

Change-Id: I2ab1327c202ef2003565e1b0770a583970e432e9

11 years agoMerge changes I2645d482,Ic81fefb1,Id64ab38d
Shawn Pearce [Mon, 18 Mar 2013 14:35:31 +0000 (10:35 -0400)]
Merge changes I2645d482,Ic81fefb1,Id64ab38d

* changes:
  Remove cached_packs support in favor of bitmaps
  Remove objects before optimization from DfsGarbageCollector
  Simplfy caching of DfsPackDescription from PackWriter.Statistics

11 years agoUse RawParseUtils.prevLF in RebaseCommand 22/11022/2
Robin Stocker [Sat, 9 Mar 2013 15:35:14 +0000 (16:35 +0100)]
Use RawParseUtils.prevLF in RebaseCommand

As noticed by Robin Rosenberg in review of
I4eb87c850078ca187b38b81cc91c92afb1176945.

Change-Id: If96d66b6c025ad8f2f47829c933f3c65ab6cbeef
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoSupport aborting non-interactive rebase started from C Git 17/11017/2
Robin Stocker [Sat, 9 Mar 2013 13:09:01 +0000 (14:09 +0100)]
Support aborting non-interactive rebase started from C Git

Continuing is trickier, as .git/rebase-apply contains no message file
and no git-rebase-todo.

Bug: 336820
Change-Id: I4eb87c850078ca187b38b81cc91c92afb1176945
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoNameRevCommand: Don't use merge cost for first parent 02/11202/3
Dave Borowitz [Fri, 15 Mar 2013 15:10:59 +0000 (08:10 -0700)]
NameRevCommand: Don't use merge cost for first parent

Treat first parent traversals as 1 and higher parents as MERGE_COST,
to match git name-rev. Allow overriding the merge cost during tests to
avoid creating 2^16 commits on the fly.

Change-Id: I0175e0c3ab1abe6722e4241abe2f106d1fe92a69

11 years agoMerge "A folder does not constitute a dirty work tree"
Robin Rosenberg [Fri, 15 Mar 2013 15:33:08 +0000 (11:33 -0400)]
Merge "A folder does not constitute a dirty work tree"

11 years agoMerge "Add toString() for PackConfig"
Christian Halstrick [Fri, 15 Mar 2013 11:23:52 +0000 (07:23 -0400)]
Merge "Add toString() for PackConfig"

11 years agoAdd toString() for PackConfig 87/11187/1
Edwin Kempin [Fri, 15 Mar 2013 09:24:58 +0000 (10:24 +0100)]
Add toString() for PackConfig

This is helpful for writing the pack configuration into a log file.

Change-Id: I5e7f5ff7e01c9538ca12a1860844ba9b467bdf05
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
11 years agoAdd toString() for RepoStatistics 86/11186/1
Edwin Kempin [Fri, 15 Mar 2013 08:39:18 +0000 (09:39 +0100)]
Add toString() for RepoStatistics

This is helpful for writing the repository statistics into a log file.

Change-Id: I0e8cd9ad05f123ab3851960890a50213f353a373
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
11 years agoRemove cached_packs support in favor of bitmaps 83/11183/1
Shawn Pearce [Thu, 14 Mar 2013 23:27:53 +0000 (16:27 -0700)]
Remove cached_packs support in favor of bitmaps

The bitmap code in PackWriter knows exactly when to use a pack as
a "cached pack". It enables cached pack usage only when the pack
has a bitmap and its entire closure of objects needs to be sent.
This is a much simpler code path to maintain, and JGit actually
has a way to write the necessary index.

Change-Id: I2645d482f8733fdf0c4120cc59ba9aa4d4ba6881

11 years agoRemove objects before optimization from DfsGarbageCollector 79/11179/2
Shawn Pearce [Thu, 14 Mar 2013 23:14:04 +0000 (16:14 -0700)]
Remove objects before optimization from DfsGarbageCollector

Just counting objects is not sufficient. There are some race
conditions with receive packs and delta base completion that
may confuse such a simple algorithm.

Instead always do the larger set computations, and rely on the
PackWriter having no objects pending as the way to avoid creating
an empty pack file.

Change-Id: Ic81fefb158ed6ef8d6522062f2be0338a49f6bc4

11 years agoSimplfy caching of DfsPackDescription from PackWriter.Statistics 78/11178/2
Shawn Pearce [Thu, 14 Mar 2013 23:10:44 +0000 (16:10 -0700)]
Simplfy caching of DfsPackDescription from PackWriter.Statistics

Let the pack description copy the relevant stats values. This
moves it out of the garbage collector and compactor algorithms,
co-locating with something that might care.

Remove some unnecessary code from the DfsPackCompactor, the stats
tracks the same information and can supply it.

Change-Id: Id64ab38d507c0ed19ae0d106862d175b7364eba3

11 years agoNameRevCommand: Use ~ notation for first parents of merges 59/11159/1
Dave Borowitz [Thu, 14 Mar 2013 16:35:00 +0000 (09:35 -0700)]
NameRevCommand: Use ~ notation for first parents of merges

Prefer ~(N+1) to ^1~N. Although both are correct, the former is
cleaner and matches "git name-rev".

Change-Id: I772001a219e5eb346f5552c92e6d98c70b2cfa98

11 years agoAllow adding single refs or all tags to NameRevCommand 27/11127/2
Dave Borowitz [Wed, 13 Mar 2013 18:05:19 +0000 (11:05 -0700)]
Allow adding single refs or all tags to NameRevCommand

Change-Id: I90e85bc835d11278631afd0e801425a292578bba

11 years agoMerge "Cluster UNREACHABLE_GARBAGE packs at the end of the search list"
Shawn Pearce [Tue, 12 Mar 2013 21:56:48 +0000 (17:56 -0400)]
Merge "Cluster UNREACHABLE_GARBAGE packs at the end of the search list"

11 years agoMerge "Avoid repacking unreachable garbage in DfsGarbageCollector"
Shawn Pearce [Tue, 12 Mar 2013 21:55:47 +0000 (17:55 -0400)]
Merge "Avoid repacking unreachable garbage in DfsGarbageCollector"

11 years agoMerge changes Icd550359,If7aad533
Shawn Pearce [Tue, 12 Mar 2013 21:45:31 +0000 (17:45 -0400)]
Merge changes Icd550359,If7aad533

* changes:
  Avoid looking at UNREACHABLE_GARBAGE for client have lines
  Simplify UploadPack by parsing wants separately from haves

11 years agoMerge "Add a NameRevCommand for describing IDs in terms of refnames"
Shawn Pearce [Mon, 11 Mar 2013 22:33:55 +0000 (18:33 -0400)]
Merge "Add a NameRevCommand for describing IDs in terms of refnames"

11 years agoAdd a NameRevCommand for describing IDs in terms of refnames 45/10945/5
Dave Borowitz [Thu, 7 Mar 2013 17:41:05 +0000 (09:41 -0800)]
Add a NameRevCommand for describing IDs in terms of refnames

The walk logic does not use RevWalk because it needs to walk all paths
to each of the requested commits, keeping track of each path along which
the commit was found in the RevCommit subclass. From these paths, a
single "best" path is chosen based on the total path length, with a
penalty applied for paths that traverse merges.

This functionality parallels "git name-rev".

Change-Id: I92bfb47dd16c898313d2ee525395609c3bf72ebe

11 years agoA folder does not constitute a dirty work tree 61/10461/2
Robin Rosenberg [Mon, 18 Feb 2013 22:59:20 +0000 (23:59 +0100)]
A folder does not constitute a dirty work tree

This fixes two cases:
- A folder without tracked content exist both in the workdir and merged
commit, as long as there names within that folder does not conflict.
- An empty folder structure exists with the same name as a file in the
merged commit.

Bug: 402834
Change-Id: I4c5b9f11313dd1665fcbdae2d0755fdb64deb3ef

11 years agoAdd isRebasing to RepositoryState 21/11021/1
Robin Stocker [Sat, 9 Mar 2013 15:20:57 +0000 (16:20 +0100)]
Add isRebasing to RepositoryState

See EGit change Ic69f5c952a49f023c0949f04b3e976be1b267fbe where this
could be used.

Change-Id: I9ec8568fa1100d2e9c8d4ca0e347bf77ec6d8734

11 years agoAvoid looking at UNREACHABLE_GARBAGE for client have lines 05/11005/1
Shawn Pearce [Fri, 8 Mar 2013 20:45:28 +0000 (12:45 -0800)]
Avoid looking at UNREACHABLE_GARBAGE for client have lines

Clients send a bunch of unknown objects to UploadPack on each round
of negotiation. Many of these are not known to the server, which
leads the implementation to be looking at indexes for garbage packs.

Disable examining the index of a garbage pack, allowing servers to
avoid reading them from disk during negotiation.

The effect of this change is the server will only ACK a have line
if the object was reachable during the last garbage collection,
or was recently added to the repository. For most repositories
there is no impact in this behavior change.

If a repository rewinds a branch, runs GC, and then resets the
branch back to where it was before, the now current tip is going to
be skipped by this change. A client that has the commit may wind up
getting a slightly larger data transfer from the server as an older
common ancestor will be chosen during negotiation. This is fixable
on the server side by running GC again to correct the layout of
objects in pack files.

Change-Id: Icd550359ef70fc7b701980f9b13d923fd13c744b

11 years agoSimplify UploadPack by parsing wants separately from haves 04/11004/1
Shawn Pearce [Fri, 8 Mar 2013 20:25:12 +0000 (12:25 -0800)]
Simplify UploadPack by parsing wants separately from haves

The DHT backend was very slow at parsing objects. To work around
that performance limitation I obfuscated UploadPack by folding both
the want and have sets together in a single parse queue. Since DHT
was removed the complexity is no longer constructive to JGit.

Doing this refactoring prepares the code for a slightly future
change where the have lines need to be handled specially from the
want lines. Splitting the parsing up into two phases makes such
a modification trivial.

Change-Id: If7aad533b82448bbb688278e21f709282e5ccf4b

11 years agoCluster UNREACHABLE_GARBAGE packs at the end of the search list 99/10999/1
Shawn Pearce [Fri, 8 Mar 2013 19:19:44 +0000 (11:19 -0800)]
Cluster UNREACHABLE_GARBAGE packs at the end of the search list

Garbage is unlikely to be used by a reader. Ensure they always
cluster at the end of the search list, no matter what timestamp
was used on the pack files.

Change-Id: I3bed89e9569ee3363c36bb3f73fcd34057a3883f