summaryrefslogtreecommitdiff
path: root/tests/network
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'main' into better-compatiblity-for-at-time-notationYoichi Nakayama2021-11-232-4/+4
|\ | | | | | | | | Conflicts: src/revparse.c
| * tests: declare functions statically where appropriateEdward Thomson2021-11-112-4/+4
| |
* | Add a branch with a empty reflog into testrepo.gitYoichi Nakayama2021-10-222-15/+15
|/
* str: introduce `git_str` for internal, `git_buf` is externalethomson/gitstrEdward Thomson2021-10-174-31/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | libgit2 has two distinct requirements that were previously solved by `git_buf`. We require: 1. A general purpose string class that provides a number of utility APIs for manipulating data (eg, concatenating, truncating, etc). 2. A structure that we can use to return strings to callers that they can take ownership of. By using a single class (`git_buf`) for both of these purposes, we have confused the API to the point that refactorings are difficult and reasoning about correctness is also difficult. Move the utility class `git_buf` to be called `git_str`: this represents its general purpose, as an internal string buffer class. The name also is an homage to Junio Hamano ("gitstr"). The public API remains `git_buf`, and has a much smaller footprint. It is generally only used as an "out" param with strict requirements that follow the documentation. (Exceptions exist for some legacy APIs to avoid breaking callers unnecessarily.) Utility functions exist to convert a user-specified `git_buf` to a `git_str` so that we can call internal functions, then converting it back again.
* url: introduce `git_net_url_matches_pattern_list`Edward Thomson2021-09-011-0/+49
| | | | | | Provide a utility method on a url to determine if it matches any pattern in a comma-separated list, similar to what one would find in `NO_PROXY` environment variables.
* url: introduce `git_net_url_matches_pattern`Edward Thomson2021-09-011-0/+54
| | | | | Provide a method to determine if a given URL matches a host:port pattern like the ones found in `NO_PROXY` environment variables.
* tests: create the network::url test hierarcyEdward Thomson2021-09-013-59/+59
|
* remote: deprecate resolve_url callbackethomson/custom_urlEdward Thomson2021-08-291-0/+8
| | | | | | | Using a callback to set a resolve_url is not particularly idiomatic. Deprecate it in favor of the `set_instance_url` and `set_instance_pushurl` functions which can now be called from the `git_remote_ready_cb` callback.
* remote: introduce git_remote_ready_cbEdward Thomson2021-08-291-0/+42
| | | | Introduce a new callback that fires when the remote is ready to connect.
* remote: introduce set_instance_urlEdward Thomson2021-08-271-0/+45
| | | | | | Users may want to override the URL on a particular instance of a remote, instead of updating the configuration. Previously, users could use a callback to do this, but this is not particularly idiomatic.
* urlparse: use consistent ipv6 address rulesEdward Thomson2020-12-231-230/+109
| | | | | | IPv6 addresses should be used identically internally; we should not denote them with brackets in one operating system and without them in another.
* urlparse: Add IPv4 and IPv6 based testsPaul Wolfgang (DC-AE/ESF1)2020-12-231-0/+510
|
* remote: use git_remote_name_is_validEdward Thomson2020-10-251-8/+15
|
* refspec: return GIT_EINVALIDSPEC for invalid specsEdward Thomson2020-10-251-1/+1
| | | | | | | Disambiguate invalid specifications in `git_refspec__parse` so that callers can determine the difference between invalid specifications and actual errors. No call sites wil propagagte this new error message to an end-user, so there is no user-facing API change.
* strarray: we should `dispose` instead of `free`Edward Thomson2020-06-013-32/+32
| | | | | | We _dispose_ the contents of objects; we _free_ objects (and their contents). Update `git_strarray_free` to be `git_strarray_dispose`. `git_strarray_free` remains as a deprecated proxy function.
* tests: add missing error checksPatrick Steinhardt2020-02-071-1/+1
| | | | | | We should always verify error codes returned by function calls in our test suite to not accidentally miss any weird results. Coverity reported missing checks in several locations, which this commit fixes.
* credential: change git_cred to git_credentialethomson/credtypeEdward Thomson2020-01-261-20/+20
| | | | | | | | | | | | | | | | We avoid abbreviations where possible; rename git_cred to git_credential. In addition, we have standardized on a trailing `_t` for enum types, instead of using "type" in the name. So `git_credtype_t` has become `git_credential_t` and its members have become `GIT_CREDENTIAL` instead of `GIT_CREDTYPE`. Finally, the source and header files have been renamed to `credential` instead of `cred`. Keep previous name and values as deprecated, and include the new header files from the previous ones.
* net: introduce git_net_url_joinpathEdward Thomson2020-01-241-0/+194
| | | | | | Provide a mechanism to add a path and query string to an existing url so that we can easily append `/info/refs?...` type url segments to a url given to us by a user.
* net: refactor gitno redirect handlingEdward Thomson2020-01-241-10/+10
| | | | Move the redirect handling into `git_net_url` for consistency.
* netops: handle intact query parameters in service_suffix removalJosh Bleecher Snyder2020-01-091-0/+16
| | | | | | | | | | | | | Some servers leave the query parameters intact in the Location header when responding with a redirect. The service_suffix removal check as written assumed that the server removed them. Handle both cases. Along with PR #5325, this fixes #5321. There are two new tests. The first already passed; the second previously failed.
* cred: separate public interface from low-level detailsEtienne Samson2019-09-131-11/+7
|
* smart: use push_glob instead of manual filteringEtienne Samson2019-08-212-5/+5
| | | | | | | | | | The code worked under the assumption that anything under `refs/tags` are tag objects, and all the rest would be peelable to a commit. As it is completely valid to have tags to blobs under a non `refs/tags` ref, this would cause failures when trying to peel a tag to a commit. Fix the broken filtering by switching to `git_revwalk_push_glob`, which already handles this case.
* net: handle urls with a colon after host but no portEdward Thomson2019-06-111-0/+24
| | | | | | | | | | | | | | Core git copes with URLs that have a colon after the port, but no actual numeric value. eg `http://example.com:/foo.git` or `http://example.com:`. That's horrible, but RFC 3986 says: > URI producers and normalizers should omit the port component and its > ":" delimiter if port is empty or if its value would be the same as > that of the scheme's default. Which indicates that they may and therefore we must accept it. Test that we can handle URLs with a colon but no following port number.
* net: rename gitno_connection_data to git_net_urlEdward Thomson2019-06-102-169/+206
| | | | | | | | | | "Connection data" is an imprecise and largely incorrect name; these structures are actually parsed URLs. Provide a parser that takes a URL string and produces a URL structure (if it is valid). Separate the HTTP redirect handling logic from URL parsing, keeping a `gitno_connection_data_handle_redirect` whose only job is redirect handling logic and does not parse URLs itself.
* Merge pull request #5060 from pks-t/pks/refspec-nested-globsEdward Thomson2019-05-221-5/+19
|\ | | | | Loosen restriction on wildcard "*" refspecs
| * refspec: fix transforming nested starsPatrick Steinhardt2019-04-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we transform a refspec with a component containing a glob, then we simply copy over the component until the next separator from the matching ref. E.g. if we have a ref "refs/heads/foo/bar" and a refspec "refs/heads/*/bar:refs/remotes/origin/*/bar", we: 1. Copy over everything until hitting the glob from the <dst> part: "refs/remotes/origin/". 2. Strip the common prefix of ref and <src> part until the glob, which is "refs/heads/". This leaves us with a ref of "foo/bar". 3. Copy from the ref until the next "/" separator, resulting in "refs/remotes/origin/foo". 4. Copy over the remaining part of the <dst> spec, which is "bar": "refs/remotes/origin/foo/bar". This worked just fine in a world where globs in refspecs were restricted such that a globbing component may only contain a single "*", only. But this restriction has been lifted, so that a glob component may be nested between other characters, causing the above algorithm to fail. Most notably the third step, where we copy until hitting the next "/" separator, might result in a wrong transformation. Given e.g. a ref "refs/gbranchg/head" and a refspec "refs/g*g/head:refs/remotes/origin/*", we'd also be copying the "g" between "branch" and "/" and end up with the wrong transformed ref "refs/remotes/origin/branchg". Instead of copying until the next component separator, we should copy until we hit the pattern after the "*". So in the above example, we'd copy until hitting the string "g/head".
| * refs: loosen restriction on wildcard "*" refspecsPatrick Steinhardt2019-04-261-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | In commit cd377f45c9 (refs: loosen restriction on wildcard "*" refspecs, 2015-07-22) in git.git, the restrictions on wildcard "*" refspecs has been loosened. While wildcards were previously only allowed if the component is a single "*", this was changed to also accept other patterns as part of the component. We never adapted to that change and still reject any wildcard patterns that aren't a single "*" only. Update our tests to reflect the upstream change and adjust our own code accordingly.
| * tests: network::refspecs: add missing assert when parsing refspecPatrick Steinhardt2019-04-261-1/+1
| |
* | remote: add callback to resolve URLs before connectingErik Aigner2019-05-211-8/+77
|/ | | | | | Since libssh2 doesn't read host configuration from the config file, this callback can be used to hand over URL resolving to the client without touching the SSH implementation itself.
* indexer: use git_indexer_progress throughoutEdward Thomson2019-02-221-1/+1
| | | | | Update internal usage of `git_transfer_progress` to `git_indexer_progreses`.
* git_error: use new names in internal APIs and usageEdward Thomson2019-01-221-4/+4
| | | | | Move to the `git_error` name in the internal API for error-related functions.
* references: use new names in internal usageethomson/git_refEdward Thomson2019-01-171-1/+1
| | | | Update internal usage to use the `git_reference` names for constants.
* tests: consolidate all remote creation tests in one test suiteEtienne Samson2018-11-021-59/+0
|
* tests: rename remote creation test suiteEtienne Samson2018-11-021-37/+0
|
* treewide: remove use of C++ style commentsPatrick Steinhardt2018-07-131-3/+3
| | | | | | | | | C++ style comment ("//") are not specified by the ISO C90 standard and thus do not conform to it. While libgit2 aims to conform to C90, we did not enforce it until now, which is why quite a lot of these non-conforming comments have snuck into our codebase. Do a tree-wide conversion of all C++ style comments to the supported C style comments to allow us enforcing strict C90 compliance in a later commit.
* Merge pull request #4699 from nelhage/fetch-null-dstPatrick Steinhardt2018-07-061-0/+5
|\ | | | | git_refspec_transform: Handle NULL dst
| * formatting fixNelson Elhage2018-06-291-1/+2
| |
| * Add a test.Nelson Elhage2018-06-251-0/+4
| | | | | | | | Verified that this breaks before the fix and passes afterwards.
* | refspec: rename `git_refspec__free` to `git_refspec__dispose`Patrick Steinhardt2018-06-291-5/+5
| | | | | | | | | | | | | | | | | | Since commit 630a67366 (refspec: add public parsing api, 2018-02-07), we now have two functions `git_refspec_free` and `git_refspec__free`. The difference is that the first one will free the structure itself, while the second one will only free the structure's contents. Use our new `dispose` naming pattern for the latter function to help avoid confusion.
* | refspec: add public parsing apicynecx2018-06-221-0/+12
|/ | | | | | | | | | | | | | | | | | | | Fix typo Fix some type issues More fixes Address requested changes Add test Fix naming Fix condition and tests Address requested changes Fix typo
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-104-7/+7
|
* tests: network::fetchlocal: let cleanup function handle sandbox cleanupPatrick Steinhardt2018-01-121-8/+0
| | | | | | | | Two tests in network::fetchlocal explicitly set a cleanup function to free and remove the created sandbox repositories. This is not necessary, though, as the cleanup function executed after each test already takes care of cleaning up after them. Remove the code to avoid needless code duplication.
* tests: network: add missing include for `git_repository_new`Patrick Steinhardt2017-06-131-0/+1
| | | | | | | A newly added test uses the `git_repository_new` function without the corresponding header file being included. While this works due to the compiler deducing the correct function signature, we should obviously just include the function's declaration file.
* remote: ensure we can create an anon remote on inmemory repoethomson/config_for_inmemory_repoEdward Thomson2017-06-121-0/+16
| | | | | Given a wholly in-memory repository, ensure that we can create an anonymous remote and perform actions on it.
* Remove unused static functionsPatrick Steinhardt2016-06-211-10/+0
|
* netops: make the path optional in URLsCarlos Martín Nieto2016-04-191-0/+9
| | | | | | When we're dealing with proxy addresses, we only want a hostname and port, and the user would not provide a path, so make it optional so we can use this same function to parse git as well as proxy URLs.
* proxy: ask the user for credentials if necessaryCarlos Martín Nieto2016-04-193-10/+10
|
* Tell the git_transport about the custom_headersMatt Burke2015-09-083-10/+10
|
* remote: add failing test for a mirror refspecCarlos Martín Nieto2015-08-111-5/+34
| | | | | | While we download the remote's remote-tracking branches, we don't download the tag. This points to the tag auto-follow rules interfering with the refspec.
* Fix memory leak in tests/network/refspecs.cJeff Hostetler2015-06-171-0/+2
|