From: Matthew Hughes Date: Sat, 29 Nov 2025 17:22:18 GMT Subject: [PATCH 1/2] scalar: add comments when setting config Message-ID: <20251129172124.4164-2-matthewhughes934@gmail.com> In-Reply-To: <20251129172124.4164-1-matthewhughes934@gmail.com> This is to help users understand that a change in the config was made by `scalar` (and not e.g. manually by themselves at some point in the past). As discussed on a thread[1]. Link: https://lore.kernel.org/git/aMkVqNbdgxqBJ9K4@pks.im/ [1] Co-authored-by: Derrick Stolee --- scalar.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scalar.c b/scalar.c index f754311627..4bdf8cf121 100644 --- a/scalar.c +++ b/scalar.c @@ -19,6 +19,7 @@ #include "help.h" #include "setup.h" #include "trace2.h" +#include "path.h" static void setup_enlistment_directory(int argc, const char **argv, const char * const *usagestr, @@ -102,8 +103,11 @@ static int set_scalar_config(const struct scalar_config *config, int reconfigure if ((reconfigure && config->overwrite_on_reconfigure) || repo_config_get_string(the_repository, config->key, &value)) { + char *cfg_file = repo_git_path(the_repository, "config"); + const char *comment = " # set by git-scalar"; trace2_data_string("scalar", the_repository, config->key, "created"); - res = repo_config_set_gently(the_repository, config->key, config->value); + res = repo_config_set_in_file_gently(the_repository, cfg_file, config->key, comment, config->value); + free(cfg_file); } else { trace2_data_string("scalar", the_repository, config->key, "exists"); res = 0; -- 2.51.0