Allow git config
to append a comment after a newly-added/-set/-replaced value
#1680
Labels
good first issue
Good for newcomers
It is all nice and good to be able to call
git config this.that something
to configure something programmatically, but there is no way to leave a comment right now. It would be nice to say something likegit config --comment="I added this. -- banksy" this.that something
and end up with a config containing this:To accomplish this, one would need to:
write_pair()
function, adding another function parameter (const char *comment
?) that is then also appended to&sb
, if non-NULL
git_config_set_multivar_in_file_gently()
to accept the same parameter, adjusting all its callers to simply passNULL
write_pair()
in thegit_config_set_multivar_in_file_gently()
function (#1, #2builtin/config.c
's list of file-local variables and add a command-line option togit config
's, then ensuring thatcmd_config()
verifies that this option is only used in conjunction withACTION_SET_ALL
,ACTION_ADD
orACTION_REPLACE_ALL
, otherwise error out with an error messagecmd_config()
to pass thecomment
togit_config_set_multivar_in_file_gently()
when setting/adding/replacing (#1, #2, #3; there are two more callers, but they are unsetters)Documentation/git-config.txt
t/t1300-config.sh
.See also https://discord.com/channels/1042895022950994071/1213052410281467906/1213052410281467906
The text was updated successfully, but these errors were encountered: