From: "Philip Oakley" <philipoakley@iee.org>
To: "Tanay Abhra" <tanayabh@gmail.com>, <git@vger.kernel.org>
Cc: "Tanay Abhra" <tanayabh@gmail.com>,
"Ramkumar Ramachandra" <artagnon@gmail.com>,
"Matthieu Moy" <Matthieu.Moy@grenoble-inp.fr>,
"Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH] add documentation for writing config files
Date: Sat, 19 Jul 2014 19:35:08 +0100 [thread overview]
Message-ID: <7DFDF6A1361542EE9BA73AB52B1234AF@PhilipOakley> (raw)
In-Reply-To: 1405782354-13929-1-git-send-email-tanayabh@gmail.com
minor nit.
From: "Tanay Abhra" <tanayabh@gmail.com>
> Replace TODO introduced in commit 9c3c22 with documentation
> explaining Git config API functions for writing configuration
> files.
>
> Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
> ---
> Documentation/technical/api-config.txt | 31
> ++++++++++++++++++++++++++++++-
> 1 file changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/technical/api-config.txt
> b/Documentation/technical/api-config.txt
> index 230b3a0..df08385 100644
> --- a/Documentation/technical/api-config.txt
> +++ b/Documentation/technical/api-config.txt
> @@ -137,4 +137,33 @@ int read_file_with_include(const char *file,
> config_fn_t fn, void *data)
> Writing Config Files
> --------------------
>
> -TODO
> +Git gives multiple entry points in the Config API to write config
> values to
> +files namely `git_config_set_in_file` and `git_config_set`, which
> write to
> +a specific config file or to `.git/config` respectively. They both
> take a
> +key/value pair as parameter.
> +In the end they both all call `git_config_set_multivar_in_file` which
> takes
s/both // 'both all' is a bit tautological.
> +four parameters:
> +
> +- the name of the file, as a string, to which key/value pairs will be
> written.
> +
> +- the name of key, as a string. This is in canonical "flat" form: the
> section,
> + subsection, and variable segments will be separated by dots, and
> the section
> + and variable segments will be all lowercase.
> + E.g., `core.ignorecase`, `diff.SomeType.textconv`.
> +
> +- the value of the variable, as a string. If value is equal to NULL,
> it will
> + remove the matching key from the config file.
> +
> +- the value regex, as a string. It will disregard key/value pairs
> where value
> + does not match.
> +
> +- a multi_replace value, as an int. If value is equal to zero,
> nothing or only
> + one matching key/value is replaced, else all matching key/values
> (regardless
> + how many) are removed, before the new pair is written.
> +
> +It returns 0 on success.
> +
> +Also, there are functions `git_config_rename_section` and
> +`git_config_rename_section_in_file` with parameters `old_name` and
> `new_name`
> +for renaming or removing sections in the config files. If NULL is
> passed
> +through `new_name` parameter, the section will be removed from the
> config file.
> --
> 1.9.0.GIT
>
> --
Philip
next prev parent reply other threads:[~2014-07-19 18:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-19 15:05 [PATCH] add documentation for writing config files Tanay Abhra
2014-07-19 18:35 ` Philip Oakley [this message]
2014-07-20 7:18 ` [PATCH v2] " Tanay Abhra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7DFDF6A1361542EE9BA73AB52B1234AF@PhilipOakley \
--to=philipoakley@iee.org \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=tanayabh@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox