Always close the GZIPOutputStream to release Deflater

The stream must be closed to ensure the native resources associated
with its internal Deflater instance are cleaned up early, instead of
waiting for GC to identify the dead object and finialize it.

Change-Id: Ic31b5df563f19404ed4682556999f4332aa61562
Ensure all smart HTTP errors are sent to clients

Error messages are typically short, below the 32 KiB in-memory buffer
size of the SmartOutputStream. When an error is queued up for sending
to a client and an exception is thrown up into the servlet handler we
discarded the message and sent nothing to the client, as the messages
were stuck inside of the SmartOutputStream buffer.

Hoist the creation of the output stream above the invocation of try
block of the service, and use close() in the few catch blocks that
assume there are buffered messages ready for transmission. This will
ensure errors from unpacking a stream in ReceivePack are sent off to
a client correctly, as previously these were causing no status report
to arrive at the client side as the data was stuck in the buffer.

Change-Id: I5534b560697731121f48979ae077aa7c95b8e39c
Discard request HTTP bodies for status code <400

The HTTP RFCs require a server to fully consume the request body before
it can return a non-error status code, which is any code below 400.

JGit returns most Git level errors inside of an HTTP 200 OK response,
and sometimes this happens before the entire request was consumed from
the servlet container. In such cases the body must be skipped or read
until EOF is reached, ensuring the HTTP keep-alive semantics will work
for the next request on the same TCP connection.

HTTP status codes >= 400 may be returned without consuming the body,
and a servlet container must set "Connection: close" in the response
headers when this happens, since the state of the request body is not
well defined with an early abort.

With the introduction of sendError() in GitSmartHttpTools there are
only a handful of locations that need to worry about the request body
being consumed, so sprinkle the call in as necessary.

Change-Id: I5381e110585f780c01a764df8e27c80aacf5146e
Allow to list tags with org.eclipse.jgit.pgm.Tag

Change-Id: I79c284a720935814aef9767156106833f983bb8b
Fix History rendering

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

Bug: 335818
Change-Id: Ic944193b2aca55ff3eb0235d46afa60b7896aa0f
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Add percent-encoding of reserved characters in URIish

We do this for the the names that have an explicit scheme and
do it both ways. The URIish is parsed before decoding. Only
a few special characters are encoded for the path part of the
URI, i.e. space, non-ASCII and control characters. The percent
encoding is assumed to be a stream encoding so we interpret it
as UTF-8.

Change-Id: I82d1910df9472e21d7212a2b984ff7d8fb2cbf0f
Merge "Add percent-encoding of reserved characters in URIish"
Merge "Fix History rendering"
Merge "Always close the GZIPOutputStream to release Deflater"
Merge changes I5381e110,I5534b560

* changes:
  Discard request HTTP bodies for status code <400
  Ensure all smart HTTP errors are sent to clients
Stream left open in WorkingTreeIterator#filterClean

Change-Id: I17c2709f2613536c02c9ea2977d936b87029ac0d
Force jgit.sh to use UTF-8 encoding on Mac

For some obscure reason the platform encodng in Java on Macs
is MacRoman. OS X used UTF-8 as the default encoding so set
the encoding property in jgit.sh.

Change-Id: I08182c2f8512f799178cee70bcc28d6ee2b9c2b0
Set expected old object id to all zeros when head id is null

This will be the case on the initial commit to a repository
and the ref update should expect a non-existent ref

Change-Id: Iaa06e47e6e8cc4a0281c7683b367d4806dd980ea
Use System.arraycopy to copy parent object id array

Change-Id: Iee475584f0a65b8b77610cd277f15295b68dfe80
Add a no-op UploadPackLogger and use it by default

This matches the behavior of the hooks in UploadPack.

Change-Id: I21277e52ee9452237d87084f06bb140dfa6bf608
[findBugs] Implement Serializable interface in PlotLane

This class is referenced by PlotCommit which is Serializable

Change-Id: If79b6a593dc53fbb7c4f0a69a9d0dca02a8cb63c
Add toString() to HunkHeader

Since FileHeader provides toString() method (via DiffEntry) we could add
a similar method to HunkHeader.

Change-Id: I7886e5b8f775fa8e8478ac5af37d90b6ef677d8b
Merge "[findBugs] Implement Serializable interface in PlotLane"
Merge "Use System.arraycopy to copy parent object id array"
Merge "Set expected old object id to all zeros when head id is null"