Thread (85 messages) 85 messages, 5 authors, 49m ago

Re: [PATCH v8 4/9] environment: move pager_program into repo_config_values

From: Junio C Hamano <hidden>
Date: 2026-07-09 16:41:04

Tian Yuchen [off-list ref] writes:
quoted
quoted
  	if (!strcmp(var, "core.pager"))
-		return git_config_string(&pager_program, var, value);
+		return git_config_string(&repo_config_values(r)->pager_program, var, value);
Isn't this still overwriting what was in the .pager_program member
of the config values struct?  In check_pager_config() below, there
is a free() to avoid such a leak, but wouldn't this have the same
issue?
quoted
@@ -91,10 +94,10 @@ const char *git_pager(struct repository *r, int stdout_is_tty)
  
  	pager = getenv("GIT_PAGER");
  	if (!pager) {
-		if (!pager_program)
+		if (!repo_config_values(r)->pager_program)
  			read_early_config(r,
-					  core_pager_config, NULL);
-		pager = pager_program;
+					  core_pager_config, r);
+		pager = repo_config_values(r)->pager_program;
  	}
  	if (!pager)
  		pager = getenv("PAGER");
@@ -302,7 +305,9 @@ int check_pager_config(struct repository *r, const char *cmd)
  
  	read_early_config(r, pager_command_config, &data);
  
-	if (data.value)
-		pager_program = data.value;
+	if (data.value) {
+		free(repo_config_values(r)->pager_program);
+		repo_config_values(r)->pager_program = data.value;
+	}
  	return data.want;
  }
Nice catch, sorry for missing that!
You do not have to be or say sorry.  This is a team effort, and I am
reasonably sure that I did not catch _all_ similar bugs in this
iteration.  So before you send an updated version, please make sure
that you just do not fix this one only and be content with it.
Instead try to see if there are other similar issues and fix them,
too.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help