summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.test/tst
Commit message (Collapse)AuthorAgeFilesLines
* Add TransportHttp#getAdditionalHeadersMatthias Sohn2023-05-031-1/+9
| | | | | | | to enable inspecting which additional HTTP headers have been set on the transport. Change-Id: I0771be9cb7c837de7c203b7f044109b9b2a7d7ad
* Merge branch 'stable-6.2' into stable-6.3Matthias Sohn2022-11-161-6/+6
|\ | | | | | | | | | | | | | | | | * stable-6.2: Extract Exception -> HTTP status code mapping for reuse Don't handle internal git errors as an HTTP error Allow to perform PackedBatchRefUpdate without locking loose refs Change-Id: I562be0802efa231023c5f10e6461339b2d7fbacf
| * Don't handle internal git errors as an HTTP errorSven Selberg2022-11-101-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix that fixed the propagation of error-codes: 8984e1f66 HTTP Smart: set correct HTTP status on error [1] made some faulty assumptions. "Wants not valid", can be an intermittent git error and the HTTP response should be 200 and not 400 since the request isn't necessary faulty. [1] https://git.eclipse.org/r/c/jgit/jgit/+/192677 Bug: 579676 Change-Id: I461bc78ff6e450636811ece50d21c57a2a7f2ae3
* | Fetch: add support for shallowRobin Müller2022-07-311-0/+109
|/ | | | | | | | | | This adds support for shallow cloning. The CloneCommand and the FetchCommand now have the new methods setDepth, setShallowSince and addShallowExclude to tell the server that the client doesn't want to download the complete history. Bug: 475615 Change-Id: Ic80fb6efb5474543ae59be590ebe385bec21cc0d
* HTTP Smart: set correct HTTP status on errorSven Selberg2022-05-092-9/+24
| | | | | | | | | | | | | | | | | | | | | | | Previous behavior was that status code was automatically set to 200 regardless of reported status and according to HTTP Smart protocol[1]: If there is no repository at $GIT_URL, or the resource pointed to by a location matching $GIT_URL does not exist, the server MUST NOT respond with 200 OK response. A server SHOULD respond with 404 Not Found, 410 Gone, or any other suitable HTTP status code which does not imply the resource exists as requested. Since the jgit HTTP client isn't able to handle reading content from a response reporting an error (calling HttpURLConnection#getInputStream on a "failed" connection throws an exception and the internal interface HttpConnection does not expose HttpURLConnection#getErrorStream) the SmartClientSmartServerTest needed to be rewritten to expect the generic response messages. [1] https://git-scm.com/docs/http-protocol#_general_request_processing Bug: 579676 Change-Id: Ibb942d02124a0bc279df09600b091354019ce064
* [test] Fix closing of test repositoriesNail Samatov2022-01-302-0/+2
| | | | | | | | | | | | | | | | Fix tests failing on Windows because Repository instance is created but not closed on tear down. Fix repositories closed twice, except in tests that test this behavior explicitly. Name the temporary directories the tests run in after the test method; that makes it easier to figure out in which tests repositories are closed twice if it should occur again in the future. Bug: 550111 Change-Id: I9398b58f0f36d2c29236d2a9a8599117d9083980 Signed-off-by: Nail Samatov <sanail@yandex.ru> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* HttpClientConnectionTest: organize importsMatthias Sohn2021-11-221-7/+7
| | | | Change-Id: I7e1f8627a9360c660adc6f00fe48afe005929150
* TransportHttp: support preemptive Basic authenticationThomas Wolf2021-01-141-21/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the caller knows already HTTP Basic authentication will be needed and if it also already has the username and password, preemptive authentication is a little bit more efficient since it avoids the initial 401 response. Add a setPreemptiveBasicAuthentication(username, password) method to TransportHttp. Client code could call this for instance in a TransportConfigCallback. The method throws an IllegalStateException if it is called after an HTTP request has already been made. Additionally, a URI can include userinfo. Although it is not recommended to put passwords in URIs, JGit's URIish and also the Java URL and URI classes still allow it. The underlying HTTP connection may omit these fields though. If present, take these fields as additional source for preemptive Basic authentication if setPreemptiveBasicAuthentication() has not been called. No preemptive authentication will be done if the connection is redirected to a different host. Add tests. Bug: 541327 Change-Id: Id00b975e56a15b532de96f7bbce48106d992a22b Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* TransportHttp: make the connection factory configurableThomas Wolf2021-01-141-0/+64
| | | | | | | | | | | | | | | | | Previously, TransportHttp always used the globally set connection factory. This is problematic if that global factory is changed in the middle of a fetch or push operation. Initialize the factory to use in the constructor, then use that factory for all HTTP requests made through this transport. Provide a setter and a getter for it so that client code can customize the factory, if needed, in a TransportConfigCallback. Once a factory has been used on a TransportHttp instance it cannot be changed anymore. Make the global static factory reference volatile. Change-Id: I7c6ee16680407d3724e901c426db174a3125ba1c Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Protocol V2: respect MAX_HAVES only once we got at least one ACKThomas Wolf2021-01-041-0/+63
| | | | | | | | | | | | | | | | | | | | | | | The negotiation in the git protocol contains a cutoff: if the client has sent more than MAX_HAVES "have" lines without getting an ACK, it gives up and sends a "done". MAX_HAVES is 256. However, this cutoff must kick in only if at least one ACK has been received. Otherwise the client may give up way too early, which makes the server send all its history. See [1]. This was missed when protocol V2 was implemented for fetching in JGit in commit 0853a241. Compare also C git commit 0b07eecf6ed.[2] C git had the same bug.[3][4] [1] https://github.com/git/git/blob/6c430a647cb9/Documentation/technical/pack-protocol.txt#L385 [2] https://github.com/git/git/commit/0b07eecf6ed [3] https://lore.kernel.org/git/b7f5bfb9-61fb-2552-4399-b744428728e4@suse.cz/ [4] https://lore.kernel.org/git/20200422084254.GA27502@furthur.local/ Bug: 553083 Change-Id: I1f4e2cc16b5eed6971d981d472329185abb9e4a9 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Enable git wire protocol version 2 on server side per defaultDavid Ostrovsky2021-01-032-14/+20
| | | | | | Bug: 563145 Change-Id: Id5030c2b85466da0a8ccf3d78ae78df16d64ffc5 Signed-off-by: David Ostrovsky <david@ostrovsky.org>
* Client-side protocol V2 support for fetchingThomas Wolf2021-01-015-89/+304
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make all transports request protocol V2 when fetching. Depending on the transport, set the GIT_PROTOCOL environment variable (file and ssh), pass the Git-Protocol header (http), or set the hidden "\0version=2\0" (git anon). We'll fall back to V0 if the server doesn't reply with a version 2 answer. A user can control which protocol the client requests via the git config protocol.version; if not set, JGit requests protocol V2 for fetching. Pushing always uses protocol V0 still. In the API, there is only a new Transport.openFetch() version that takes a collection of RefSpecs plus additional patterns to construct the Ref prefixes for the "ls-refs" command in protocol V2. If none are given, the server will still advertise all refs, even in protocol V2. BasePackConnection.readAdvertisedRefs() handles falling back to protocol V0. It newly returns true if V0 was used and the advertised refs were read, and false if V2 is used and an explicit "ls-refs" is needed. (This can't be done transparently inside readAdvertisedRefs() because a "stateless RPC" transport like TransportHttp may need to open a new connection for writing.) BasePackFetchConnection implements the changes needed for the protocol V2 "fetch" command (stateless protocol, simplified ACK handling, delimiters, section headers). In TransportHttp, change readSmartHeaders() to also recognize the "version 2" packet line as a valid smart server indication. Adapt tests, and run all the HTTP tests not only with both HTTP connection factories (JDK and Apache HttpClient) but also with both protocol V0 and V2. The SSH tests are much slower and much more focused on the SSH protocol and SSH key handling. Factor out two very simple cloning and pulling tests and make those run with protocol V2. Bug: 553083 Change-Id: I357c7f5daa7efb2872f1c64ee6f6d54229031ae1 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Add constants for parsing git wire protocol versionDavid Ostrovsky2020-11-291-4/+10
| | | | | | | This would allow other JGit users to access and reuse the constants. Change-Id: I1608802f45586af5f8582afa592e26679e9cebe3 Signed-off-by: David Ostrovsky <david@ostrovsky.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* TransportHttp: abort on time-out or on SocketExceptionThomas Wolf2020-05-231-0/+76
| | | | | | | | | | | | | | | | | | Avoid trying other authentication methods on SocketException or on InterruptedIOException. SocketException is rather fatal, such as nothing listening on the peer's port, connection reset, or it could be a connection time-out. Time-outs enforced by Timeout{Input,Output}Stream may result in InterruptedIOException being thrown. In both cases, it makes no sense to try other authentication methods, and doing so may wrongly report "authentication not supported" or "cannot open git-upload-pack" or some such instead of reporting a time-out. Bug: 563138 Change-Id: I0191b1e784c2471035e550205abd06ec9934fd00 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Replace ExpectedException which was deprecated in junit 4.13Matthias Sohn2020-01-241-15/+11
| | | | | Change-Id: I64b0c057dd0a12aef2f3d56fa0c8a10e3b23fffd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Replace deprecated junit assertion methods with hamcrestMatthias Sohn2020-01-221-1/+1
| | | | Change-Id: Icebe8071eeefbc13d3bdbc231c568209cdc26195 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-0422-836/+110
| | | | | | | | | | This is the format given by the Eclipse legal doc generator [1]. [1] https://www.eclipse.org/projects/tools/documentation.php?id=technology.jgit Bug: 548298 Change-Id: I8d8cabc998ba1b083e3f0906a8d558d391ffb6c4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* UploadPackServlet: Use uploadWithExceptionPropagationMasaya Suzuki2019-12-021-1/+1
| | | | | | | | | As UploadPackErrorHandler's Javadoc says, UploadPackServlet should have called uploadWithExceptionPropagation and let UploadPackErrorHandler to handle the exception. Fix UploadPackServlet. Change-Id: I1f9686495fcf3ef28598ccdff3e6f76a16c8bca3 Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
* Enable and fix "Statement unnecessarily nested within else clause" warningsDavid Pursehouse2019-10-171-2/+1
| | | | | | | | | | | | | | | Since [1] the gerrit project includes jgit as a submodule, and has this warning enabled, resulting in 100s of warnings in the console. Also enable the warning here, and fix them. At the same time, add missing braces around adjacent and nearby one-line blocks. [1] https://gerrit-review.googlesource.com/c/gerrit/+/227897 Change-Id: I81df3fc7ed6eedf6874ce1a3bedfa727a1897e4c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* bazel: fix running http testsMatthias Sohn2019-09-081-0/+2
| | | | | | | | | Other than Maven bazel seems unable to cope with abstract AllFactoriesHttpTestCase having no test methods, hence tag this class with @Ignore. Change-Id: I9dfe43f882ad073b284648e24844b51877d87776 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Set parameter name in parameterized http testsMatthias Sohn2019-09-081-4/+12
| | | | | | This shows the class name of the HTTP factory used in each test run. Change-Id: I7c1df20f0e138dc7e3120fe87e80d40ab17dd8c8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Apache HTTP: run more testsThomas Wolf2019-08-2610-94/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Factor out the test parameterization to use both connection factories into a common super class and use it in more tests. This made HttpClientTests.testV2HttpSubsequentResponse() fail for Apache HTTP. The test used the pattern - create POST connection - setDoOutput(true) - connect() - write output stream - get & read input stream This pattern is never used in JGit, which actually calls connect() only in one case in LFS, and that's on a HEAD request. The above pattern works on JDK, but fails on Apache HTTP because with Apache HTTP a connect() actually executes the full request including writing the entity. To work with Apache HTTP, the pattern would need to be - create POST connection - setDoOutput(true) - write output stream - connect() - get & read input stream which is fine for both. JDK connects implicitly in getOutputStream() and treats the later explicit connect() as a no-op, and Apache works because the entity is written when connect() is called. Because JDK connects implicitly on getOutputStream(), the following pattern also works with JDK: - create POST connection - setDoOutput(true) - write output stream - get & read input stream Support this with Apache HTTP too: let getInputStream() execute the request if it wasn't executed already. Remove explicit connect() calls from test code, since JGit doesn't do those either. Change-Id: Ica038c00a7b8edcc01d5660d18e961146305b87f Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Merge branch 'stable-5.4'Matthias Sohn2019-08-201-10/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.4: Fix NPE in RebaseTodoFile#parseComments Fix NPE in ObjectIdOwnerMap#get Fix NPE in CommitOnlyTest#getHead FileUtils#lastModifiedInstant should not log error if path doesn't exist Cache user global and system-wide git configurations Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock Add missing dependencies for running FS_POSIXTest in Eclipse Fix javadoc for SystemReader#getInstance Upgrade tycho-extras to 1.4.0 Improve retry handling when saving FileStoreAttributes fails Ensure FSTest uses MockSystemReader Make supportsAtomicCreateNewFile return true as default Update orbit to R20190602212107-2019-06 to enable backports from master Handle InvalidPathException in FS_POSIX#createNewFileAtomic Ensure root cause of lock creation failures is logged Implement toString in MockSystemReader and MockConfig LocalDiskRefTreeDatabaseTest shall use MockSystemReader Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader Ensure we use MockSystemReader in tests Override FileBasedConfig's save method in MockConfig Remove FileBasedConfig.load(boolean) introduced in d45219ba Disable debug log for FS in org.eclipse.jgit.test Bazel: enable logging for tests in org.eclipse.jgit.test LockFile: log exception if creation of lock file failed Stop using deprecated Constants.CHARACTER_ENCODING Change-Id: I709de5edb626536529a99220aae7751b127c9bff Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Merge branch 'stable-5.3' into stable-5.4Matthias Sohn2019-08-201-10/+8
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.3: Fix NPE in RebaseTodoFile#parseComments Fix NPE in ObjectIdOwnerMap#get Fix NPE in CommitOnlyTest#getHead FileUtils#lastModifiedInstant should not log error if path doesn't exist Cache user global and system-wide git configurations Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock Add missing dependencies for running FS_POSIXTest in Eclipse Fix javadoc for SystemReader#getInstance Improve retry handling when saving FileStoreAttributes fails Ensure FSTest uses MockSystemReader Make supportsAtomicCreateNewFile return true as default Update orbit to R20190602212107-2019-06 to enable backports from master Handle InvalidPathException in FS_POSIX#createNewFileAtomic Ensure root cause of lock creation failures is logged Implement toString in MockSystemReader and MockConfig LocalDiskRefTreeDatabaseTest shall use MockSystemReader Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader Ensure we use MockSystemReader in tests Override FileBasedConfig's save method in MockConfig Remove FileBasedConfig.load(boolean) introduced in d45219ba Disable debug log for FS in org.eclipse.jgit.test Bazel: enable logging for tests in org.eclipse.jgit.test LockFile: log exception if creation of lock file failed Stop using deprecated Constants.CHARACTER_ENCODING Change-Id: I43c2ab8b44c3e87d48e4072907ad169c81e3ffe0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * Merge branch 'stable-5.2' into stable-5.3Matthias Sohn2019-08-191-10/+8
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.2: Fix NPE in RebaseTodoFile#parseComments Fix NPE in ObjectIdOwnerMap#get Fix NPE in CommitOnlyTest#getHead FileUtils#lastModifiedInstant should not log error if path doesn't exist Cache user global and system-wide git configurations Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock Add missing dependencies for running FS_POSIXTest in Eclipse Fix javadoc for SystemReader#getInstance Improve retry handling when saving FileStoreAttributes fails Ensure FSTest uses MockSystemReader Make supportsAtomicCreateNewFile return true as default Update orbit to R20190602212107-2019-06 to enable backports from master Handle InvalidPathException in FS_POSIX#createNewFileAtomic Ensure root cause of lock creation failures is logged Implement toString in MockSystemReader and MockConfig LocalDiskRefTreeDatabaseTest shall use MockSystemReader Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader Ensure we use MockSystemReader in tests Override FileBasedConfig's save method in MockConfig Remove FileBasedConfig.load(boolean) introduced in d45219ba Disable debug log for FS in org.eclipse.jgit.test Bazel: enable logging for tests in org.eclipse.jgit.test LockFile: log exception if creation of lock file failed Stop using deprecated Constants.CHARACTER_ENCODING Change-Id: If0c5010a2cf151ebebb2f2088fac3ee02c5007b9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * Merge branch 'stable-5.1' into stable-5.2Matthias Sohn2019-08-191-10/+8
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: Fix NPE in RebaseTodoFile#parseComments Fix NPE in ObjectIdOwnerMap#get Fix NPE in CommitOnlyTest#getHead FileUtils#lastModifiedInstant should not log error if path doesn't exist Cache user global and system-wide git configurations Avoid setup and saving FileStoreAttributes compete for ~/.gitconfig lock Add missing dependencies for running FS_POSIXTest in Eclipse Fix javadoc for SystemReader#getInstance Improve retry handling when saving FileStoreAttributes fails Ensure FSTest uses MockSystemReader Make supportsAtomicCreateNewFile return true as default Update orbit to R20190602212107-2019-06 to enable backports from master Handle InvalidPathException in FS_POSIX#createNewFileAtomic Ensure root cause of lock creation failures is logged Implement toString in MockSystemReader and MockConfig LocalDiskRefTreeDatabaseTest shall use MockSystemReader Ensure LocalDiskRepositoryTestCase#setup fully uses MockSystemReader Ensure we use MockSystemReader in tests Override FileBasedConfig's save method in MockConfig Remove FileBasedConfig.load(boolean) introduced in d45219ba Disable debug log for FS in org.eclipse.jgit.test Bazel: enable logging for tests in org.eclipse.jgit.test LockFile: log exception if creation of lock file failed Stop using deprecated Constants.CHARACTER_ENCODING Change-Id: I48c585f3c9287be7d6ddb6b01a1955444e13fa31 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | * Cache user global and system-wide git configurationsMatthias Sohn2019-08-181-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far the git configuration and the system wide git configuration were always reloaded when jgit accessed these global configuration files to access global configuration options which are not in the context of a single git repository. Cache these configurations in SystemReader and only reload them if their file metadata observed using FileSnapshot indicates a modification. Change-Id: I092fe11a5d95f1c5799273cacfc7a415d0b7786c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
| | | | * Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8David Pursehouse2019-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I621ba174235a6fb56236e54d24bce704bb5afb28 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | | | * Make inner classes static where possibleDavid Pursehouse2019-06-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported by Error Prone: An inner class should be static unless it references members of its enclosing class. An inner class that is made non-static unnecessarily uses more memory and does not make the intent of the class clear. See https://errorprone.info/bugpattern/ClassCanBeStatic Change-Id: Ib99d120532630dba63cf400cc1c61c318286fc41 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> (cherry picked from commit ee40efcea44bc0c9a28afe29a80c87636947484e)
* | | | | TransportHttp: resolve redirect URIs from the "Location" headerThomas Wolf2019-08-161-2/+39
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "Location" header in a redirect response may contain a relative URI. Resolve it against the URI the request was made. Bug: 550033 Change-Id: I29de07dfbbbc794090821b7c190cb2cf662c5a60 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | PacketLineIn: Add an iterator over strings in the input streamDavid Pursehouse2019-06-031-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allows callers to read all lines in the input stream until the END marker is reached, without having to explicitly check for the END marker. Replace all remaining usage of the END marker with the new method. Change-Id: I51f419c7f569ab7ed01e1aaaf6b40ed8cdc2116b Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | Replace trivial reference comparison of PacketLineIn.{DELIM,END}David Pursehouse2019-06-022-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace reference comparisons of PacketLineIn's DELIM and END strings with usage of the helper methods isDelimiter() and isEnd(). Change-Id: I52dcfc4ee9097f1bd6970601c716701847d9eebd Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | Convert to lambda or member referenceCarsten Hammer2019-05-167-120/+57
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert anonymous inner classes to lambda expressions or member references Bug: 545856 CQ: 19537 Change-Id: I621431c178e8b99316314602f7c66c9a36f9ae98 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | SmartClientSmartServerTest: Open Repository in try-with-resourceDavid Pursehouse2019-01-211-97/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 52923e9 ("LocalDiskRepositoryTestCase#createRepository: Default auto-close to false", Jan 20, 2019) the createBareRepository method creates repositories that do not get automatically closed in #tearDown. Convert invocations of createBareRepository to use try-with-resource. Change-Id: I320030c5d4438713971bee33316bff408bac47fc Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | SmartClientSmartServerTest: Open ObjectInserter.Formatter in try-with-resourceDavid Pursehouse2019-01-211-3/+5
| | | | | | | | | | | | | | | Change-Id: I7005f5821394a3e237cf877cf38557b6a62cacb3 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | SmartClientSmartServerTest#addBrokenContext: Remove unused TestRepositoryDavid Pursehouse2019-01-211-3/+3
| | | | | | | | | | | | | | | Change-Id: Id2b44199cda7eee7ec949d31b9029ef9325a54f4 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | SmartClientSmartServerTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-4/+12
| | | | | | | | | | | | | | | Change-Id: If1351920398f574b5b93be55868c157c3cd15290 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | SmartClientSmartServerTest: Stop using deprecated Repository#hasObjectDavid Pursehouse2019-01-201-4/+4
| | | | | | | | | | | | | | | Change-Id: I75d1105934aeaac89476603e15cf642a65a3acbe Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | DumbClientSmartServerTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-1/+4
| | | | | | | | | | | | | | | Change-Id: Ica172a85ec9b7da1416ff1b22699809f2c8c9df7 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | DumbClientDumbServerTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-1/+4
| | | | | | | | | | | | | | | Change-Id: Iaf339ae739689d4528a079776d6e945ba9006368 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | Merge branch 'stable-5.2'Jonathan Nieder2019-01-101-1/+83
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.2: Prepare 5.2.2-SNAPSHOT builds JGit v5.2.1.201812262042-r Prepare 5.1.6-SNAPSHOT builds JGit v5.1.5.201812261915-r UploadPack: Filter refs used for deepen-not resolution UploadPack: Avoid calling AdvertiseRefsHook twice Prepare 5.1.5-SNAPSHOT builds JGit v5.1.4.201812251853-r UploadPack: Filter refs used for want-ref resolution UploadPack: Defer want-ref resolution to after parsing Call AdvertiseRefsHook for protocol v2 Prepare 4.11.7-SNAPSHOT builds JGit v4.11.6.201812241910-r Prepare 4.9.9-SNAPSHOT builds JGit v4.9.8.201812241815-r UploadPack: Test filtering by AdvertiseRefsHook in stateless transports Prepare 4.7.8-SNAPSHOT builds JGit v4.7.7.201812240805-r Fix feature versions imported by feature org.eclipse.jgit.pgm Prepare 4.5.6-SNAPSHOT builds JGit v4.5.5.201812240535-r Call AdvertiseRefsHook before validating wants Change-Id: Ia56348e54d62630d7c50a4747df89516fc5afad9 Signed-off-by: Jonathan Nieder <jrn@google.com>
| * | Merge branch 'stable-5.1' into stable-5.2Jonathan Nieder2018-12-261-1/+83
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: UploadPack: Avoid calling AdvertiseRefsHook twice Prepare 5.1.5-SNAPSHOT builds JGit v5.1.4.201812251853-r UploadPack: Filter refs used for want-ref resolution UploadPack: Defer want-ref resolution to after parsing Call AdvertiseRefsHook for protocol v2 Prepare 4.11.7-SNAPSHOT builds JGit v4.11.6.201812241910-r Prepare 4.9.9-SNAPSHOT builds JGit v4.9.8.201812241815-r UploadPack: Test filtering by AdvertiseRefsHook in stateless transports Prepare 4.7.8-SNAPSHOT builds JGit v4.7.7.201812240805-r Fix feature versions imported by feature org.eclipse.jgit.pgm Prepare 4.5.6-SNAPSHOT builds JGit v4.5.5.201812240535-r Call AdvertiseRefsHook before validating wants Change-Id: I5879df9b723a0dbf6a1eff89a34bbb269f3b773d Signed-off-by: Jonathan Nieder <jrn@google.com>
| | * Merge branch 'stable-5.0' into stable-5.1Matthias Sohn2018-12-251-1/+83
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.0: Call AdvertiseRefsHook for protocol v2 Prepare 4.11.7-SNAPSHOT builds JGit v4.11.6.201812241910-r Prepare 4.9.9-SNAPSHOT builds JGit v4.9.8.201812241815-r UploadPack: Test filtering by AdvertiseRefsHook in stateless transports Prepare 4.7.8-SNAPSHOT builds JGit v4.7.7.201812240805-r Fix feature versions imported by feature org.eclipse.jgit.pgm Prepare 4.5.6-SNAPSHOT builds JGit v4.5.5.201812240535-r Call AdvertiseRefsHook before validating wants Change-Id: Icdc212bf5be2485d0f8028acf6c62fb8531d0e3c Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * Merge branch 'stable-4.11' into stable-5.0Matthias Sohn2018-12-251-1/+83
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.11: Prepare 4.11.7-SNAPSHOT builds JGit v4.11.6.201812241910-r Prepare 4.9.9-SNAPSHOT builds JGit v4.9.8.201812241815-r UploadPack: Test filtering by AdvertiseRefsHook in stateless transports Prepare 4.7.8-SNAPSHOT builds JGit v4.7.7.201812240805-r Fix feature versions imported by feature org.eclipse.jgit.pgm Prepare 4.5.6-SNAPSHOT builds JGit v4.5.5.201812240535-r Call AdvertiseRefsHook before validating wants Change-Id: Ie81284ca6d580b0712c49eec610393d0c0c50203 Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | * Merge branch 'stable-4.10' into stable-4.11Matthias Sohn2018-12-251-1/+83
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.10: Prepare 4.9.9-SNAPSHOT builds JGit v4.9.8.201812241815-r UploadPack: Test filtering by AdvertiseRefsHook in stateless transports Prepare 4.7.8-SNAPSHOT builds JGit v4.7.7.201812240805-r Fix feature versions imported by feature org.eclipse.jgit.pgm Prepare 4.5.6-SNAPSHOT builds JGit v4.5.5.201812240535-r Call AdvertiseRefsHook before validating wants Change-Id: I937e9a4547fc10e4de7c887163022d1ab0322d64 Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | * Merge branch 'stable-4.9' into stable-4.10Matthias Sohn2018-12-251-1/+83
| | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.9: Prepare 4.9.9-SNAPSHOT builds JGit v4.9.8.201812241815-r UploadPack: Test filtering by AdvertiseRefsHook in stateless transports Prepare 4.7.8-SNAPSHOT builds JGit v4.7.7.201812240805-r Fix feature versions imported by feature org.eclipse.jgit.pgm Prepare 4.5.6-SNAPSHOT builds JGit v4.5.5.201812240535-r Call AdvertiseRefsHook before validating wants Change-Id: I2e499f34b1c481af794fa9325b0dfebaccdf3cb0 Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | * UploadPack: Test filtering by AdvertiseRefsHook in stateless transportsMasaya Suzuki2018-12-241-1/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AdvertiseRefsHook is used to limit the visibility of the refs in Gerrit. If this hook is not called, then all refs are treated as visible, causing the server to serve commits reachable from branches the client should not be able to access, if asked to via a request naming a guessed object id. Until 3a529361a76e8267467071e0b13ebb36b97d8fb2 (Call AdvertiseRefsHook before validating wants, 2018-12-18), UploadPack would invoke this hook at ref advertisement time but not during negotiation and when serving a pack file. Add a test to avoid regressing. Stateful bidirectional transports were not affected, so the test uses HTTP. [jn: split out when backporting the fix to stable-4.5. The test passes as long as v4.9.0.201710071750-r~169 (fetch: Accept any SHA-1 on lhs of refspec, 2017-06-04) is cherry picked along with it.] Change-Id: I8c017107336adc7cb4c826985779676bf043e648 Signed-off-by: Masaya Suzuki <masayasuzuki@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | Deprecate Repository#hasObjectJonathan Nieder2019-01-045-36/+36
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Its implementation contains } catch (IOException e) { // Legacy API, assume error means "no" return false; } Better to use ObjectDatabase#has, which throws IOException to report errors. Change-Id: I7de02f7ceb8f57b2a8ebdb16d2aa4376775ff933 Signed-off-by: Jonathan Nieder <jrn@google.com>
* | | | | | Revert C Git 1.7.5 bug workaroundMasaya Suzuki2018-11-191-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts the workaround introduced by 1c6c73c5a9b8dd700be45d658f165a464265dba7, which is a patch for dealing with a buggy C Git client v1.7.5 in 2012. We'll stop supporting very old C Git clients. Change-Id: I94999a39101c96f210b5eca3c2f620c15eb1ac1b Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
* | | | | | Explicitly specify charset when constructing PrintWriterDavid Pursehouse2018-09-301-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Ie1631784b5eba04edb21f66df284f9e279fd2ec0 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>