tools/release: Handle v1.0.0.201106090707-r-NN-gdeadbeef

The 1.0.0 release tags have a new suffix.
Account for this.

Change-Id: Ic6f260b6a5ba353af3b312b722f576155208eaa0
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Fix smart HTTP client stream alignment errors

The client's use of UnionInputStream was broken when combined with a
8192 byte buffer used by PackParser. A smart HTTP client connection
always pushes in the execute stateless RPC input stream after the
data stream has ended from the remote peer. At the end of the pack,
PackParser asked to fill a 8192 byte buffer, but if only e.g. 1000
bytes remained UnionInputStream went to the next stream and asked
it for input, which triggered a new RPC, and failed because there
was nothing pending in the request buffer.

Change UnionInputStream to only return what it consumed from a
single InputStream without invoking the next InputStream, just in
case that second InputStream happens to be one of these magical
ones that generates an RPC invocation.

Change-Id: I0e51a8e6fea1647e4d2e08ac9cfc69c2945ce4cb
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Wrap excessively long line in BasePackFetchConnection

Change-Id: I926838058c1de2146e22faa08570406600457acb
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Do not requeue state vector in stateless RPC fetch

If the no-done capability was enabled on the connection, don't
queue up the state vector again once the ACK %s ready message
is observed from the remote. The pack will be following in this
response stream, so the state vector is no longer required.

Change-Id: I7bd1e76957cb58c7ff1cdaeef227f1b02a7e5d24
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
PackWriter: Export more statistics

Export the shallow pack information, and also a handy function to
sum up the total times.  Include the time writing out the index file,
if it was created.

Change-Id: I7f60ae6848455a357b25feedb23743bbf6c153cf
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
UploadPack: Fix races in smart HTTP negotiation

Clients cache the set of advertised references at the start of a
negotiation, and keep replaying the same "want SHA1" list to the
server on each negotiation step.  If another client pushes into
a branch and moves it by fast-forward, any request to obtain that
branch's prior SHA-1 is still valid, the commit is reachable from
the new position of the reference.  Unfortunately the fast-forward
causes smart HTTP negotations to fail, as the server no longer is
advertising that prior SHA-1.

Instead of causing clients to fail out with a "want invalid" error
and forcing the end-user retry, possibly getting into a never ending
try-fail-retry race while other clients are pushing into the same
busy repository, allow the slightly stale want request so long as
it is still reachable.

C Git implemented this same change recently to fix races on the
smart HTTP protocol when the C Git git-http-backend is used.

The new RequestPolicy feature also allows server authors to make
an even more lenient configuration that exports any SHA-1 to the
client. This might be useful in certain settings where a server
has authenticated the client as the "repository owner" and wants
to allow them to grab any content from the server as a complete
unbroken history chain.

The new setAdvertisedRefs() method allows server authors to manually
fix the references that are advertised, possibly bypassing the
getAllRefs() call on the Repository object.

Change-Id: I7cdb563bf9c55c83653f217f6e53c3add55a0541
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Enable full Transport configuration for JGit API commands

Add a TransportConfigCallback parameter to JGit API commands, to allow
consumers of the JGit command API to perform custom Transport configuration
that would be otherwise difficult to anticipate & expose on the API command
builders.


My specific use-case is configuring additional properties on SshTransport
- I need to take over the SshSessionFactory used by the transport. Using
TransportConfigCallback I can simply do this (rather than reimplement the
API command classes):

public void configure(Transport tn) {
  if (tn instanceof SshTransport) {
    ((SshTransport) tn).setSshSessionFactory(factoryProvider.get());
  }
}

Adding an explicit setSshSessionFactory() method to the JGit command
classes would bloat the API. Also, creating the replacement
SshSessionFactory is unnecessary if the transport is not SSH, but the type
of the Transport is only known once the remote has been resolved and the
URI parsed - consequently it makes sense to perform this step in a
callback, where the transport instance can be inspected to determine if
it's of a relevant type.


A note about where this leaves the API - there are now 4 commands:

CloneCommand
PullCommand
FetchCommand
PushCommand

-that share 3 identical transport-related parameters:

timeout
credentialsProvider
transportConfigurator

I think there's potential for introducing an interface or val-object to
identify/encapsulate this repetition, which I'd be happy to do in a
subsequent commit.

Change-Id: I8983c3627cdd7d7b2aeb0b6a3dadee553378b951
Signed-off-by: Roberto Tyley <roberto.tyley@gmail.com>
Add blame unit test for file that is renamed twice.

Bug: 354507
Change-Id: I853774ecc1662d095a50a9668431c6e3ce4156c4
Signed-off-by: Kevin Sawicki <kevin@github.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
New config constant for default start-point

This constant determine the default start-point, if the user
don't want to create a branch from the current HEAD.

Change-Id: Iea944e11e80134fbafc4c47383457d5ed11a4164
Signed-off-by: Manuel Doninger <manuel.doninger@googlemail.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Add varargs version of PathFilterGroup.createFromStrings

This allows the following usage pattern:

  PathFilterGroup.createFromStrings("path1", "path2");

Change-Id: I589e758cc55873ce75614602e017ac793435e24d
Signed-off-by: Kevin Sawicki <kevin@github.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Fix DirCacheEdtor.DeleteTree for empty string argument

Change-Id: I7425da91c0752ae82484e3c29d21b57402d30c61
Do not attempt to resolve describe-labels with less than four digits

Change-Id: I21dcd3cca3b41102fd898238d8d640dea25e0caf
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Add missing comment text for mergeCommitTree parameter

Change-Id: I35cef13d8be4f06515668f710fd508700b90f44d
Signed-off-by: Kevin Sawicki <kevin@github.com>
Merge "Fix DirCacheEdtor.DeleteTree for empty string argument"
Extend IndexDiff to calculate ignored files and folders

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

Bug: 359264
Change-Id: I8f09d6a4d61b64aeea80fd22bf3a2963c2bca347
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
Merge changes I7cdb563b,I7f60ae68,I7bd1e769,I92683805,I0e51a8e6

* changes:
  UploadPack: Fix races in smart HTTP negotiation
  PackWriter: Export more statistics
  Do not requeue state vector in stateless RPC fetch
  Wrap excessively long line in BasePackFetchConnection
  Fix smart HTTP client stream alignment errors
Refactor HTTP server stack to use Filter as base

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

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

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

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

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

Change-Id: I2465c15c086497e0faaae5941159d80c028fa8b1
Merge "Extend IndexDiff to calculate ignored files and folders"
Correct typo in RevWalk.parseBody comment

Change-Id: I0e65a5a6809a8d32d256322dbcae94b6aa603e5e
Signed-off-by: Kevin Sawicki <kevin@github.com>
Fix bad checkout behaviour when a file is removed

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

Bug: 347574
Change-Id: Ie66fa61303472422830f5e33614e93ad65094e5d