Added characters to be escaped in file name patterns

Originally, characters could not be escaped in FileNameMatcher patterns.
This breaks file name matching when escaped brackets "\[" and "\]" are
used in the pattern. A fix has been implemented to allow for any
character to be escaped by prepending it with a '\'

Bug: 340715
Change-Id: Ie46fd211931fa09ef3a6a712bd1da3d7fb64c5e3
Signed-off-by: Gustav Karlsson <gustav.karlsson@tieto.com>
Recognize CRLF when parsing the short message of a commit or tag

Bug: 400707
Change-Id: I9b09bb88528af465018fc0278f5441f7e6b75986
Add missing @since tag

Change-Id: I80cfc3e81d5cebf810f36ddf2760aee955c6f50a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Merge "Add missing @since tag"
Implement get nth offset in PackIndex.

Currently, the offset can only be retrieved by ObjectId or iterating all
of the entries. Add a method to lookup the offset by position in the
index sorted by SHA1.

Change-Id: I45e9ac8b752d1dab47b202753a1dcca7122b958e
Update HEAD in cherry-picking several commits

Without update, index is wrongly detected to be dirty
when picking the second commit.

Change-Id: Idf47ecb33e8bd38340d760806d629f67be92d2d5
Signed-off-by: Hiroshi Tomita <tomykaira@gmail.com>
Bug: 411963
Use a bucket sort for PackReverseIndex.

Previously it took 1200ms to create a reverse index (sorted by offset).
Using a simple bucket sort algorithm, that time is reduced to 450ms.
The bucket index into the offset array is kept, in order to decrease
the binary search window.

Don't keep a copy of the offsets. Instead, use nth position
to lookup the offset in the PackIndex.

Change-Id: If51ab76752622e04a4430d9a14db95ad02f5329d
Merge "Update HEAD in cherry-picking several commits"
Add RequestPolicy.TIP to allow fetching non-advertised ref tips

Users of UploadPack may set a custom RefFilter or AdvertisedRefsHook
that limits which refs are advertised, but clients may learn of a
SHA-1 that the server should have as a ref tip through some
alternative means. Support serving such objects from the server side
with a new RequestPolicy.

As with ADVERTISED, we need a special relaxed RequestPolicy to allow
commits reachable from the set of valid tips for unidirectional
connections.

Change-Id: I0d0cc4f8ee04d265e5be8221b9384afb1b374315
UploadPack: advertise allow-tip-sha1-in-want

This protocol capability, new in C git 1.8.2, corresponds to
RequestPolicy.TIP, so advertise it if that request policy was set.

Change-Id: I0d52af8a7747e951a87f060a5124f822ce1b2b26
UploadPack: configure RequestPolicy with TransportConfig

C git 1.8.2 supports setting the equivalent of RequestPolicy.TIP with
uploadpack.allowtipsha1. Parse this into TransportConfig and use it
from UploadPack. An explicitly set RequestPolicy overrides the config,
and the policy may still be upgraded on a unidirectional connection to
avoid races.

Defer figuring out the effective RequestPolicy to later in the
process. This is a minor semantic change to fix a bug: previously,
calling setRequestPolicy(ADVERTISED) _after_ calling
setBiDirectionalPipe(true) would have reintroduced the race condition
otherwise fixed by 01888db892aa9590862d886c01f3b293140db153.

Change-Id: I264e028a76574434cecb34904d9f5944b290df78
UploadPack: set RefFilter from TransportConfig

Teach TransportConfig to respect uploadpack.hiderefs, which is new in
C git 1.8.2.

Change-Id: Id12e7f00b9a60258e996410f67fa10616459f53f
UploadPack: refactor want validation

Associate each RequestPolicy with an implementation of a
RequestValidator interface that contains the validation logic. The
checkWants method is only called if there are wants that were not
advertised, since clients may always request any advertised want
according to the git protocol. Calling the method only once at the
end of parsing the want list also means policy implementations can be
stateful, unlike the previous switch statement inside a loop.

For the special handling of unidirectional pipes, simply check
isBiDirectional() and delegate to other implementations if necessary.

Change-Id: I52a174999ac3a5aca46d3469cb0b81edd1710580
UploadPack: allow custom RequestValidator instances

Make the existing concrete implementations public as well so custom
implementations may delegate to them where appropriate. Treat all custom
implementations as providing allow-tip-sha1 in want.

Change-Id: If386fe25c0d3b4551a97c16a22350714453b03e9
Check parentFile is not null

parentFile becomes null when f is relative path, such as ".".

This patch avoids NullPointerException in such case.

Change-Id: I4752674b1daab6eedd7c3650c7749462810eaffd
Signed-off-by: Hiroshi Tomita <tomykaira@gmail.com>
Refactor PathSuffixFilterTest to remove duplication

Makes it possible to add new test cases without copying lots of lines.

Change-Id: I66db3bc0cbd18fb5a07748905c60384b86b1c162
Signed-off-by: Robin Stocker <robin@nibor.org>
Fix bugs in TreeWalk#isPathSuffix used by PathSuffixFilter

* It didn't check the first character in the pattern due to a off-by-one
  error. Spotted by James Roper.
* It returned true even when pattern was longer than current path, e.g.
  it returned that ".txt" is suffix of "txt".

Bug: 411999
Change-Id: I9fbcd68a11fb57cc49956b70c387a47271a0424f
Signed-off-by: Robin Stocker <robin@nibor.org>
Update to Jetty 7.6.11.v20130520

Change-Id: I76d32444c9cf9f086a013e410a88d37a359272fd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Make sure checkout is not deleting folders outside the workingtree

There was a chance that jgit deletes symbolic links which point to the
folder on top of the working tree. Make sure not to touch these
resources.

Thanks to Cedric Darloy who reported this bug on
http://www.eclipse.org/forums/index.php/m/776910/#msg_776910 and to
Ondrej Vrabec who reported bug 412489.

Bug: 412489
Change-Id: I81735ba0394ef6794e9b2b8bdd8bd7e8b9c6460f
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Robin Stocker <robin@nibor.org>
Merge changes If386fe25,I52a17499,Id12e7f00,I264e028a,I0d52af8a,I0d0cc4f8

* changes:
  UploadPack: allow custom RequestValidator instances
  UploadPack: refactor want validation
  UploadPack: set RefFilter from TransportConfig
  UploadPack: configure RequestPolicy with TransportConfig
  UploadPack: advertise allow-tip-sha1-in-want
  Add RequestPolicy.TIP to allow fetching non-advertised ref tips