summaryrefslogtreecommitdiff
path: root/include/git2/config.h
Commit message (Collapse)AuthorAgeFilesLines
* include: fix typos in commentsTobias Nießen2021-02-221-1/+1
|
* configuration: cvar -> configmapPatrick Steinhardt2019-07-181-12/+12
| | | | | `cvar` is an unhelpful name. Refactor its usage to `configmap` for more clarity.
* Introduce GIT_CALLBACK macro to enforce cdeclEdward Thomson2019-01-171-2/+2
| | | | | | | | | Since we now always build the library with cdecl calling conventions, our callbacks should be decorated as such so that users will not be able to provide callbacks defined with other calling conventions. The `GIT_CALLBACK` macro will inject the `__cdecl` attribute as appropriate.
* config: fix incorrect filename in documentation commentEtienne Samson2018-10-011-1/+1
| | | The underlying code uses GIT_CONFIG_FILENAME_GLOBAL, which is .gitconfig.
* doc: small fixups & additionsEtienne Samson2018-10-011-5/+15
|
* config_file: move include depth into config entryPatrick Steinhardt2018-03-261-0/+1
| | | | | | | | | | | | In order to reject writes to included configuration entries, we need to keep track of whether an entry was included via another configuration file or not. This information is being stored in the `cvar` structure, which is a rather weird location, as it is only used to create a list structure of config entries. Move the include depth into the structure `git_config_entry` instead. While this fixes the layering issue, it enables users of libgit2 to access the depth, too.
* Merge pull request #4396 from libgit2/cmn/config-regex-is-normalisedEdward Thomson2018-03-121-2/+26
|\ | | | | config: specify how we match the regular expressions
| * config: explicitly state that subsections are case-sensitivecmn/config-regex-is-normalisedCarlos Martín Nieto2018-03-111-6/+11
| |
| * config: specify how we match the regular expressionsCarlos Martín Nieto2017-11-181-0/+19
| | | | | | | | | | | | | | | | We do it the same as git does: case-sensitively on the normalized form of the variable name. While here also specify that we're case-sensitive on the values when handling the values when setting or deleting multivars.
* | config: pass repository when opening config filesPatrick Steinhardt2017-10-091-0/+3
|/ | | | | | | | | | | | | | | | | Our current configuration logic is completely oblivious of any repository, but only cares for actual file paths. Unfortunately, we are forced to break this assumption by the introduction of conditional includes, which are evaluated in the context of a repository. Right now, only one conditional exists with "gitdir:" -- it will only include the configuration if the current repository's git directory matches the value passed to "gitdir:". To support these conditionals, we have to break our API and make the repository available when opening a configuration file. This commit extends the `open` call of configuration backends to include another repository and adjusts existing code to have it available. This includes the user-visible functions `git_config_add_file_ondisk` and `git_config_add_backend`.
* config: add a ProgramData levelcmn/programdata-configCarlos Martín Nieto2015-10-211-5/+19
| | | | | This is where portable git stores the global configuration which we can use to adhere to it even though git isn't quite installed on the system.
* config: correct documentation for non-existent config fileCarlos Martín Nieto2015-09-031-2/+4
|
* config: perform unlocking via git_transactioncmn/config-txCarlos Martín Nieto2015-08-121-16/+7
| | | | | This makes the API for commiting or discarding changes the same as for references.
* config: expose locking via the main APICarlos Martín Nieto2015-08-121-0/+27
| | | | | | | | | This lock/unlock pair allows for the cller to lock a configuration file to avoid concurrent operations. It also allows for a transactional approach to updating a configuration file. If multiple updates must be made atomically, they can be done while the config is locked.
* config: borrow refcounted referencescmn/config-borrow-entryCarlos Martín Nieto2015-03-031-9/+31
| | | | | | | | | | | | | | | 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.
* Use correct Doxygen trailing comment syntaxBen Chatelain2015-02-101-3/+3
|
* Fix doc comment formattingBen Chatelain2015-02-101-4/+4
|
* config: add parsing and getter for pathscmn/config-get-pathCarlos Martín Nieto2015-01-141-0/+32
|
* doc: add documentation to all the public structs and enumscmn/doc-allCarlos Martín Nieto2014-12-061-3/+12
| | | | | | | | | | This makes them show up in the reference, even if the text itself isn't the most descriptive. These have been found with grep -Przon '\n\ntypedef struct.*?\{' -- include grep -Przon '\n\ntypedef enum.*?\{' -- include
* Spelling fixesWill Stamper2014-12-041-1/+1
|
* config: remove the refresh function and backend fieldcmn/config-refresh-removeCarlos Martín Nieto2014-10-231-14/+0
| | | | | | We have been refreshing on read and write for a while now, so git_config_refresh() is at best a no-op, and might just end up wasting cycles.
* config: document the how long the pointers are valid forCarlos Martín Nieto2014-04-181-1/+14
|
* config: implement config snapshottingCarlos Martín Nieto2014-04-181-0/+13
| | | | | | | | | | | In order to have consistent views of the config files for remotes, submodules et al. and a configuration that represents what is currently stored on-disk, we need a way to provide a view of the configuration that does not change. The goal here is to provide the snapshotting part by creating a read-only copy of the state of the configuration at a particular point in time, which does not change when a repository's main config changes.
* config: use git_buf for returning pathsCarlos Martín Nieto2014-01-271-13/+11
| | | | Again, we already did this internally, so simply remove the conversions.
* Update docs for new callback return value behaviorRussell Belfer2013-12-111-3/+3
|
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
* Fix saving remotes with several fetch/push ref specs.Daniel Rodríguez Troitiño2013-11-011-0/+11
| | | | | | | | | | | | | | | | | | | | | | At some moment git_config_delete_entry lost the ability to delete one entry of a multivar configuration. The moment you had more than one fetch or push ref spec for a remote you will not be able to save that remote anymore. The changes in network::remote::remotes::save show that problem. I needed to create a new git_config_delete_multivar because I was not able to remove one or several entries of a multivar config with the current API. Several tries modifying how git_config_set_multivar(..., NULL) behaved were not successful. git_config_delete_multivar is very similar to git_config_set_multivar, and delegates into config_delete_multivar of config_file. This function search for the cvar_t that will be deleted, storing them in a temporal array, and rebuilding the linked list. After calling config_write to delete the entries, the cvar_t stored in the temporal array are freed. There is a little fix in config_write, it avoids an infinite loop when using a regular expression (case for the multivars). This error was found by the test network::remote::remotes::tagopt.
* config: don't special-case the multivar iteratorCarlos Martín Nieto2013-08-141-1/+1
| | | | | Build it on top of the normal iterator instead, which lets use re-use a lot of code.
* config: introduce a regex-filtering iteratorCarlos Martín Nieto2013-08-121-0/+12
|
* config: introduce _iterator_new()Carlos Martín Nieto2013-08-121-0/+11
| | | | As the name suggests, it iterates over all the entries
* config: add _next() and _iterator_free()Carlos Martín Nieto2013-08-081-0/+17
| | | | Make it look like the refs iterator API.
* config: working multivar iteratorCarlos Martín Nieto2013-08-081-0/+10
| | | | Implement the foreach version as a wrapper around the iterator.
* config: move next() and free() into the iteratorCarlos Martín Nieto2013-08-081-1/+1
| | | | | Like we have in the references iterator, next and free belong in the iterator itself.
* config: get_multivar -> get_multivar_foreachCarlos Martín Nieto2013-08-081-2/+2
| | | | | The plain function will return an iterator, so move this one out of the way.
* Don't typedef a pointerCarlos Martín Nieto2013-08-081-1/+1
| | | | Make the iterator structure opaque and make sure it compiles.
* replaced foreach() with non callback based iterations in git_config_backendNico von Geyso2013-08-081-0/+20
| | | | | | | | | new functions in struct git_config_backend: * iterator_new(...) * iterator_free(...) * next(...) The old callback based foreach style can still be used with `git_config_backend_foreach_match`
* Fixed most documentation header bugsAndreas Linde2013-06-241-3/+3
| | | | | | | | | | | Fixed a few header @param and @return typos with the help of -Wdocumentation in Xcode. The following warnings have not been fixed: common.h:213 - Not sure how the documentation format is for '...' notes.h:102 - Correct @param name but empty text notes.h:111 - Correct @param name but empty text pack.h:140 - @return missing text pack.h:148 - @return missing text
* Add high(est) config level for application specific config filesSven Strickroth2013-06-111-0/+4
| | | | | | Some tools use an extra level to maintain an application specific config files on top of the normal ones. Revision 16adc9fade52b49e2bc13cb52407cc0025a93c8b broke this. Signed-off-by: Sven Strickroth <email@cs-ware.de>
* Typedef git_config_level_t and use it everywhereRussell Belfer2013-05-241-11/+26
| | | | | | | | The GIT_CONFIG_LEVEL constants actually work well as an enum because they are mutually exclusive, so this adds a typedef to the enum and uses that everywhere that one of these constants are expected, instead of the old code that typically used an unsigned int.
* Unify whitespaces to tabsLinquize2013-05-151-8/+8
|
* config: convenience function to open global/xdgCarlos Martín Nieto2013-05-071-0/+15
| | | | | The rules for which one to open is a bit silly, so let's make it easier for our users.
* Move git_config_backend to include/git2/sysRussell Belfer2013-04-211-50/+2
| | | | | | Moving backend implementor objects into include/git2/sys so the APIs can be isolated from the ones that normal libgit2 users would be likely to use.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Correct typos in documentationKevin Sawicki2013-01-061-3/+3
|
* Allow compilation as C++Ben Straub2012-12-061-1/+1
|
* Add version fields and init macros for public input structs.Ben Straub2012-11-301-0/+3
|
* Clean up config.hBen Straub2012-11-271-39/+55
|
* config: Opening a nonexistent file returns ENOTFOUNDnulltoken2012-11-171-5/+6
|
* config: Make git_config_file__ondisk() internalnulltoken2012-11-171-13/+0
|
* config: rename get_config_entry -> config_entryCarlos Martín Nieto2012-11-131-1/+1
| | | | | We're already in the git_config namespace, there is no need to repeat it.