summaryrefslogtreecommitdiff
path: root/include/git2/config.h
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Add git_config_refresh() API to reload configRussell Belfer2012-10-301-0/+14
| | | | | | | | | | | | | | | | | | | | This adds a new API that allows users to reload the config if the file has changed on disk. A new config callback function to refresh the config was added. The modified time and file size are used to test if the file needs to be reloaded (and are now stored in the disk backend object). In writing tests, just using mtime was a problem / race, so I wanted to check file size as well. To support that, I extended `git_futils_readbuffer_updated` to optionally check file size in addition to mtime, and I added a new function `git_filebuf_stats` to fetch the mtime and size for an open filebuf (so that the config could be easily refreshed after a write). Lastly, I moved some similar file checking code for attributes into filebuf. It is still only being used for attrs, but it seems potentially reusable, so I thought I'd move it over.
* Add config level support in the config APIyorah2012-10-231-24/+162
| | | | | | | Added `struct git_config_entry`: a git_config_entry contains the key, the value, and the config file level from which a config element was found. Added `git_config_open_level`: build a single-level focused config object from a multi-level one. We are now storing `git_config_entry`s in the khash of the config_file
* Rename xdr to xdgSven Strickroth2012-10-021-7/+7
| | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* Correctly read xdr compatible %HOME%/.config/git/config config fileSven Strickroth2012-09-241-0/+20
| | | | | | | This file is not just read if the global config file (%HOME%/.gitconfig) is not found, however, it is used everytime but with lower priority. Signed-off-by: Sven Strickroth <email@cs-ware.de>
* Some cleanup suggested during reviewRussell Belfer2012-08-221-13/+2
| | | | | | | | | | This cleans up a number of items suggested during code review with @vmg, including: * renaming "outside repo" config API to `git_config_open_default` * killing the `git_config_open_global` API * removing the `git_` prefix from the static functions in fileops * removing some unnecessary functionality from the "cp" command
* Add template dir and set gid to repo initRussell Belfer2012-08-221-0/+12
| | | | | | | | | | | | | | | | | This extends git_repository_init_ext further with support for initializing the repository from an external template directory and with support for the "create shared" type flags that make a set GID repository directory. This also adds tests for much of the new functionality to the existing `repo/init.c` test suite. Also, this adds a bunch of new utility functions including a very general purpose `git_futils_mkdir` (with the ability to make paths and to chmod the paths post-creation) and a file tree copying function `git_futils_cp_r`. Also, this includes some new path functions that were useful to keep the code simple.
* Fix incorrect array size in example for git_config_get_mappedJosh Triplett2012-08-121-1/+1
| | | | | | In the documentation for git_config_get_mapped, the sample mapping array uses [3] but has 4 entries. Fix by dropping the size entirely and letting the compiler figure it out.
* Update iterators for consistency across libraryRussell Belfer2012-08-031-2/+2
| | | | | | | | | | | | | | | | | This updates all the `foreach()` type functions across the library that take callbacks from the user to have a consistent behavior. The rules are: * A callback terminates the loop by returning any non-zero value * Once the callback returns non-zero, it will not be called again (i.e. the loop stops all iteration regardless of state) * If the callback returns non-zero, the parent fn returns GIT_EUSER * Although the parent returns GIT_EUSER, no error will be set in the library and `giterr_last()` will return NULL if called. This commit makes those changes across the library and adds tests for most of the iteration APIs to make sure that they follow the above rules.
* Adding git_config_foreach_match() iteration fnRussell Belfer2012-07-101-1/+19
| | | | | | | | | | | | | | Adding a new config iteration function that let's you iterate over just the config entries that match a particular regular expression. The old foreach becomes a simple use of this with an empty pattern. This also fixes an apparent bug in the existing `git_config_foreach` where returning a non-zero value from the iteration callback was not correctly aborting the iteration and the returned value was not being propogated back to the caller of foreach. Added to tests to cover all these changes.
* errors: Rename the generic return codesVicent Martí2012-05-181-17/+17
|
* global: Change parameter ordering in APIVicent Martí2012-05-181-12/+12
| | | | Consistency is good.
* config: Refactor & add `git_config_get_mapped`Vicent Martí2012-03-011-0/+50
| | | | Sane API for real-world usage.
* Document {get,set}_multivarCarlos Martín Nieto2012-02-171-2/+15
|
* Implement setting multivarsCarlos Martín Nieto2012-02-171-0/+7
|
* Support getting multivarsCarlos Martín Nieto2012-02-171-0/+7
|
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* config: Rename the `delete` callback nameVicent Martí2011-12-311-1/+1
| | | | `delete` is a reserved keyword in C++.
* config: really delete variablesCarlos Martín Nieto2011-12-161-0/+1
| | | | | | Instead of just setting the value to NULL, which gives unwanted results when asking for that variable after deleting it, delete the variable from the list and re-write the file.
* msvc: Remove superfluous includesVicent Marti2011-10-051-1/+0
|
* Include stdint.h in git2/config.hCarlos Martín Nieto2011-10-011-0/+1
| | | | | | | Otherwise MSVC doesn't know what we're talking about when we say int32_t or int64_t. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* config: Proper type declarations for 64 bit intsVicent Marti2011-09-301-4/+4
|
* Add git_config_find_systemCarlos Martín Nieto2011-09-271-0/+12
| | | | | | | This allows the library to guess where the system configuration file should be located. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* config: make git_config_[get|set]_long() able to properly deal with 8 bytes ↵nulltoken2011-09-221-2/+2
| | | | | | | | wide values Should fix issue #419. Signed-off-by: nulltoken <emeric.fermas@gmail.com>
* Cleanup legal dataVicent Marti2011-09-191-22/+4
| | | | | | | | | | 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
* Standardized doxygen @return lines for int functions to say "GIT_SUCCESS or ↵David Boyce2011-09-131-13/+13
| | | | an error code".
* config: Rename `del` to `deleteVicent Marti2011-07-121-1/+1
|