]> source.dussan.org Git - jgit.git/log
jgit.git
11 years agoRemove dependency by ArchiveCommand on archive formats 63/12563/4
Jonathan Nieder [Fri, 24 May 2013 23:57:10 +0000 (16:57 -0700)]
Remove dependency by ArchiveCommand on archive formats

Provide static registerFormat and unregisterFormat methods to allow
formats to register themselves without the ArchiveCommand code being
aware of them.

Register the basic "zip" and "tar" support at bundle activation time
(and deregister them when unloading the bundle).  For anyone using
this code as an OSGi plugin it should continue to just work.

The jgit program does not load org.eclipse.jgit.pgm as an OSGi bundle,
so let the Archive command register the formats it uses explicitly
with registerFormat.

Change-Id: Id39c03ea6923d0aed8316ed7b6bd04d5ced570a7

11 years agoDrop dependency by ArchiveCommand.Format interface on commons-compress 62/12562/4
Jonathan Nieder [Thu, 23 May 2013 23:53:57 +0000 (16:53 -0700)]
Drop dependency by ArchiveCommand.Format interface on commons-compress

Otherwise, anyone trying to implement a new format would have to
depend on commons-compress, even if using a different underlying
library to write the archive.

Change-Id: I301a1997e3b48aa7e32d693fd8f4b2d436c9b3a7

11 years agoArchiveCommand.Format: pass output stream as first argument to putEntry 00/13100/2
Jonathan Nieder [Thu, 23 May 2013 23:46:29 +0000 (16:46 -0700)]
ArchiveCommand.Format: pass output stream as first argument to putEntry

This is more consistent with other APIs where the output side is the
first parameter to be analagous to the left-hand side of an
assignment.

Change-Id: Iec46bd50bc973a38b77d8367296adf5474ba515f

11 years agoArchiveCommand: make archive formats non-inner classes 61/12561/7
Jonathan Nieder [Fri, 24 May 2013 01:08:35 +0000 (18:08 -0700)]
ArchiveCommand: make archive formats non-inner classes

First step toward making ArchiveCommand itself format-agnostic.

Change-Id: I3cff5fce28fa7a19e34f8291cfb5b62f16429713

11 years agoRemove unused import in UploadPack 93/13093/1
Shawn Pearce [Thu, 23 May 2013 20:10:03 +0000 (13:10 -0700)]
Remove unused import in UploadPack

Change-Id: I9304cb3a6502ceb0cba21eb841e466f932ab3c01

11 years agoUse NullOutputStream not DisabledOutputStream in UploadPack 91/13091/1
Shawn Pearce [Thu, 23 May 2013 20:07:03 +0000 (13:07 -0700)]
Use NullOutputStream not DisabledOutputStream in UploadPack

The stream should not throw IllegalStateException if it is off.
Flush the stream after the hook runs, in case any messages need
to be sent ahead of the pack.

Change-Id: I21c7a0258ab1308406d226293fa0e7da69b4f57b

11 years agoAllow PreUploadHook.onSendPack to send messages to the client 60/13060/1
Shawn Pearce [Wed, 22 May 2013 19:12:52 +0000 (12:12 -0700)]
Allow PreUploadHook.onSendPack to send messages to the client

Before transmitting to the client a hook may want to send along
a text message ahead of the pack, such as a "message of the day".
Enable this usage by mirroring the message sending API from
ReceivePack on the UploadPack instance, using the side band.

Change-Id: I31cd254a4ddb816641397a3e9c2c20212471c37f

11 years agoRemove unused import in LocalDiskRepositoryTestCase 71/12771/1
Tomasz Zarna [Tue, 14 May 2013 05:16:32 +0000 (22:16 -0700)]
Remove unused import in LocalDiskRepositoryTestCase

Change-Id: Ib8a8e72dd3c808c4fe92c32ed177272dce29ac60

11 years agoFix hardcoded use of target/trash in LocalDiskRepositoryTestCase 68/12668/3
Shawn Pearce [Thu, 9 May 2013 00:34:47 +0000 (17:34 -0700)]
Fix hardcoded use of target/trash in LocalDiskRepositoryTestCase

`pwd`/target is only valid in Maven Reactor builds where Maven
has moved into the project directory and created a target for
the build output. Most other build systems do not use "target"
and may not even perform a directory change between test suites.

Rewrite LocalDiskRepositoryTestCase's temporary directory code
to use the system specified location and create new unique names.
This prevents fixes between concurrently running tests and allows
the caller to specify the root using java.io.tmpdir.

Update the surefire command lines to use target within each project as
the system temporary directory during unit testing, preventing JGit's
own test suite from writing to /tmp or somewhere like C:\tmp.

Change-Id: I9e8431f6ddfc16fee89f677bcce67c99cfb56782

11 years agoAdd missing @since tags 08/12408/3
Matthias Sohn [Tue, 30 Apr 2013 21:55:36 +0000 (23:55 +0200)]
Add missing @since tags

Change-Id: I9657125765716c874bb6ecf8844c34749cb3b069
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoMove org.eclipse.jgit.pgm's resource bundle to internal package 53/12553/2
Matthias Sohn [Mon, 6 May 2013 20:59:57 +0000 (22:59 +0200)]
Move org.eclipse.jgit.pgm's resource bundle to internal package

Translatable texts aren't API and shouldn't require maintenance of
@since tags to prevent API warnings.

Change-Id: I228ff37f17c0e792a6bc188c463a0d19138e88ac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoMerge "URIish: Allow multiple slashes in paths"
Shawn Pearce [Sun, 5 May 2013 16:51:44 +0000 (12:51 -0400)]
Merge "URIish: Allow multiple slashes in paths"

11 years agoRemove unused repository field from RevWalk 00/12500/3
Dave Borowitz [Fri, 3 May 2013 18:22:25 +0000 (11:22 -0700)]
Remove unused repository field from RevWalk

The comment about legacy Tag and Object types no longer applies,
though prior to Idb273d5a92849b42935ac14eed73b796b80aad50 the field
was still being used by RewriteTreeFilter.

Change-Id: I9ee5da8f8a3b61c9cf543817c03117ee0609dd8f

11 years agoMerge "Require a DiffConfig when creating a FollowFilter"
Shawn Pearce [Sun, 5 May 2013 15:47:53 +0000 (11:47 -0400)]
Merge "Require a DiffConfig when creating a FollowFilter"

11 years agoRequire a DiffConfig when creating a FollowFilter 99/12499/3
Dave Borowitz [Fri, 3 May 2013 18:18:53 +0000 (11:18 -0700)]
Require a DiffConfig when creating a FollowFilter

The various rename detection options are an inherent part of the
filter, similar to the path being followed.

This fixes a potential NPE when a RevWalk with a FollowFilter is
created without a Repository, since the old code path tried to get
the DiffConfig from the RevWalk's possibly-missing repository.

Change-Id: Idb273d5a92849b42935ac14eed73b796b80aad50

11 years agoAdd optional feature to install Java 7 support 38/12438/3
Matthias Sohn [Mon, 11 Mar 2013 23:40:34 +0000 (00:40 +0100)]
Add optional feature to install Java 7 support

Change-Id: I15cfd91857830d69abbe729be3e237fc9cd4fca0
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoExtend the FS class for Java7 78/9378/25
Robin Rosenberg [Mon, 4 Feb 2013 00:10:26 +0000 (01:10 +0100)]
Extend the FS class for Java7

The most important difference is that in Java7 we have symbolic links
and for most operations in the work tree we want to operate on the link
itself rather than the link target, which the old File methods generally
do.

We also add support for the hidden attribute, which only makes sense
on Windows and exists, just since there are claims that Files.exists
is faster the File.exists.

A new bundle is only activated when run with a Java7 execution
environment. It is implemented as a fragment.

Tycho currently has no way to conditionally include optional features
based on the java version used to run the build, this means with this
change the jgit packaging build always needs to be run using java 7.

