summaryrefslogtreecommitdiff
path: root/tests/config/write.c
Commit message (Collapse)AuthorAgeFilesLines
* config: test all multivars are updatedEdward Thomson2015-05-041-6/+16
| | | | | | If a multivar exists within two sections (of the same name) then they should both be updated in a `set_multivar`. Ensure that this is the case.
* config: use wildcard in test instead of empty exprEdward Thomson2015-05-041-1/+1
|
* config: cleanup some now-unused variablesEdward Thomson2015-05-041-2/+0
|
* Test setting config var under duplicate header.Ryan Roden-Corrent2015-05-041-0/+49
| | | | | | | | | | Add a test that exposes a bug in config_write. It is valid to have multiple separate headers for the same config section, but config_write will exit after finding the first matching section in certain situations. This test proves that config_write will duplicate a variable that already exists instead of overwriting it if the variable is defined under a duplicate section header.
* config: examine whole file when writingEdward Thomson2015-05-041-0/+37
| | | | | | | | | | | | | | | | Previously we would try to be clever when writing the configuration file and try to stop parsing (and simply copy the rest of the old file) when we either found the value we were trying to write, or when we left the section that value was in, the assumption being that there was no more work to do. Regrettably, you can have another section with the same name later in the file, and we must cope with that gracefully, thus we read the whole file in order to write a new file. Now, writing a file looks even more than reading. Pull the config parsing out into its own function that can be used by both reading and writing the configuration.
* config: test overwriting cvar in multiple regionsEdward Thomson2015-05-041-0/+36
|
* config: ensure we can write to an empty fileEdward Thomson2015-05-041-0/+72
|
* config: ensure we can write to an empty fileEdward Thomson2015-04-231-0/+35
|
* Specify mock config file content in test.Ryan Roden-Corrent2015-04-211-4/+11
| | | | | Instead of using a config file in resources, include the config file content to be tested directly in the test.
* Unittest to validate config entry deletion bug.Ryan Roden-Corrent2015-04-211-0/+31
| | | | | | Add a unittest to validate bug #3043, where a duplicate empty config header could cause deletion of a config entry to fail silently. The bug is currently unresolved and this test will fail.
* config: borrow refcounted referencescmn/config-borrow-entryCarlos Martín Nieto2015-03-031-25/+38
| | | | | | | | | | | | | | | 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.
* config: remove the refresh function and backend fieldcmn/config-refresh-removeCarlos Martín Nieto2014-10-231-5/+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.
* Add unit test to test add section without lf at EOFLinquize2014-07-161-0/+16
|
* config: refresh the values on writeCarlos Martín Nieto2014-04-181-1/+1
| | | | | | When writing out, parse the resulting file instead of adding or replacing the value locally. This has the effect of reading external changes as well.
* config: document current write behaviour in a testCarlos Martín Nieto2014-04-181-0/+27
| | | | | | | On set, we set/add the value written to the config's internal values, but we do not refresh old values. Document this in a test in preparation for the refresh changes.
* Improve GIT_EUSER handlingRussell Belfer2013-12-111-0/+1
| | | | | | | | | | | This adds giterr_user_cancel to return GIT_EUSER and clear any error message that is sitting around. As a result of using that in places, we need to be more thorough with capturing errors that happen inside a callback when used internally. To help with that, this also adds giterr_capture and giterr_restore so that when we internally use a foreach-type function that clears errors and converts them to GIT_EUSER, it is easier to restore not just the return value, but the actual error message text.
* Rename tests-clar to testsBen Straub2013-11-141-0/+305