git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 16:56 UTC

[PATCH 1/2] scalar: add comments when setting config

From
Matthew Hughes <matthewhughes934@gmail.com>
Date
Nov 29, 2025, 17:22 UTC
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 <stolee@gmail.com>
---
 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
Previous: Matthew HughesNext: Matthew Hughes
Message 2 of 4 in “Update documentation/discoverability around `scalar`”
  1. 0/2 Update documentation/discoverability around `scalar`Matthew Hughes, Nov 29, 2025
  2. 1/2 scalar: add comments when setting configMatthew Hughes, Nov 29, 2025
  3. 2/2 config: document `gui.GCWarning`Matthew Hughes, Nov 29, 2025
  4. Kristoffer HaugsbakkNov 29, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.