tests/config/write.c


Log

Author Commit Date CI Message
Edward Thomson 17442b28 2016-03-30T17:47:05 leaks: fix some leaks in the tests
Edward Thomson 76e1a679 2016-03-28T08:56:13 config::write::repeated: init our buffer
Carlos Martín Nieto 3e95bd36 2016-03-04T14:51:16 config: show we write a spurious duplicated section header We should notice that we are in the correct section to add. This is a cosmetic bug, since replacing any of these settings does work.
Linquize 08313c4b 2015-09-18T11:30:50 config: test that comments are left as with git
Arthur Schreiber 548cb334 2015-09-13T16:32:24 Don't free config in `git_transaction_commit`. The config is not owned by the transaction, so please don’t free it.
Carlos Martín Nieto 5340d63d 2015-07-12T12:50:23 config: perform unlocking via git_transaction This makes the API for commiting or discarding changes the same as for references.
Carlos Martín Nieto 36f784b5 2015-06-01T20:02:23 config: expose locking via the main API 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.
Carlos Martín Nieto b1667039 2015-06-01T19:17:03 config: implement basic transactional support When a configuration file is locked, any updates made to it will be done to the in-memory copy of the file. This allows for multiple updates to happen while we hold the lock, preventing races during complex config-file manipulation.
Edward Thomson d6b7e404 2015-05-04T07:36:21 config: test all multivars are updated 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.
Edward Thomson 0daf998d 2015-04-27T16:31:18 config: use wildcard in test instead of empty expr
Edward Thomson 63c0cc65 2015-04-27T16:29:00 config: cleanup some now-unused variables
Ryan Roden-Corrent 5a70df94 2015-04-21T15:57:20 Test setting config var under duplicate header. 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.
Edward Thomson bf99390e 2015-04-23T16:54:36 config: examine whole file when writing 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.
Edward Thomson f79c7322 2015-04-23T12:00:05 config: test overwriting cvar in multiple regions
Edward Thomson 7ee61b8e 2015-04-21T17:18:21 config: ensure we can write to an empty file
Edward Thomson 6dc55872 2015-04-21T17:18:21 config: ensure we can write to an empty file
Ryan Roden-Corrent f56a417d 2015-04-16T15:20:33 Specify mock config file content in test. Instead of using a config file in resources, include the config file content to be tested directly in the test.
Ryan Roden-Corrent a060cccc 2015-04-16T10:53:22 Unittest to validate config entry deletion bug. 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.
Carlos Martín Nieto 9a97f49e 2014-12-21T15:31:03 config: borrow refcounted references 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.
Carlos Martín Nieto 55cb4999 2014-10-23T19:05:02 config: remove the refresh function and backend field 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.
Linquize 69374869 2014-07-16T21:54:53 Add unit test to test add section without lf at EOF
Carlos Martín Nieto eaf37034 2014-03-31T08:53:56 config: refresh the values on write 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.
Carlos Martín Nieto 36913b8c 2014-03-06T15:11:11 config: document current write behaviour in a test 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.
Russell Belfer 96869a4e 2013-12-03T16:45:39 Improve GIT_EUSER handling 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.
Ben Straub 17820381 2013-11-14T14:05:52 Rename tests-clar to tests