summaryrefslogtreecommitdiff
path: root/tests/submodule/modify.c
Commit message (Collapse)AuthorAgeFilesLines
* str: introduce `git_str` for internal, `git_buf` is externalEdward Thomson2021-09-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* tests: submodule: verify setup of relative URLsPatrick Steinhardt2020-01-061-0/+21
| | | | | | | When setting up relative URLs for a submodule, then we resolve it to the actual location and write that into ".git/config" instead of writing the relative value. We do not yet have a test to nail down this behaviour, which is now being added by this commit.
* submodule: test unsetting config optionsCarlos Martín Nieto2015-06-221-13/+29
| | | | | | In addition to mapping enums to strings in the configuration, we need to know to delete the configuration option when given the "none" or "no" option.
* submodule: test more accurately for non-existenceCarlos Martín Nieto2015-06-221-4/+4
| | | | | | The current code will always fail, but only because it's asking for a string on a live config. Take a snapshot and make sure we fail with ENOTFOUND instead of any old error.
* submodule: get rid of `_save()`Carlos Martín Nieto2015-06-221-9/+0
| | | | | We no longer have any setters which affect an instance, so `git_submodule_save()` is no longer relevant.
* submodule: make `_set_url()` affect the configurationCarlos Martín Nieto2015-06-221-39/+6
| | | | With this one, we can get rid of the edit_and_save test.
* submodule: make `_set_branch()` affect the configurationCarlos Martín Nieto2015-06-221-14/+20
|
* submodule: make `_set_update_fetch_recurse_submodules()` affect the configCarlos Martín Nieto2015-06-221-28/+16
| | | | | | Similarly to the other ones. In this test we copy over testing `RECURSE_YES` which shows an error in our handling of the `YES` variant which we may have to port to the rest.
* submodule: make `_set_update()` affect the configurationCarlos Martín Nieto2015-06-221-21/+11
| | | | | Moving on with the removal of runtime-changing variables, the update setting for a remote is whatever it was when it was looked up.
* submodule: make set_ignore() affect the configurationCarlos Martín Nieto2015-06-221-16/+11
| | | | | Instead of affecting a particular instance, make it change the configuration.
* submodule: remove the per-repo cacheCarlos Martín Nieto2015-06-221-2/+0
| | | | | | | | | | | | | Having this cache and giving them out goes against our multithreading guarantees and it makes it impossible to use submodules in a multi-threaded environment, as any thread can ask for a refresh which may reallocate some string in the submodule struct which we've accessed in a different one via a getter. This makes the submodules behave more like remotes, where each object is created upon request and not shared except explicitly by the user. This means that some tests won't pass yet, as they assume they can affect the submodule objects in the cache and that will affect later operations.
* Fix a few leaksCarlos Martín Nieto2015-05-131-0/+1
| | | | | The interesting one is the notification macro, which was returning directly on a soft-abort instead of going through the cleanup.
* Implement git_submodule_set_branch.Patrick Steinhardt2015-04-121-3/+25
|
* Fix git_submodule_sync writing URL to wrong key.Patrick Steinhardt2015-03-121-3/+3
| | | | | | | | Currently git_submodule_sync writes the submodule's URL to the key 'branch.<REMOTE_NAME>.remote' while the reference implementation of `git submodule sync` writes to 'remote.<REMOTE_NAME>.url', which is the intended behavior according to git-submodule(1).
* config: borrow refcounted referencescmn/config-borrow-entryCarlos Martín Nieto2015-03-031-12/+5
| | | | | | | | | | | | | | | 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.
* Introduce a convenience function for submodule updatejamill/submodule_updateJameson Miller2014-12-221-5/+5
| | | | | | | | | This introduces the functionality of submodule update in 'git_submodule_do_update'. The existing 'git_submodule_update' function is renamed to 'git_submodule_update_strategy'. The 'git_submodule_update' function now refers to functionality similar to `git submodule update`, while `git_submodule_update_strategy` is used to get the configured value of submodule.<name>.update.
* Test (and fix) the git_submodule_sync changesRussell Belfer2014-04-031-8/+26
| | | | | I wrote this stuff a while ago and forgot to write tests. Wanted to do so now to wrap up the PR and immediately found problems.
* git_submodule_resolve_url supports relative urlsJan Melcher2014-04-031-73/+0
| | | | | | | | | | | The base for the relative urls is determined as follows, with descending priority: - remote url of HEAD's remote tracking branch - remote "origin" - workdir This follows git.git behaviour
* Test git_submodule_add_setup with relative urlJan Melcher2014-04-031-0/+24
|
* Make submodules externally refcountedRussell Belfer2014-03-251-7/+15
| | | | | | | | `git_submodule` objects were already refcounted internally in case the submodule name was different from the path at which it was stored. This makes that refcounting externally used as well, so `git_submodule_lookup` and `git_submodule_add_setup` return an object that requires a `git_submodule_free` when done.
* Make submodule fetchRecurse match other optionsRussell Belfer2014-01-301-14/+20
| | | | | | This removes the fetchRecurse compiler warnings and makes the behavior match the other submodule options (i.e. the in-memory setting can be reset to the on-disk value).
* Update test related to fetchRecurseSubmodulesLinquize2013-12-311-8/+17
|
* Rename tests-clar to testsBen Straub2013-11-141-0/+253