Change-Id: I3d6580d6fa7b22f60d7e54ab236898ed44954ffd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoFix line endings 88/12488/1
Matthias Sohn [Fri, 3 May 2013 14:19:07 +0000 (16:19 +0200)]
Fix line endings

Change-Id: I61c9c173237a535da8576a9299bfd4bb29e8f56b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoTagCommand should be able to create unannotated tags too 70/12470/2
Robin Rosenberg [Thu, 2 May 2013 21:07:04 +0000 (23:07 +0200)]
TagCommand should be able to create unannotated tags too

Using the low level API's is just too cumbersome.

Change-Id: Id5b9f560ee095d6db0b2ea5b26aef3e53021626e
Signed-off-by: Robin Stocker <robin@nibor.org>
11 years agoAdd test for RefUpdate delete without HEAD 69/12269/2
Robin Stocker [Sat, 27 Apr 2013 11:30:11 +0000 (13:30 +0200)]
Add test for RefUpdate delete without HEAD

Bug: 406722
Change-Id: I555fb366ee64d885de2a71a67cf00833f4c62561

11 years agoMerge "Fix warnings about assigning paramter in util.io"
Robin Rosenberg [Thu, 2 May 2013 21:19:38 +0000 (17:19 -0400)]
Merge "Fix warnings about assigning paramter in util.io"

11 years agoFix warnings about assigning paramter in util.io 14/12414/1
Robin Stocker [Wed, 1 May 2013 14:48:14 +0000 (16:48 +0200)]
Fix warnings about assigning paramter in util.io

Change-Id: I08bed4275af9ec52aa4d7054067ac82f6a3c9781

11 years agoUpdate tags on fetch if --tags or tag refspec specified 80/12280/2
Robin Stocker [Sat, 27 Apr 2013 14:46:29 +0000 (16:46 +0200)]
Update tags on fetch if --tags or tag refspec specified

When either --tags or a tag ref is explicitly specified on fetch, C Git
updates existing local tags if they are different.

Before this change, JGit returned REJECTED in such a case. Now it
updates it and returns FORCED.

Example:

    % mkdir a
    % cd a
    % git init -q
    % touch test.txt
    % git add test.txt
    % git commit -q -m 'Initial'
    % git tag v1
    % cd ..
    % git clone -q a b
    % cd a
    % echo Test > test.txt
    % git commit -q -a -m 'Second'
    % git tag -f v1
    Updated tag 'v1' (was bc85c08)
    % cd ../b
    % git fetch --tags
     - [tag update]      v1         -> v1

Bug: 388095
Change-Id: I5d5494c2ad1a2cdb8e9e614d3de445289734edfe

11 years agoOnly fetch tags that do not exist locally with auto-follow 79/12279/2
Robin Stocker [Sat, 27 Apr 2013 14:14:46 +0000 (16:14 +0200)]
Only fetch tags that do not exist locally with auto-follow

This corresponds to what C Git does, quoting from the fetch man page:

  This is done by first fetching from the remote using the given
  <refspec>s, and if the repository has objects that are pointed by
  remote tags that it does not yet have, then fetch those missing tags.

Before, JGit would also fetch tags that exist locally but point to a
different object, resulting in REJECTED results for these.

Also add some test cases to cover more cases.

Bug: 388095
Change-Id: Ib03d2d82e9c4b60179d626cfd5174be1da6388b2
Also-by: Stefan Lay <stefan.lay@sap.com>
11 years agoArchiveCommand: Add missing @since tag 09/12409/1
Jonathan Nieder [Tue, 30 Apr 2013 22:03:08 +0000 (15:03 -0700)]
ArchiveCommand: Add missing @since tag

Change-Id: I9e48a1f82b747492bebb3ca65fd16f599e425e8b

11 years agoAbort before delete in FileUtils.delete EMPTY_DIRECTORIES_ONLY|RECURSIVE 50/11850/4
Robin Stocker [Fri, 12 Apr 2013 12:21:02 +0000 (14:21 +0200)]
Abort before delete in FileUtils.delete EMPTY_DIRECTORIES_ONLY|RECURSIVE

