summaryrefslogtreecommitdiff
path: root/tests/network
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Merge pull request #3149 from libgit2/cmn/upstream-matching-pushEdward Thomson2015-05-281-0/+10
|\ | | | | Fill the pointers for matching refspecs
| * refspec: make sure matching refspecs have src, dst and input stringsCarlos Martín Nieto2015-05-221-0/+10
| | | | | | | | | | | | | | | | When we find out that we're dealing with a matching refspec, we set the flag and return immediately. This leaves the strings as NULL, which breaks the contract. Assign these pointers to a string with the correct values.
* | remote: validate refspecs before adding to configCarlos Martín Nieto2015-05-281-0/+2
| | | | | | | | | | | | | | When we moved from acting on the instance to acting on the configuration, we dropped the validation of the passed refspec, which can lead to writing an invalid refspec to the configuration. Bring that validation back.
* | remote: remove fetch parameter from create_anonymousCarlos Martín Nieto2015-05-282-16/+6
|/ | | | | | An anonymous remote is not configured and cannot therefore have configured refspecs. Remove the parameter which adds this from the constructor.
* push: add tests for the push negotiation callbackCarlos Martín Nieto2015-05-141-0/+114
| | | | | The functionality was meged without including tests, so let's add them now.
* tests: don't push to our resourcescmn/local-push-messageCarlos Martín Nieto2015-05-131-2/+2
| | | | | | | | | A couple of tests use the wrong remote to push to. We did not notice up to now because the local push would copy individual objects, and those already existed, so it became a no-op. Once we made local push create the packfile, it became noticeable that there was a new packfile where it didn't belong.
* remote: remove git_remote_save()Carlos Martín Nieto2015-05-131-12/+0
| | | | | It has now become a no-op, so remove the function and all references to it.
* remote: remove live changing of refspecsCarlos Martín Nieto2015-05-133-69/+18
| | | | | | | | | | | | The base refspecs changing can be a cause of confusion as to what is the current base refspec set and complicate saving the remote's configuration. Change `git_remote_add_{fetch,push}()` to update the configuration instead of an instance. This finally makes `git_remote_save()` a no-op, it will be removed in a later commit.
* remote: move the tagopt setting to the fetch optionsCarlos Martín Nieto2015-05-132-20/+15
| | | | | This is another option which we should not be keeping in the remote, but is specific to each particular operation.
* remote: move the update_fetchhead setting to the optionsCarlos Martín Nieto2015-05-131-3/+3
| | | | | | While this will rarely be different from the default, having it in the remote adds yet another setting it has to keep around and can affect its behaviour. Move it to the options.
* remote: move the transport ctor to the callbacksCarlos Martín Nieto2015-05-131-3/+3
| | | | | | | Instead of having it set in a different place from every other callback, put it the main structure. This removes some state from the remote and makes it behave more like clone, where the constructors are passed via the options.
* remote: remove url and pushurl from the save logicCarlos Martín Nieto2015-05-132-10/+19
| | | | | | As a first step in removing the repository-saving logic, don't allow chaning the url or push url from a remote object, but change the configuration on the configuration immediately.
* Remove the callbacks struct from the remoteCarlos Martín Nieto2015-05-134-108/+72
| | | | | | | | | | | | | | Having the setting be different from calling its actions was not a great idea and made for the sake of the wrong convenience. Instead of that, accept either fetch options, push options or the callbacks when dealing with the remote. The fetch options are currently only the callbacks, but more options will be moved from setters and getters on the remote to the options. This does mean passing the same struct along the different functions but the typical use-case will only call git_remote_fetch() or git_remote_push() and so won't notice much difference.
* Fix for Issue #3023 tests fail with no networkcthomas2015-04-211-51/+0
| | | | | | | Moved offending tests from network to online so they will get skipped when there is a lack of network connectivity: -test_online_remotes__single_branch -test_online_remotes__restricted_refspecs
* config: borrow refcounted referencescmn/config-borrow-entryCarlos Martín Nieto2015-03-031-12/+4
| | | | | | | | | | | | | | | This changes the get_entry() method to return a refcounted version of the config entry, which you have to free when you're done. This allows us to avoid freeing the memory in which the entry is stored on a refresh, which may happen at any time for a live config. For this reason, get_string() has been forbidden on live configs and a new function get_string_buf() has been added, which stores the string in a git_buf which the user then owns. The functions which parse the string value takea advantage of the borrowing to parse safely and then release the entry.
* repository: remove log message override for switching the active branchCarlos Martín Nieto2015-03-031-3/+3
| | | | | | We want to use the "checkout: moving from ..." message in order to let git know when a change of branch has happened. Make the convenience functions for this goal write this message.
* push: remove reflog message overrideCarlos Martín Nieto2015-03-031-2/+2
| | | | We always use "update by push".
* Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-035-53/+42
| | | | | | | | | | The signature for the reflog is not something which changes dynamically. Almost all uses will be NULL, since we want for the repository's default identity to be used, making it noise. In order to allow for changing the identity, we instead provide git_repository_set_ident() and git_repository_ident() which allow a user to override the choice of signature.
* Fix more indentation.David Calavera2015-01-071-1/+1
|
* Fix intentation.David Calavera2015-01-051-1/+1
|
* Load prune configuration when a remote is created.David Calavera2015-01-051-0/+44
|
* Merge pull request #2761 from libgit2/cmn/fetch-pruneEdward Thomson2014-12-301-0/+285
|\ | | | | Remote-tracking branch prunning
| * fetch: plug leaks in the prune testsCarlos Martín Nieto2014-12-141-18/+34
| |