Commit Graph

2949 Commits

Author SHA1 Message Date
Robin Stocker 9b26e4bffb Enable LsRemoteCommand to work without local repository
It's supported by C Git and can be useful.

Bug: 413388
Change-Id: I12c6c10e791cc09ee271d89eb8b8d32f53e385db
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-08-13 00:04:37 +02:00
Robin Stocker 6fb8d2345b Add missing @since tag for replaceLineBreaksWithSpace
Change-Id: Ibd9d9ba609a2cd7707b985cdb07405dce0422aab
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-08-12 21:34:50 +02:00
Matthias Sohn 7baeffc581 Allow the command line bundle to access internal jgit packages
Change-Id: Id1e11a21fdcbd8cb0f2f8c22e7ab253e8df65d2f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-08-11 00:51:42 +02:00
Robin Rosenberg c58405b0c3 Merge "Recognize CRLF when parsing the short message of a commit or tag" 2013-08-10 18:31:01 -04:00
Robin Rosenberg b6e5189c4e Merge "Added characters to be escaped in file name patterns" 2013-08-10 17:32:20 -04:00
Lars Vogel 594408e522 Add missing @since tags
Change-Id: I9754e2124c0fe6ad2dbde5597c3ed10f1c3efef5
Signed-off-by: Lars Vogel <Lars.Vogel@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-08-10 01:23:27 +02:00
Colby Ranger ae1f46989c Advertise capabilities with no refs in upload service.
With reference hiding, it is possible for a repository to appear
empty when all refs are hidden. This causes capabilities to not be
advertised either, since they are published with the first reference,
breaking fetch by SHA1 support.

Always advertise the capabilites by publishing the symbolic capabilities
reference when the repository has no references to advertise (similar to
the receive service).

Change-Id: I8060e430ee03571dc51239e702864c85e888505c
2013-08-08 11:10:40 -04:00
Shawn Pearce 15adcefb73 Allow UploadPack requests with no options
UploadPack can be invoked with no capabilities selected by the
client if the client is an ancient version of Git that nobody in
their right mind should still be using. Or if the client is very
broken and does not want to use any of the newer features added to
the protocol since its inception.

Change-Id: I3baa6f90e6a41a37a8eab8449a3cc41f4efcb91a
2013-08-07 15:44:02 -07:00
Colby Ranger ef7512b596 Add --quiet flag to pgm fetch.
Change-Id: If141fdc5c181b3a618b7e286ad3c6957211d0afc
2013-08-05 15:12:57 -07:00
Colby Ranger 69761dbcdd Send no-progress option with NullProgressMonitor.
The NullProgressMonitor does not report progress anywhere. Inform the
server not to send progress by enabling the no-progress capability.

Change-Id: Id18dbc754c814d1a5534a284c947030bf201c569
2013-08-05 14:56:17 -07:00
Shawn Pearce ffb2600dd5 Merge "Change RequestValidator parameter to ObjectId list" 2013-08-02 18:15:19 -04:00
Greg Hill 1471fb4e0f Change RequestValidator parameter to ObjectId list
Instead of RevObject list, this allows a custom request validator to be called
on SHA-1's corresponding to objects that may not exist in repository storage

Change-Id: I19bb667beff0d0c144150a61d7a1dc6c9703be7f
Signed-off-by: Greg Hill <greghill@google.com>
2013-08-02 12:42:54 -07:00
Christian Trutz f677b07b98 Add setter for ProgressMonitor to StatusCommand
This is useful if Git.status() is a long running command.

Change-Id: I6bdbf347a688043d549c1f091fb4a264a6c7024e
Signed-off-by: Christian Trutz <christian.trutz@gmail.com>
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-07-28 16:01:46 +02:00
Robin Stocker a76a4acf87 Implement open(URIish) for TransportLocal
Can be used for listing remote refs for a repository on the file system
without having a local repository.

Bug: 413400
Change-Id: I397f5092c5eafb62236e9f9e74d9183f56903cc6
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-07-21 22:27:46 -05:00
Robin Stocker 8b6bbf094f Fix NPE in openFetch on Transport without local repository
Setting the walk and other fields to null will result in NPEs when the
user e.g. calls fetch on the connection, but at least the advertised
refs can be read like that without having a local repository.

Bug: 413389
Change-Id: I39c8363e81a1c7e6cb3412ba88542ead669e69ed
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-07-21 22:15:31 -05:00
Robin Rosenberg a2b33a8ac3 Add NON-NLS comments for some obviously untranslatable strings
Change-Id: I2d1076b46695dac84961b8ae663bfc5cb123b3a3
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-07-21 22:06:34 -05:00
Robin Rosenberg 60e01cff2f Update reflog like C Git during rebase (non-interactive)
Bug: 346350
Change-Id: I119766a00bc52a810c51cffaa19207cb8555ca22
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-07-21 21:54:41 -05:00
Robin Stocker 7033179440 Improve documentation of PathSuffixFilter
Change-Id: I1077dbb1f10c7cc687c0d1b8a8e8f763ca96977c
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-07-21 21:47:00 -05:00
Christian Halstrick 06dd0e9e27 Add path option to StatusCommand
Allow filtering of the status. Only files which match given paths are
inspected and only their state is reported.

Change-Id: I3c4b1b46bf297cd4ebdb4997cfa14c8752a36411
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
2013-07-21 21:39:53 -05:00
Robin Stocker f5be93d003 Fix MERGED_NOT_COMMITTED toString
It had a typo (commited) and was not in the style of the others.

Change-Id: Ia1be1c70b13bb2f3da80c8e8239c5f254070fe60
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-07-18 20:05:29 +02:00
Dave Borowitz 6bbc32a8be TarFormat: use tabs for indent
Change-Id: I2f4c285d2b2f4bdb7a5d1a1026c131417066410d
2013-07-17 12:57:35 -07:00
Jonathan Nieder 75d9b31f14 Close unfinished archive entries on error
Otherwise the underlying error is hidden by an "IOException: This
archives contains unclosed entries." when jgit tries to close the
archive.

Reported-by: Dave Borowitz <dborowitz@google.com>
Change-Id: I594dcdf366200b802e13e5a645fe06597feb7bb4
Signed-off-by: Jonathan Nieder <jrn@google.com>
2013-07-17 12:21:56 -07:00
Matthias Sohn 459fd7d4bb Merge "Add missing @since tags" 2013-07-12 18:09:22 -04:00
Christian Halstrick de00ec94d8 Merge "Fix bugs in TreeWalk#isPathSuffix used by PathSuffixFilter" 2013-07-11 02:32:37 -04:00
Matthias Sohn 58a5b6d0c6 Add missing @since tags
Change-Id: I6f672249d7ca014c63fb939cd0836689eb27ab90
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-07-11 00:18:48 +02:00
Christian Halstrick f45288e7c4 Add tests for DirCacheCheckout and symlinks
DirCacheCheckout had a bug when the parentdirectory of a worktree was a
symlink. DirCacheCheckout was deleting those symlinks under certain
conditions. This was fixed in I81735ba0394ef6794e9b2b8bdd8bd7e8b9c6460f
without a test because previously it was hard to setup tests containing
symlinks.

BUG: 412489
Change-Id: I2513166af519d6fc01d1eae3976ad6cff6f98530
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-07-10 23:12:31 +02:00
Dave Borowitz 4af82ed04c 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
2013-07-10 14:50:41 -04:00
Christian Halstrick 4b1f368033 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>
2013-07-10 11:38:03 +02:00
Matthias Sohn e8f6c831c9 Update to Jetty 7.6.11.v20130520
Change-Id: I76d32444c9cf9f086a013e410a88d37a359272fd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-07-08 15:23:39 +02:00
Robin Stocker 56ee811780 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>
2013-07-08 10:53:50 +02:00
Robin Stocker 12326ddead 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>
2013-07-08 10:53:39 +02:00
Hiroshi Tomita 8e307cde56 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>
2013-07-05 09:09:04 +09:00
Dave Borowitz 360d8624ca 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
2013-07-03 15:44:42 -07:00
Dave Borowitz 68ccc5d213 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
2013-07-03 15:14:29 -07:00
Dave Borowitz e74751769e UploadPack: set RefFilter from TransportConfig
Teach TransportConfig to respect uploadpack.hiderefs, which is new in
C git 1.8.2.

Change-Id: Id12e7f00b9a60258e996410f67fa10616459f53f
2013-07-03 15:10:39 -07:00
Dave Borowitz e599af1900 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 01888db892.

Change-Id: I264e028a76574434cecb34904d9f5944b290df78
2013-07-03 15:09:55 -07:00
Dave Borowitz b4b84a84bd 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
2013-07-03 15:09:55 -07:00
Dave Borowitz fee679b587 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
2013-07-03 15:09:55 -07:00
Robin Stocker 21b3a16ab7 Merge "Update HEAD in cherry-picking several commits" 2013-07-02 07:12:32 -04:00
Colby Ranger 6cc532a43c 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
2013-07-01 09:23:29 -07:00
Hiroshi Tomita 6845bb5b3e 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
2013-07-01 22:37:48 +09:00
Colby Ranger 903fb9c739 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
2013-06-28 15:36:20 -07:00
Matthias Sohn a2e5653d5a Merge "Add missing @since tag" 2013-06-26 19:35:42 -04:00
Christian Halstrick 3eec684ec8 Merge "Move gc to package org.eclipse.jgit.pgm" 2013-06-24 05:32:59 -04:00
Alex Rukhlin 98dd6e6abd Fix HTTP response processing for WWW-Authenticate headers
The original code was able to process only one WWW-Authenticate
header in an HTTP response, and if this header was not one of
two expected, authentication failed regardless of that there
could be other headers in the response.

All WWW-Authenticate headers in an HTTP response have to be
browsed to find one of supported, i.e. Basic or Digest.
By that if both are present, the Digest one should be used
as more preferable.

Bug: 357719
Change-Id: Icf601a41fec63f7d40308f3c85aaa4f71a7c095b
Signed-off-by: Alex Rukhlin <arukhlin@microsoft.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-23 23:45:42 +02:00
Dave Borowitz 84d2738ff2 Don't skip want validation when the client sends no haves
Change-Id: I5e80b3befca5cf1dcb06075862d6d48e6491cc0f
2013-06-21 16:14:30 -07:00
Matthias Sohn f34e38f473 Move gc to package org.eclipse.jgit.pgm
All bugs reported for gc have been fixed and it seems we reached a
stable implementation.

Change-Id: I78a96ee2103beb48325da0f6ee10b2498bdc0267
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-22 00:57:26 +02:00
Matthias Sohn d66dad2a94 Add missing @since tag
Change-Id: I80cfc3e81d5cebf810f36ddf2760aee955c6f50a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-06-20 09:52:11 +02:00
Shawn Pearce fe248d24db Remove fix-headers and rewrite-history
These scripts were created to bootstrap the initial contribution for
Eclipse using information from the pre-Eclipse history. We are well
past the point where the project will rewrite history in order to
correct copyright statements, so these tools no longer make sense
to keep in the tip of the tree.

Change-Id: If68419ead0766035d17a21a53a3e5e761eaa70c4
2013-06-19 15:29:15 -07:00
Dave Borowitz b646578d89 Add a method to DfsOutputStream to read as an InputStream
Change-Id: I0ec1f17a88bc14f22c10f9bc8d6f5b5118410e3a
2013-06-19 09:36:10 -07:00