Depending on the order in which items are traversed for RECURSIVE, an
empty directory may come first before detecting that there is a file and
aborting.

This fixes it by traversing files first.

Bug: 405558
Change-Id: I638b7da58e33ffeb0fee172b96f4c823943d29e9
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoMerge "Cleanup imports and javadocs in ArchiveCommand"
Robin Rosenberg [Sat, 27 Apr 2013 20:38:16 +0000 (16:38 -0400)]
Merge "Cleanup imports and javadocs in ArchiveCommand"

11 years agoCleanup imports and javadocs in ArchiveCommand 75/12275/2
Robin Rosenberg [Sat, 27 Apr 2013 13:08:31 +0000 (15:08 +0200)]
Cleanup imports and javadocs in ArchiveCommand

Change-Id: Icb1cd177e791cc646636a88c67fd9399dfc7030c

11 years agoDelete CLIText strings previously used in iplog generator 25/12225/2
Jonathan Nieder [Thu, 25 Apr 2013 22:27:47 +0000 (15:27 -0700)]
Delete CLIText strings previously used in iplog generator

The only callers using these strings were removed in commit
850e5bc24e31 (Delete the iplog generator, 2013-01-09).

Change-Id: Ia4f81b29b8d00782ee559d69de3befc0a6c4d403

11 years agoMerge "Make the Reflog a public API again"
Robin Rosenberg [Sat, 27 Apr 2013 12:56:37 +0000 (08:56 -0400)]
Merge "Make the Reflog a public API again"

11 years agoMerge "Remove unused logger from RecursiveMerger"
Robin Rosenberg [Sat, 27 Apr 2013 12:55:32 +0000 (08:55 -0400)]
Merge "Remove unused logger from RecursiveMerger"

11 years agoURIish: Allow multiple slashes in paths 73/12273/1
Robin Stocker [Sat, 27 Apr 2013 12:35:12 +0000 (14:35 +0200)]
URIish: Allow multiple slashes in paths

It's also allowed by C Git.

Change-Id: Ie0a0d1f57d84e70fd5ef50b7844d22fea43d0e08

11 years agoRefer to getEntryPathLength in docs of getEntryPathBuffer 72/12272/1
Robin Stocker [Sat, 27 Apr 2013 12:18:59 +0000 (14:18 +0200)]
Refer to getEntryPathLength in docs of getEntryPathBuffer

Change-Id: Icca41d80bd0791cd2d4bf03297795d161afbee70

11 years agoAllow deletions to occur when there is no HEAD 68/12268/1
Alex Blewitt [Sat, 27 Apr 2013 10:34:57 +0000 (11:34 +0100)]
Allow deletions to occur when there is no HEAD

If the HEAD is not present in a repository, then there is a
NullPointerException thrown in the delete code. Since this only
exists to verify if the deletion is not the HEAD reference, then
skip this check if the HEAD cannot be found.

Bug: 406722
Change-Id: I882497202d986096513a4d791cd07fa935a3f9e4
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
11 years agoArchiveCommand: Do not warn for unsupported file mode 52/12252/5
Jonathan Nieder [Fri, 26 Apr 2013 20:47:56 +0000 (13:47 -0700)]
ArchiveCommand: Do not warn for unsupported file mode

When ArchiveCommand is invoked directly on the command line, these
warnings to stderr

warning: mode of path/to/some/submodule ignored

are a useful hint, but in the more usual case where an archive is
being served by a server, the intended audience for that message
cannot see stderr.

Later it might be useful to accept a callback to return these warnings
out of band.

Change-Id: I22e79be69859176d85594031d67c6cb3371c4bd2

11 years agoAdd internal porcelain-style API for ArchiveCommand 56/11556/10
Jonathan Nieder [Fri, 26 Apr 2013 20:43:23 +0000 (13:43 -0700)]
Add internal porcelain-style API for ArchiveCommand

One step closer to exposing archive creation functionality in a
org.eclipse.jgit.archive bundle.

Change-Id: If0ebb2417a941d9d3fc0d3f444316d0d1c494ff3

11 years agoMerge "archive: Release resources before returning"
Shawn Pearce [Fri, 26 Apr 2013 20:06:25 +0000 (16:06 -0400)]
Merge "archive: Release resources before returning"

11 years agoarchive: Release resources before returning 23/12223/2
Jonathan Nieder [Thu, 25 Apr 2013 21:20:54 +0000 (14:20 -0700)]
archive: Release resources before returning

The only caller exits immediately after calling execute() so this
shouldn't make a difference, but it's good practice and should make it
easier to expose the functionality in a public API later.

Change-Id: Ia6cd2ce8382f1a62e576409107fc5c9a6b321fb6

11 years agoRemove unused logger from RecursiveMerger 43/12243/1
Jonathan Nieder [Fri, 26 Apr 2013 17:16:09 +0000 (10:16 -0700)]
Remove unused logger from RecursiveMerger

JGit doesn't currently use java.util.logging.Logger.  Remove this
never-used Logger introduced in ab99b78ca08a (Implement recursive
merge strategy, 2013-02-21) to make that easier to see.

Change-Id: I92c578e7f3617085a667de7c992174057be3eb71

11 years agoMake the Reflog a public API again 54/11954/4
Robin Rosenberg [Tue, 16 Apr 2013 22:31:11 +0000 (00:31 +0200)]
Make the Reflog a public API again

Change-Id: I8ced7098da5b345fd9af2fdfafd1ef6a44ccee0d

11 years agoMerge "status: Print conflict description for unmerged paths"
Robin Rosenberg [Thu, 25 Apr 2013 21:45:35 +0000 (17:45 -0400)]
Merge "status: Print conflict description for unmerged paths"

11 years agoDocument RevTag#getObject() that returned object is unparsed 01/12101/1
Robin Stocker [Mon, 22 Apr 2013 16:22:18 +0000 (18:22 +0200)]
Document RevTag#getObject() that returned object is unparsed

Change-Id: I238d388e40362721eecf37f64ad7d48a399ff129

11 years agoImprove class documentation of TagCommand 97/12097/1
Robin Stocker [Mon, 22 Apr 2013 13:35:10 +0000 (15:35 +0200)]
Improve class documentation of TagCommand

Change-Id: I9c636b927fa2d7cfbe1eb5535a9e702b2209f51d

11 years agoRevert "Add tests for FileUtils.delete and EMPTY_DIREECTORIES_ONLY" 76/12076/1
Shawn Pearce [Fri, 19 Apr 2013 19:01:58 +0000 (12:01 -0700)]
Revert "Add tests for FileUtils.delete and EMPTY_DIREECTORIES_ONLY"

This reverts commit 7aa54967a26cb027fe390ad1c624ebb30f9ac6d5.
The unit test dependend upon the specific order of names that
listFiles() returned members in. The order is completely undefined
and may differ even on different versions of Linux based systems.

A proper unit test for this code would have considered both cases,
where the deletion function was able to remove an empty subdirectory,
or fail to remove a subdirectory because a file was still present
within. This is not such a test.

Change-Id: Ib0a706fea01e4b1ed8c8e859247d247a1279b4bc

11 years agostatus: Print conflict description for unmerged paths 72/12072/1
Robin Stocker [Fri, 19 Apr 2013 17:44:24 +0000 (19:44 +0200)]
status: Print conflict description for unmerged paths

Prefix unmerged paths with conflict description (e.g. "both modified:"),
the same way C Git does.

Change-Id: I083cd191ae2ad3e2460aa4052774aed6e36c2699

11 years agoCreate constants in ConfigConstants for the "diff" section 31/11731/2
Robin Rosenberg [Sun, 7 Apr 2013 23:13:41 +0000 (01:13 +0200)]
Create constants in ConfigConstants for the "diff" section

Change-Id: I5cf5fe60374d1e94eb031488e4f92c8e521f41a6
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
11 years agoFix examples with refs/heads/ in RefSpec Javadoc 06/12006/2
Robin Stocker [Thu, 18 Apr 2013 08:55:23 +0000 (10:55 +0200)]
Fix examples with refs/heads/ in RefSpec Javadoc

Change-Id: I06c1c7242a1b4c8f499c27a598cca714803799b7
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
11 years agoIndexDiff: Provide stage state for conflicting entries 54/11354/3
Robin Stocker [Thu, 21 Mar 2013 00:39:04 +0000 (01:39 +0100)]
IndexDiff: Provide stage state for conflicting entries

Adds a new method getConflictingStageStates() which returns a
Map<String, StageState> (path to stage state). StageState is an enum for
all possible stage combinations (BOTH_DELETED, ADDED_BY_US, ...).

This can be used to implement the conflict text for unmerged paths in
output of "git status" or in EGit for decorations/hints.

Bug: 403697
Change-Id: Ib461640a43111b7df4a0debe92ff69b82171329c
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
11 years agoMerge "A deleted work tree file is not a conflict when merge wants to delete it"
Robin Rosenberg [Fri, 19 Apr 2013 11:39:39 +0000 (07:39 -0400)]
Merge "A deleted work tree file is not a conflict when merge wants to delete it"

11 years agoMerge "Untracked files should not be included in stash"
Robin Rosenberg [Fri, 19 Apr 2013 11:36:29 +0000 (07:36 -0400)]
Merge "Untracked files should not be included in stash"

11 years agoDo not export package org.eclipse.jgit from jgit tests 39/12039/2
Matthias Sohn [Thu, 18 Apr 2013 20:35:37 +0000 (22:35 +0200)]
Do not export package org.eclipse.jgit from jgit tests

Commit 3344b93c erroneously exported the package org.eclipse.jgit.lib
from the org.eclipse.jgit.test bundle which made this a split package
since the bundle org.eclipse.jgit exports the same package.

Split packages are evil in general and most probably caused the build
cycle errors observed recently when importing the jgit projects in
Eclipse [1].

[1] http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02012.html

Change-Id: I89919e56b928acdbff0b90e3919808025a8562c6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoUntracked files should not be included in stash 40/12040/1
Robin Rosenberg [Thu, 18 Apr 2013 21:19:15 +0000 (23:19 +0200)]
Untracked files should not be included in stash

The previous code stashed untracked files and left them
in the work tree.

Bug: 403282
Change-Id: I71727addb2b55fb8e409cae2b6af8138b1ff7ef1

11 years agoRemove some unnecessary dependencies on FileRepostory 25/11925/2
Robin Rosenberg [Mon, 15 Apr 2013 22:05:41 +0000 (00:05 +0200)]
Remove some unnecessary dependencies on FileRepostory

Change-Id: Ib6ee3a2874a7e2240aa68f4ac32d00c4d1fab5ae
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
11 years agoMerge "Remove unused dependencies"
Robin Rosenberg [Thu, 18 Apr 2013 20:29:35 +0000 (16:29 -0400)]
Merge "Remove unused dependencies"

11 years agoImprove test coverage of AutoCRLF(In|Out)putStream 36/12036/2
Robin Stocker [Thu, 18 Apr 2013 19:55:35 +0000 (21:55 +0200)]
Improve test coverage of AutoCRLF(In|Out)putStream

Bug: 405672
Change-Id: I3894e98617fcee16dc2ac9853c203c62eb30c3ab
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
11 years agoMerge changes Id2848c16,I7621c434
Shawn Pearce [Wed, 17 Apr 2013 18:53:13 +0000 (14:53 -0400)]
Merge changes Id2848c16,I7621c434

* changes:
  Rescale "Compressing objects" progress meter by size
  Split delta search buckets by byte weight

11 years agoRescale "Compressing objects" progress meter by size 53/11953/2
Shawn Pearce [Tue, 16 Apr 2013 16:25:29 +0000 (09:25 -0700)]
Rescale "Compressing objects" progress meter by size

Instead of counting objects processed, count number of bytes added
into the window. This should rescale the progress meter so that 30%
complete means 30% of the total uncompressed content size has been
inflated and fed into the window.

In theory the progress meter should be more accurate about its
percentage complete/remaining fraction than with objects. When
counting objects small objects move the progress meter more rapidly
than large objects, but demand a smaller amount of work than large
objects being compressed.

Change-Id: Id2848c16a2148b5ca51e0ca1e29c5be97eefeb48

11 years agoSplit delta search buckets by byte weight 76/11876/6
Shawn Pearce [Tue, 16 Apr 2013 15:19:13 +0000 (08:19 -0700)]
Split delta search buckets by byte weight

Instead of assuming all objects cost the same amount of time to
delta compress, aggregate the byte size of objects in the list
and partition threads with roughly equal total bytes.

Before splitting the list select the N largest paths and assign
each one to its own thread. This allows threads to get through the
worst cases in parallel before attempting smaller paths that are
more likely to be splittable.

By running the largest path buckets first on each thread the likely
slowest part of compression is done early, while progress is still
reporting a low percentage. This gives users a better impression of
how fast the phase will run. On very complex inputs the slow part
is more likely to happen first, making a user realize its time to
go grab lunch, or even run it overnight.

If the worst sections are earlier, memory overruns may show up
earlier, giving the user a chance to correct the configuration and
try again before wasting large amounts of time. It also makes it
less likely the delta compression phase reaches 92% in 30 minutes
and then crawls for 10 hours through the remaining 8%.

Change-Id: I7621c4349b99e40098825c4966b8411079992e5f

11 years agoMerge "Support excluding objects during DFS compaction"
Shawn Pearce [Wed, 17 Apr 2013 18:19:21 +0000 (14:19 -0400)]
Merge "Support excluding objects during DFS compaction"

11 years agoSupport excluding objects during DFS compaction 62/11962/1
Shawn Pearce [Wed, 17 Apr 2013 00:54:23 +0000 (17:54 -0700)]
Support excluding objects during DFS compaction

By excluding objects the compactor can avoid storing objects that
are already well packed in the base GC packs, or any other pack
not being replaced by the current compaction operation.

For deltas the base object is still included even if the base exists
in another exclusion set.  This favors keeping deltas for recent
history, to support faster fetch operations for clients.

Change-Id: Ie822fe075fe5072fe3171450fda2f0ca507796a1

11 years agoMake recursive merge strategy the default merge strategy 91/11891/2
Matthias Sohn [Mon, 25 Mar 2013 02:39:58 +0000 (03:39 +0100)]
Make recursive merge strategy the default merge strategy

Use recursive merge as the default strategy since it can successfully
merge more cases than the resolve strategy can. This is also the default
in native Git.

Change-Id: I38fd522edb2791f15d83e99038185edb09fed8e1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
11 years agoUpdate PackBitmapIndexRemapper to handle mappings not in the new pack. 10/11910/1
Colby Ranger [Mon, 15 Apr 2013 16:35:07 +0000 (09:35 -0700)]
Update PackBitmapIndexRemapper to handle mappings not in the new pack.

Previously, the code assumed all commits in the old pack would also
be present in the new pack. This assumption caused an
ArrayIndexOutOfBoundsException during remapping of ids. Fix the
iterator to only return entries that may be remapped. Furthermore,
update getBitmap() to return null if commit does not exist in the
new pack.

Change-Id: I065babe8cd39a7654c916bd01c7012135733dddf

11 years agoFix boundary conditions in AutoCRLFOutputStream 87/11887/2
Robin Rosenberg [Sun, 14 Apr 2013 17:15:53 +0000 (19:15 +0200)]
Fix boundary conditions in AutoCRLFOutputStream

This fixes some problems with inputs around the size of the internal
buffer in AutoCRLFOutputStream (8000).

Tests supplied by Robin Stocker.

Bug: 405672
Change-Id: I6147897290392b3bfd4040e8006da39c302a3d49

