Thread (19 messages) 19 messages, 4 authors, 20d ago
COLD20d

[PATCH] advice: use global config for default branch name

From: Vsevolod Myalitsin <hidden>
Date: 2026-09-08 14:59:01

I considered using an "is_global(key)" helper, but I think adding a field to "advice_setting" is cleaner.

The change is quite small:

 struct advice_setting {
     const char *key;
+    int global_hint;
     enum advice_level level;
 };

Then the scope is specified directly for the relevant advice:

	-[ADVICE_DEFAULT_BRANCH_NAME] = { "defaultBranchName" },
	+[ADVICE_DEFAULT_BRANCH_NAME] = { "defaultBranchName", 1 },

And used when building the hint:

	 static void vadvise(const char *advice, int display_instructions,
	-                    const char *key, va_list params)
	+                    const char *key, int global, va_list params)
	 {
	     ...
 
	     if (display_instructions)
	-        strbuf_addf(&buf, turn_off_instructions, key);
	+        strbuf_addf(&buf, turn_off_instructions,
	+                    global ? "--global" : "", key);
	 }

This keeps the information about the intended config scope in "advice_setting", rather than making "vadvise()" depend on specific advice keys.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help