Unverified Commit 5d346c11 by Edward Thomson Committed by GitHub

Merge pull request #4525 from pks-t/pks/config-iterate-in-order

Configuration entry iteration in order
parents 2b967226 6a15f657
......@@ -64,6 +64,7 @@ typedef enum {
typedef struct git_config_entry {
const char *name; /**< Name of the entry (normalised) */
const char *value; /**< String value of the entry */
unsigned int include_depth; /**< Depth of includes where this variable was found */
git_config_level_t level; /**< Which config file this was found in */
void (*free)(struct git_config_entry *entry); /**< Free function for this entry */
void *payload; /**< Opaque value for the free function. Do not read or write */
......
......@@ -306,6 +306,15 @@ void test_config_read__foreach(void)
void test_config_read__iterator(void)
{
const char *keys[] = {
"core.dummy2",
"core.verylong",
"core.dummy",
"remote.ab.url",
"remote.abba.url",
"core.dummy2",
"core.global"
};
git_config *cfg;
git_config_iterator *iter;
git_config_entry *entry;
......@@ -321,6 +330,7 @@ void test_config_read__iterator(void)
cl_git_pass(git_config_iterator_new(&iter, cfg));
while ((ret = git_config_next(&entry, iter)) == 0) {
cl_assert_equal_s(entry->name, keys[count]);
count++;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment