Properly parse first line in ReceivePack with no '\0'

Change-Id: Ic98e17aff4e4b3c3fa0359082bab689e4522e3d7
Clarify documentation of exceptions in RepositoryResolver

Change-Id: Idf805f76f24bfa1f3552366197e0ed4e45cb2b74
Allow RepositoryResolver to throw ServiceMayNotContinueException

Implementations may want to send an error message to the user, which
doesn't really fit with any of the existing exception types.
ServiceMayNotContinueException, on the other hand, is documented as
always containing a user-visible error string, so use that.

Modify the git and HTTP transport mechanisms to properly relay this
message to the end user.

Change-Id: I362e67ea46102a145bf2c6284d38788537c9735f
Handle content length in WorkingTreeIterator

Content length is computed and cached (short term) in the working
tree iterator when core.autocrlf is set.

Hopefully this is a cleaner fix than my previous attempt to make
autocrlf work.

Change-Id: I1b6bbb643101a00db94e5514b5e2b069f338907a
Extract inner classes from Config

The Config class is getting very large. Extract two of its inner
classes into new top level types to reduce the size of Config.
Rename them slightly in the process.

Change-Id: I693148a5ae2977378789bf455c880a6fd856c0f0
Sort Config entries and use O(log N) lookup

Decrease running time for getStringList (and all other get methods) by
looking for configuration entries using binary search rather than
linear search through the configuration file.

Configuration lines are sorted by section, subsection, name in a
sorted list whenever the snapshot is rebuilt. Binary search is used to
locate an index in the middle of the values, then walk backwards to
find the first value in the range.

Given a configuration of file of 5000 distinct section/subsection/name
triplets (e.g. a Gerrit Code Review project.config configuration file
with 5000 unique access control rules), this new code is faster to
lookup each rule individually using getStringList():

  old setStringList() 194 usec avg
      getStringList() 196 usec avg

  new setStringList() 188 usec avg
      getStringList()  24 usec avg

Change-Id: Ic8907231868c18eb946b72f341a6b58666b70324
Fix loading packed objects >2G

Parsing the size from a packed object header was incorrectly computing
the total inflated length when the length exceeded the range of a Java
int. The next 7 bits of size information was shifted left as an int
using a shift of 25 bits, placing the higher bits of the size into the
sign position. When this size was extended to a long to be added to
the current size accumulator the size went negative, resulting in
NegativeArraySizeException being thrown.

Fix all places where this particular pattern of code is used to read a
pack size field, or a binary delta header, as they both use the same
variable length encoding scheme.

Change-Id: I04008728ed828f18202652c3d5401cf95a441d0a
Merge changes Ic8907231,I693148a5

* changes:
  Sort Config entries and use O(log N) lookup
  Extract inner classes from Config
Fix tests for Ant task "git-clone"

If project.init() isn't called GitCloneTaskTest fails when started from
Eclipse, according to [1] calling init() is necessary to properly
initialize the Ant project programmatically.

Always set the destination folder in order to ensure that all test
resources are created under the project's target folder and do not
pollute the project's source tree with test data.

[1]
http://ant.1045680.n5.nabble.com/project-createTask-not-working-with-ant-1-8-2-td3385716.html

Change-Id: Icbeb62680b018a92673faa58828b5e850564c7a8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Recurse into cloned submodules

Iterate over all successfully cloned submodules recursively
and continue initializing and updating until no more are found.

Bug: 375426
Change-Id: Ifb99e41e2deb0c369442bca3c0f5f072dd006816
Don't use java.nio channel for file size determination

Java NIO has some problems (like files closing unexpectedly because the
thread was interrupted). To avoid those problems, don't use a NIO
channel to determine the size of a file, but rather ask the File itself.

We have to be prepared to handle wrong/outdated information in this case
too, as the inode of the File may change between opening and determining
file size.

Change-Id: Ic7aa6c3337480879efcce4a3058b548cd0e2cef0
Add @Override annotations to enums

Change-Id: I8fa3b89a6349c1231251b346cae12c1c4f095929
Externalize parsing exception message for RebaseCommand#Action

Change-Id: Id0d7801e4de98bf118dbecadf623c9ffd7ab7554
Index config section and subsection names in one pass

Instead of indexing the subsection names on each request for a given
section name, index both the section and subsection names in a single
scan through the entry list. This should improve lookup time for
reading the section names out of the configuration, especially for the
url.*.insteadof type of processing performed in RemoteConfig.

Change-Id: I7b3269565b1308f69d20dc3f3fe917aea00f8a73
Merge "Externalize parsing exception message for RebaseCommand#Action"
Merge "Add @Override annotations to enums"
Merge "Index config section and subsection names in one pass"
Unlock DirCache in case of occurring exception

A DirCache was not unlocked if an exception occurred in the
DirCacheCheckout constructor.

Bug: 365449
Change-Id: I231d902d52e3e5e9a7748eedaa63a2bb889ebb13
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
Merge "Recurse into cloned submodules"
Cleanup possiblyFilteredInputStream() in WorkingTreeIterator

Use early return instead of nested if/else

Change-Id: I3b5048f9f5cfdfd01f916af550722532db3f9bb3