summaryrefslogtreecommitdiff
path: root/src/config_file.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | Propagate ELOCKED error when updating the confignulltoken2013-11-051-4/+4
| |
* | move mode_t to filebuf_open instead of _commitEdward Thomson2013-11-041-2/+2
|/
* remote: don't write too much when dealing with multivarsCarlos Martín Nieto2013-11-021-6/+12
| | | | | | | | | | We used to move `data_start` forward, which is wrong as that needs to point to the beginning of the buffer in order to perform size calculations. Introduce a `write_start` variable which indicates where we should start writing from, which is what the `data_start` was being wrongly reused to be.
* config_file: Style fixesVicent Marti2013-11-011-9/+6
|
* Fix memory leaks.Daniel Rodríguez Troitiño2013-11-011-0/+2
|
* Fix saving remotes with several fetch/push ref specs.Daniel Rodríguez Troitiño2013-11-011-1/+89
| | | | | | | | | | | | | | | | | | | | | | 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 subsection name should allow to have ']' and '\\' should allow to ↵Linquize2013-10-011-26/+15
| | | | escape any characters
* Merge pull request #1840 from linquize/warningVicent Martí2013-09-211-2/+2
|\ | | | | Fix warning
| * Fix warningLinquize2013-09-191-2/+2
| |
* | Merge git_buf and git_bufferRussell Belfer2013-09-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | This makes the git_buf struct that was used internally into an externally available structure and eliminates the git_buffer. As part of that, some of the special cases that arose with the externally used git_buffer were blended into the git_buf, such as being careful about git_buf objects that may have a NULL ptr and allowing for bufs with a valid ptr and size but zero asize as a way of referring to externally owned data.
* | config: handle realloc issues from larger depthsCarlos Martín Nieto2013-09-071-0/+9
| | | | | | | | | | | | | | As the include depth increases, the chance of a realloc increases. This means that whenever we run git_array_alloc() or call config_parse(), we need to remember what our reader's index is so we can look it up again.
* | config: return an error when reaching the maximum include depthCarlos Martín Nieto2013-09-071-3/+4
| |
* | config: fix variable overridingCarlos Martín Nieto2013-09-071-1/+6
| | | | | | | | | | When two or more variables of the same name exist and the user asks for a scalar, we must return the latest value assign to it.
* | config: refresh included filesCarlos Martín Nieto2013-09-071-5/+16
| | | | | | | | | | | | We need to refresh the variables from the included files if they are changed, so loop over all included files and re-parse the files if any of them has changed.
* | config: keep a list of included filesCarlos Martín Nieto2013-09-071-47/+58
| | | | | | | | | | When refreshing we need to refresh if any of the files have been touched, so we need to keep the list.
* | config: add support for include directivesCarlos Martín Nieto2013-09-071-5/+52
| | | | | | | | | | Relative, absolute and home-relative paths are supported. The recursion limit it set at 10, just like in git.
* | config: decouple the backend from the reader at the low levelCarlos Martín Nieto2013-09-051-84/+96
|/ | | | | | | In order to support config includes, we must differentiate between the backend's main file and the file we are currently parsing. This lays the groundwork for includes, keeping the current behaviours.
* Merge pull request #1772 from libgit2/config-iterVicent Martí2013-08-281-141/+53
|\ | | | | Configuration iterators redux
| * config: don't special-case the multivar iteratorCarlos Martín Nieto2013-08-141-197/+4
| | | | | | | | | | Build it on top of the normal iterator instead, which lets use re-use a lot of code.
| * config: get rid of a useless asignmentCarlos Martín Nieto2013-08-121-3/+1
| |
| * config: introduce _iterator_new()Carlos Martín Nieto2013-08-121-1/+1
| | | | | | | | As the name suggests, it iterates over all the entries
| * config: working multivar iteratorCarlos Martín Nieto2013-08-081-11/+9
| | | | | | | | Implement the foreach version as a wrapper around the iterator.
| * config: hopefully get the iterator to work on multivarsCarlos Martín Nieto2013-08-081-3/+6
| |
| * config: initial multivar iteratorCarlos Martín Nieto2013-08-081-0/+90
| |
| * config: move next() and free() into the iteratorCarlos Martín Nieto2013-08-081-29/+30
| | | | | | | | | | 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.
| * config: saner iterator errorsCarlos Martín Nieto2013-08-081-3/+0
| | | | | | | | | | Really report an error in foreach if we fail to allocate the iterator, and don't fail if the config is emtpy.
| * config: compilation fixesCarlos Martín Nieto2013-08-081-10/+9
| |
| * Don't typedef a pointerCarlos Martín Nieto2013-08-081-8/+10
| | | | | | | | 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-37/+53
| | | | | | | | | | | | | | | | | | 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`
| * added new type and several functions to git_strmapNico von Geyso2013-08-081-2/+3
| | | | | | | | | | | | | | | | | | | | | | This step is needed to easily add iterators to git_config_backend As well use these new git_strmap functions to implement foreach * git_strmap_iter * git_strmap_has_data(...) * git_strmap_begin(...) * git_strmap_end(...) * git_strmap_next(...)
* | Merge pull request #1771 from nvloff/write_empty_config_valueRussell Belfer2013-08-081-0/+3
|\ \ | |/ |/| config: allow setting empty string as value
| * config: allow empty string as valueNikolai Vladimirov2013-08-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `git_config_set_string(config, "config.section", "")` fails when escaping the value. The buffer in `escape_value` is allocated without NULL-termination. And in case of empty string 0 is passed for buffer size in `git_buf_grow`. `git_buf_detach` returns NULL when the allocated size is 0 and that leads to an error return in `GITERR_CHECK_ALLOC` called after `escape_value` The change in `config_file.c` was suggested by Russell Belfer <rb@github.com>
* | Parse config headers with quoted quotesEdward Thomson2013-08-071-0/+11
|/ | | | | Parse config headers that have the last quote on the line quoted instead of walking off the end.
* Add helpful buffer shorten functionRussell Belfer2013-07-011-1/+1
|
* Typedef git_config_level_t and use it everywhereRussell Belfer2013-05-241-4/+4
| | | | | | | | 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.
* Fix broken build when MSVC SDL checks is enabledLinquize2013-05-111-1/+1
|
* Merge pull request #1493 from carlosmn/remotesVicent Martí2013-04-221-1/+3
|\ | | | | Revamp the refspec handling
| * config: allow setting multivars when none exist yetCarlos Martín Nieto2013-04-201-1/+3
| | | | | | | | | | Adding a multivar when there are no variables with that name set should set the variable instead of failing.
* | Move git_config_backend to include/git2/sysRussell Belfer2013-04-211-0/+1
|/ | | | | | 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.
* Implement config key validation rulesRussell Belfer2013-01-291-19/+51
| | | | | | | | | This is a new implementation of core git's config key checking rules that prevents non-alphanumeric characters (and '-') for the top-level section and key names inside of config files. This also validates the target section name when renaming sections.
* config: support trailing backslashesCarlos Martín Nieto2013-01-251-1/+8
| | | | | | Check whether the backslash at the end of the line is being escaped or not so as not to consider it a continuation marker when it's e.g. a Windows-style path.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Deploy git_config_backend versionBen Straub2012-11-301-2/+2
|
* Consolidate text buffer functionsRussell Belfer2012-11-281-9/+7
| | | | | | | | | | | | | There are many scattered functions that look into the contents of buffers to do various text manipulations (such as escaping or unescaping data, calculating text stats, guessing if content is binary, etc). This groups all those functions together into a new file and converts the code to use that. This has two enhancements to existing functionality. The old text stats function is significantly rewritten and the BOM detection code was extended (although largely we can't deal with anything other than a UTF8 BOM).
* Clean up config.hBen Straub2012-11-271-12/+12
|
* Fix invalid read reported by valgrinddelanne2012-11-261-1/+1
|
* Remove use of English expletivesMartin Woodward2012-11-231-1/+1
| | | | | | Remove words such as fuck, crap, shit etc. Remove other potentially offensive words from comments. Tidy up other geopolicital terms in comments.
* config: distinguish between a lone variable name and one without rhsCarlos Martín Nieto2012-11-131-1/+3
| | | | | | '[section] variable' and '[section] variable =' behave differently when parsed as booleans, so we need to store that distinction internally.
* - Update 'tests-clar/resources/config/config11' in order to reproduce the ↵delanne2012-11-081-2/+2
| | | | | | invalidread with the unittest (just added some \n at the end of the file) - Fix config_file.c