summaryrefslogtreecommitdiff
path: root/tests-clar/config
Commit message (Collapse)AuthorAgeFilesLines
* Rename tests-clar to testsBen Straub2013-11-1414-1780/+0
|
* Merge pull request #1950 from csware/quote-config-valuesVicent Martí2013-11-101-0/+31
|\ | | | | Correctly quote config values while saving
| * Add another testcase to make sure double quotes are correctly escapedSven Strickroth2013-11-071-0/+4
| | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
| * Add a testcase for values which needs quotesSven Strickroth2013-11-071-0/+27
| | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | Propagate ELOCKED error when updating the confignulltoken2013-11-051-0/+13
| |
* | move mode_t to filebuf_open instead of _commitEdward Thomson2013-11-041-2/+2
|/
* Fix saving remotes with several fetch/push ref specs.Daniel Rodríguez Troitiño2013-11-011-0/+65
| | | | | | | | | | | | | | | | | | | | | | 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.
* Add negative test cases for config header with invalid charactersLinquize2013-10-011-0/+22
|
* Add test case to test ']' and '\\' characters in config subsectionLinquize2013-10-011-0/+7
|
* Make tests pass if XDG config existsRussell Belfer2013-09-241-9/+14
|
* config: handle realloc issues from larger depthsCarlos Martín Nieto2013-09-071-0/+14
| | | | | | | 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: fix variable overridingCarlos Martín Nieto2013-09-072-0/+37
| | | | | 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-0/+23
| | | | | | 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: add support for include directivesCarlos Martín Nieto2013-09-071-0/+50
| | | | | Relative, absolute and home-relative paths are supported. The recursion limit it set at 10, just like in git.
* Merge pull request #1772 from libgit2/config-iterVicent Martí2013-08-283-30/+111
|\ | | | | Configuration iterators redux
| * 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/+33
| |
| * config: introduce _iterator_new()Carlos Martín Nieto2013-08-121-0/+30
| | | | | | | | As the name suggests, it iterates over all the entries
| * config: add _next() and _iterator_free()Carlos Martín Nieto2013-08-081-0/+18
| | | | | | | | Make it look like the refs iterator API.
| * config: working multivar iteratorCarlos Martín Nieto2013-08-081-7/+7
| | | | | | | | Implement the foreach version as a wrapper around the iterator.
| * config: get_multivar -> get_multivar_foreachCarlos Martín Nieto2013-08-082-23/+23
| | | | | | | | | | The plain function will return an iterator, so move this one out of the way.
* | Merge pull request #1771 from nvloff/write_empty_config_valueRussell Belfer2013-08-081-0/+17
|\ \ | |/ |/| config: allow setting empty string as value
| * config: allow empty string as valueNikolai Vladimirov2013-08-081-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `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-5/+16
|/ | | | | Parse config headers that have the last quote on the line quoted instead of walking off the end.
* Add more tests for git_config_get_multivarRussell Belfer2013-07-091-8/+48
| | | | | | The old tests didn't try failing lookups or lookups across multiple config files with some having the pattern and some not having it.
* config: convenience function to open global/xdgCarlos Martín Nieto2013-05-071-0/+67
| | | | | The rules for which one to open is a bit silly, so let's make it easier for our users.
* repo: unconditionally create a global config backendCarlos Martín Nieto2013-05-071-7/+0
| | | | | | | | | | | | | When a repository is initialised, we need to probe to see if there is a global config to load. If this is not the case, the user isn't able to write to the global config without creating the backend and adding it themselves, which is inconvenient and overly complex. Unconditionally create and add a backend for the global config file regardless of whether it exists as a convenience for users. To enable this, we allow creating backends to files that do not exist yet, changing the semantics somewhat, and making some tests invalid.
* Merge pull request #1493 from carlosmn/remotesVicent Martí2013-04-221-0/+16
|\ | | | | Revamp the refspec handling
| * config: allow setting multivars when none exist yetCarlos Martín Nieto2013-04-201-0/+16
| | | | | | | | | | 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.
* config: don't allow passing NULL as a value to setCarlos Martín Nieto2013-03-091-0/+14
| | | | | | Passing NULL is non-sensical. The error message leaves to be desired, though, as it leaks internal implementation details. Catch it at the `git_config_set_string` level and set an appropriate error message.
* Test config name validationRussell Belfer2013-01-291-0/+68
| | | | | This is @nulltoken's work to test various invalid config section and key names and make sure we are validating properly.
* Merge pull request #1278 from sba1/cl-assert-equal-sVicent Martí2013-01-253-6/+6
|\ | | | | Use cl_assert_equal_s() instead of strcmp().
| * Use cl_assert_equal_s() instead of strcmp().Sebastian Bauer2013-01-253-6/+6
| | | | | | | | | | Replaced all cl_assert(!strcmp()) or semantically equivalent forms by cl_assert_equal_s().
* | config: support trailing backslashesCarlos Martín Nieto2013-01-251-0/+17
|/ | | | | | 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.
* tests: Fix some memory leaksnulltoken2013-01-061-0/+2
|
* Proper cleanup jeezVicent Marti2013-01-031-5/+7
|
* Move test cleanup into cleanup functionsBen Straub2013-01-031-1/+5
|
* Cleanup after testsBen Straub2013-01-031-0/+1
|
* versions: MSVC build fixesVicent Marti2012-12-051-1/+2
|
* Deploy git_config_backend versionBen Straub2012-11-301-0/+20
|
* Clean up config.hBen Straub2012-11-272-5/+5
|
* Fix a couple of warningsMichael Schubert2012-11-181-1/+0
|
* config: Opening a nonexistent file returns ENOTFOUNDnulltoken2012-11-172-0/+21
|
* config: return an emtpy string when there is no valueCarlos Martín Nieto2012-11-131-1/+3
| | | | | | | | | | | | | Returning NULL for the string when we haven't signaled an error condition is counter-intuitive and causes unnecessary edge cases. Return an empty string when asking for a string value for a configuration variable such as '[section] var' to avoid these edge cases. If the distinction between no value and an empty value is needed, this can be retrieved from the entry directly. As a side-effect, this change stops the int parsing functions from segfaulting on such a variable.
* config: distinguish between a lone variable name and one without rhsCarlos Martín Nieto2012-11-131-0/+6
| | | | | | '[section] variable' and '[section] variable =' behave differently when parsed as booleans, so we need to store that distinction internally.
* 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.
* Remove unused variablesMichael Schubert2012-11-131-1/+0
|
* config: make git_config_open_level() work with an empty confignulltoken2012-11-091-0/+13
|
* Add git_config_refresh() API to reload configRussell Belfer2012-10-301-0/+67
| | | | | | | | | | | | | | | | | | | | 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.