11 years agoNLS warning cleanup 85/11885/1
Robin Rosenberg [Sat, 13 Apr 2013 22:40:37 +0000 (00:40 +0200)]
NLS warning cleanup

Change-Id: Ia76aa02dd330a1f88096c2b059b363aa38d653e9

11 years agoMerge "Fix a possible NPE"
Robin Rosenberg [Sat, 13 Apr 2013 10:16:11 +0000 (06:16 -0400)]
Merge "Fix a possible NPE"

11 years agoMerge changes I845caede,Ie25c6d3a,I5caec313,Ib11ff99f,I9ccf20c3,Ic7826f29,I1bdd8b58...
Shawn Pearce [Fri, 12 Apr 2013 20:16:09 +0000 (16:16 -0400)]
Merge changes I845caede,Ie25c6d3a,I5caec313,Ib11ff99f,I9ccf20c3,Ic7826f29,I1bdd8b58,Idb84c1d7,I078841f9

* changes:
  Always attempt delta compression when reuseDeltas is false
  Avoid TemporaryBuffer.Heap on very small deltas
  Correct distribution of allowed delta size along chain length
  Split remaining delta work on path boundaries
  Replace DeltaWindow array with circularly linked list
  Micro-optimize copy instructions in DeltaEncoder
  Micro-optimize DeltaWindow primary loop
  Micro-optimize DeltaWindow maxMemory test to be != 0
  Mark DeltaWindowEntry methods final

11 years agoAlways attempt delta compression when reuseDeltas is false 66/11866/3
Shawn Pearce [Fri, 12 Apr 2013 19:59:02 +0000 (12:59 -0700)]
Always attempt delta compression when reuseDeltas is false

If reuseObjects=true but reuseDeltas=false the caller wants attempt
a delta for every object in the input list. Test for reuseDeltas
to ensure every object passes through the searchInWindow() method.

If no delta is possible for an object and it will be stored whole
(non-delta format), PackWriter may still reuse its content from any
source pack. This avoids an inflate()-deflate() cycle to recompress
the object contents.

Change-Id: I845caeded419ef4551ef1c85787dd5ffd73235d9

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 agoRemove DFS locality ordering during packing 57/11857/2
Shawn Pearce [Fri, 12 Apr 2013 14:05:20 +0000 (07:05 -0700)]
Remove DFS locality ordering during packing

PackWriter generally chooses the order for objects when it builds the
object lists.  This ordering already depends on history information to
guide placing more recent objects first and historical objects last.

Allow PackWriter to make the basic ordering decisions, instead of
trying to override them.  The old approach of sorting the list caused
DfsReader to override any ordering change PackWriter might have tried
to make when repacking a repository.

This now better matches with WindowCursor's implementation, where
PackWriter solely determines the object ordering.

Change-Id: Ic17ab5631ec539f0758b962966c3a1823735b814

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 agoMerge "Consider working tree changes when stashing newly added files"
Robin Rosenberg [Thu, 11 Apr 2013 06:06:54 +0000 (02:06 -0400)]
Merge "Consider working tree changes when stashing newly added files"

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 agoConsider working tree changes when stashing newly added files 57/11757/3
Robin Rosenberg [Tue, 9 Apr 2013 19:22:18 +0000 (21:22 +0200)]
Consider working tree changes when stashing newly added files

Bug: 402396
Change-Id: I50ff707c0c9abcab3f98eea21aaa6e824f7af63a

11 years agoRemove unused dependencies 48/11748/3
Matthias Sohn [Tue, 9 Apr 2013 14:39:01 +0000 (16:39 +0200)]
Remove unused dependencies

Change-Id: I3cd161ac360a2e2635bffe309725a41c9527694e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
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 agoA deleted work tree file is not a conflict when merge wants to delete it 32/11732/2
Robin Rosenberg [Mon, 8 Apr 2013 20:05:06 +0000 (22:05 +0200)]
A deleted work tree file is not a conflict when merge wants to delete it

Bug: 405199
Change-Id: I4b2ef3dc432d2fad8a6fabd1c8aec407b5c8c5ac
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.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