{"thread":{"id":"37169","subject":"[PATCH] add documentation for writing config files","startedAt":"2014-07-19T15:05:54Z","lastAt":"2014-07-20T07:18:13Z","messageCount":3,"participants":["Tanay Abhra","Philip Oakley"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"246370","messageId":"1405782354-13929-1-git-send-email-tanayabh@gmail.com","threadId":"37169","inReplyTo":null,"subject":"[PATCH] add documentation for writing config files","fromName":"Tanay Abhra","fromEmail":"tanayabh@gmail.com","sentAt":"2014-07-19T15:05:54Z","receivedAt":"2014-07-19T15:05:54Z","isPatch":true,"sender":{"key":"tanayabh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2097229?v=4"},"body":"Replace TODO introduced in commit 9c3c22 with documentation\nexplaining Git config API functions for writing configuration\nfiles.\n\nSigned-off-by: Tanay Abhra <tanayabh@gmail.com>\n---\n Documentation/technical/api-config.txt | 31 ++++++++++++++++++++++++++++++-\n 1 file changed, 30 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/technical/api-config.txt b/Documentation/technical/api-config.txt\nindex 230b3a0..df08385 100644\n--- a/Documentation/technical/api-config.txt\n+++ b/Documentation/technical/api-config.txt\n@@ -137,4 +137,33 @@ int read_file_with_include(const char *file, config_fn_t fn, void *data)\n Writing Config Files\n --------------------\n \n-TODO\n+Git gives multiple entry points in the Config API to write config values to\n+files namely `git_config_set_in_file` and `git_config_set`, which write to\n+a specific config file or to `.git/config` respectively. They both take a\n+key/value pair as parameter.\n+In the end they both all call `git_config_set_multivar_in_file` which takes\n+four parameters:\n+\n+- the name of the file, as a string, to which key/value pairs will be written.\n+\n+- the name of key, as a string. This is in canonical \"flat\" form: the section,\n+  subsection, and variable segments will be separated by dots, and the section\n+  and variable segments will be all lowercase.\n+  E.g., `core.ignorecase`, `diff.SomeType.textconv`.\n+\n+- the value of the variable, as a string. If value is equal to NULL, it will\n+  remove the matching key from the config file.\n+\n+- the value regex, as a string. It will disregard key/value pairs where value\n+  does not match.\n+\n+- a multi_replace value, as an int. If value is equal to zero, nothing or only\n+  one matching key/value is replaced, else all matching key/values (regardless\n+  how many) are removed, before the new pair is written.\n+\n+It returns 0 on success.\n+\n+Also, there are functions `git_config_rename_section` and\n+`git_config_rename_section_in_file` with parameters `old_name` and `new_name`\n+for renaming or removing sections in the config files. If NULL is passed\n+through `new_name` parameter, the section will be removed from the config file.\n-- \n1.9.0.GIT\n"},{"id":"246394","messageId":"7DFDF6A1361542EE9BA73AB52B1234AF@PhilipOakley","threadId":"37169","inReplyTo":"1405782354-13929-1-git-send-email-tanayabh@gmail.com","subject":"Re: [PATCH] add documentation for writing config files","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":"2014-07-19T18:35:08Z","receivedAt":"2014-07-19T18:35:08Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"minor nit.\nFrom: \"Tanay Abhra\" <tanayabh@gmail.com>\n> Replace TODO introduced in commit 9c3c22 with documentation\n> explaining Git config API functions for writing configuration\n> files.\n>\n> Signed-off-by: Tanay Abhra <tanayabh@gmail.com>\n> ---\n> Documentation/technical/api-config.txt | 31 \n> ++++++++++++++++++++++++++++++-\n> 1 file changed, 30 insertions(+), 1 deletion(-)\n>\n> diff --git a/Documentation/technical/api-config.txt \n> b/Documentation/technical/api-config.txt\n> index 230b3a0..df08385 100644\n> --- a/Documentation/technical/api-config.txt\n> +++ b/Documentation/technical/api-config.txt\n> @@ -137,4 +137,33 @@ int read_file_with_include(const char *file, \n> config_fn_t fn, void *data)\n> Writing Config Files\n> --------------------\n>\n> -TODO\n> +Git gives multiple entry points in the Config API to write config \n> values to\n> +files namely `git_config_set_in_file` and `git_config_set`, which \n> write to\n> +a specific config file or to `.git/config` respectively. They both \n> take a\n> +key/value pair as parameter.\n> +In the end they both all call `git_config_set_multivar_in_file` which \n> takes\n\ns/both //    'both all' is a bit tautological.\n\n> +four parameters:\n> +\n> +- the name of the file, as a string, to which key/value pairs will be \n> written.\n> +\n> +- the name of key, as a string. This is in canonical \"flat\" form: the \n> section,\n> +  subsection, and variable segments will be separated by dots, and \n> the section\n> +  and variable segments will be all lowercase.\n> +  E.g., `core.ignorecase`, `diff.SomeType.textconv`.\n> +\n> +- the value of the variable, as a string. If value is equal to NULL, \n> it will\n> +  remove the matching key from the config file.\n> +\n> +- the value regex, as a string. It will disregard key/value pairs \n> where value\n> +  does not match.\n> +\n> +- a multi_replace value, as an int. If value is equal to zero, \n> nothing or only\n> +  one matching key/value is replaced, else all matching key/values \n> (regardless\n> +  how many) are removed, before the new pair is written.\n> +\n> +It returns 0 on success.\n> +\n> +Also, there are functions `git_config_rename_section` and\n> +`git_config_rename_section_in_file` with parameters `old_name` and \n> `new_name`\n> +for renaming or removing sections in the config files. If NULL is \n> passed\n> +through `new_name` parameter, the section will be removed from the \n> config file.\n> -- \n> 1.9.0.GIT\n>\n> --\nPhilip \n"},{"id":"246401","messageId":"53CB6D35.80805@gmail.com","threadId":"37169","inReplyTo":"7DFDF6A1361542EE9BA73AB52B1234AF@PhilipOakley","subject":"[PATCH v2] add documentation for writing config files","fromName":"Tanay Abhra","fromEmail":"tanayabh@gmail.com","sentAt":"2014-07-20T07:18:13Z","receivedAt":"2014-07-20T07:18:13Z","isPatch":true,"sender":{"key":"tanayabh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2097229?v=4"},"body":"Replace TODO introduced in commit 9c3c22 with documentation\nexplaining Git config API functions for writing configuration\nfiles.\n\nSigned-off-by: Tanay Abhra <tanayabh@gmail.com>\n---\nMinor nit corrected. Thanks for the review.\n\n Documentation/technical/api-config.txt | 31 ++++++++++++++++++++++++++++++-\n 1 file changed, 30 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/technical/api-config.txt b/Documentation/technical/api-config.txt\nindex 230b3a0..edd5018 100644\n--- a/Documentation/technical/api-config.txt\n+++ b/Documentation/technical/api-config.txt\n@@ -137,4 +137,33 @@ int read_file_with_include(const char *file, config_fn_t fn, void *data)\n Writing Config Files\n --------------------\n\n-TODO\n+Git gives multiple entry points in the Config API to write config values to\n+files namely `git_config_set_in_file` and `git_config_set`, which write to\n+a specific config file or to `.git/config` respectively. They both take a\n+key/value pair as parameter.\n+In the end they both call `git_config_set_multivar_in_file` which takes four\n+parameters:\n+\n+- the name of the file, as a string, to which key/value pairs will be written.\n+\n+- the name of key, as a string. This is in canonical \"flat\" form: the section,\n+  subsection, and variable segments will be separated by dots, and the section\n+  and variable segments will be all lowercase.\n+  E.g., `core.ignorecase`, `diff.SomeType.textconv`.\n+\n+- the value of the variable, as a string. If value is equal to NULL, it will\n+  remove the matching key from the config file.\n+\n+- the value regex, as a string. It will disregard key/value pairs where value\n+  does not match.\n+\n+- a multi_replace value, as an int. If value is equal to zero, nothing or only\n+  one matching key/value is replaced, else all matching key/values (regardless\n+  how many) are removed, before the new pair is written.\n+\n+It returns 0 on success.\n+\n+Also, there are functions `git_config_rename_section` and\n+`git_config_rename_section_in_file` with parameters `old_name` and `new_name`\n+for renaming or removing sections in the config files. If NULL is passed\n+through `new_name` parameter, the section will be removed from the config file.\n-- \n1.9.0.GIT\n"}]}