git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 1/3] config: prepare to pass more info in git_config_with_options()

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 18, 2017, 02:27 UTC
Message-ID
<xmqqd1cah2m3.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170417101002.18272-1-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
> So far we can only pass one flag, respect_includes, to thie function. We
s/thie/this/
Show 30 quoted lines
> need to pass some more (non-flag even), so let's make it accept a struct
> instead of an integer.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  builtin/config.c | 21 ++++++++++++---------
>  cache.h          |  7 ++++++-
>  config.c         | 16 +++++++++++-----
>  3 files changed, 29 insertions(+), 15 deletions(-)
>
> diff --git a/builtin/config.c b/builtin/config.c
> index 4f49a0edb9..b937d175a9 100644
> --- a/builtin/config.c
> +++ b/builtin/config.c
> @@ -26,7 +26,8 @@ static int use_global_config, use_system_config, use_local_config;
>  static struct git_config_source given_config_source;
>  static int actions, types;
>  static int end_null;
> -static int respect_includes = -1;
> +static int respect_includes_opt = -1;
> +static struct config_options config_options;
>  static int show_origin;
>  
>  #define ACTION_GET (1<<0)
> @@ -81,7 +82,7 @@ static struct option builtin_config_options[] = {
>  	OPT_GROUP(N_("Other")),
>  	OPT_BOOL('z', "null", &end_null, N_("terminate values with NUL byte")),
>  	OPT_BOOL(0, "name-only", &omit_values, N_("show variable names only")),
> -	OPT_BOOL(0, "includes", &respect_includes, N_("respect include directives on lookup")),
> +	OPT_BOOL(0, "includes", &respect_includes_opt, N_("respect include directives on lookup")),

It would be more in line with what the log message advertised if you did

	static struct config_options config_options = {
		-1, /* .respect_includes: unspecified */
	};
	OPT_BOOL(0, "includes", &config_options.respect_includes, N_("...")),
no?
Previous: Jeff KingNext: Jeff King
Message 18 of 24 in “includeIf breaks calling dashed externals”
  1. Bert WesargApr 14, 2017
  2. Jeff KingApr 14, 2017
  3. Duy NguyenApr 15, 2017
  4. Jeff KingApr 16, 2017
  5. 1/2 config: prepare to pass more info in git_config_with_options()Nguyễn Thái Ngọc Duy, Apr 16, 2017
  6. 2/2 config: handle conditional include when $GIT_DIR is not set upNguyễn Thái Ngọc Duy, Apr 16, 2017
  7. Jeff KingApr 16, 2017
  8. Duy NguyenApr 17, 2017
  9. Jeff KingApr 18, 2017
  10. Duy NguyenApr 17, 2017
  11. 1/3 config: prepare to pass more info in git_config_with_options()Nguyễn Thái Ngọc Duy, Apr 17, 2017
  12. 2/3 config: handle conditional include when $GIT_DIR is not set upNguyễn Thái Ngọc Duy, Apr 17, 2017
  13. Junio C HamanoApr 18, 2017
  14. Junio C HamanoApr 18, 2017
  15. Jeff KingApr 18, 2017
  16. 3/3 config: correct file reading order in read_early_config()Nguyễn Thái Ngọc Duy, Apr 17, 2017
  17. Jeff KingApr 18, 2017
  18. Junio C HamanoApr 18, 2017
  19. Jeff KingApr 18, 2017
  20. Junio C HamanoApr 18, 2017
  21. Junio C HamanoApr 18, 2017
  22. Jeff KingApr 18, 2017
  23. Jeff KingApr 16, 2017
  24. Duy NguyenApr 17, 2017

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.