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

Re: [PATCH 0/2] Submodules: Add the new config option "ignore"

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 5, 2010, 16:49 UTC
Message-ID
<7vlj8ldmyj.fsf@alter.siamese.dyndns.org>
In-Reply-To
<alpine.DEB.1.00.1008051025451.2983@bonsai2>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 11 quoted lines
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> Date: Thu, 5 Aug 2010 10:49:55 +0200
> Subject: [PATCH] Add the 'diff.ignoreSubmodules' config setting
> ...
> This commit introduces a global config setting to set a default
> (porcelain) value for the --ignore-submodules option, keeping the
> default at 'none'. It can be overridden by the submodule.*.ignore
> setting and by the --ignore-submodules option.
> ...
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
Nice, at least from a cursory look.  

diff_setup() is shared by everybody both plumbing and Porcelain that use diff and log, but you placed the smudging of the default based on config is in diff_ui_config(), so this patch looks safe.

And the default setting can be overriden with --ignore-submodules from the command line during diff_opt_parse(), which is also safe and sane.

Thanks; will queue.
Show 53 quoted lines
> diff --git a/diff.c b/diff.c
> index 8206047..1ddfdfb 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -31,6 +31,7 @@ static const char *external_diff_cmd_cfg;
>  int diff_auto_refresh_index = 1;
>  static int diff_mnemonic_prefix;
>  static int diff_no_prefix;
> +static struct diff_options default_diff_options;
>  
>  static char diff_colors[][COLOR_MAXLEN] = {
>  	GIT_COLOR_RESET,
> @@ -107,6 +108,9 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
>  	if (!strcmp(var, "diff.wordregex"))
>  		return git_config_string(&diff_word_regex_cfg, var, value);
>  
> +	if (!strcmp(var, "diff.ignoresubmodules"))
> +		handle_ignore_submodules_arg(&default_diff_options, value);
> +
>  	return git_diff_basic_config(var, value, cb);
>  }
>  
> @@ -2816,7 +2820,7 @@ static void run_checkdiff(struct diff_filepair *p, struct diff_options *o)
>  
>  void diff_setup(struct diff_options *options)
>  {
> -	memset(options, 0, sizeof(*options));
> +	memcpy(options, &default_diff_options, sizeof(*options));
>  	memset(&diff_queued_diff, 0, sizeof(diff_queued_diff));
>  
>  	options->file = stdout;
> diff --git a/submodule.c b/submodule.c
> index 1bcb0e9..75f3368 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -110,6 +110,10 @@ int parse_submodule_config_option(const char *var, const char *value)
>  void handle_ignore_submodules_arg(struct diff_options *diffopt,
>  				  const char *arg)
>  {
> +	DIFF_OPT_CLR(diffopt, IGNORE_SUBMODULES);
> +	DIFF_OPT_CLR(diffopt, IGNORE_UNTRACKED_IN_SUBMODULES);
> +	DIFF_OPT_CLR(diffopt, IGNORE_DIRTY_SUBMODULES);
> +
>  	if (!strcmp(arg, "all"))
>  		DIFF_OPT_SET(diffopt, IGNORE_SUBMODULES);
>  	else if (!strcmp(arg, "untracked"))
> -- 
> 1.7.2.1.2240.gde5dd
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Johannes SchindelinNext: Jens Lehmann
Message 12 of 15 in “Submodules: Add the new config option "ignore"”
  1. 0/2 Submodules: Add the new config option "ignore"Jens Lehmann, Jul 26, 2010
  2. 1/2 Submodules: Add the new "ignore" config option for diff and statusJens Lehmann, Jul 26, 2010
  3. 2/2 Submodules: Use "ignore" settings from .gitmodules too for diff and statusJens Lehmann, Jul 26, 2010
  4. Junio C HamanoJul 28, 2010
  5. 0/2 Submodules: Add the new config option "ignore"Jens Lehmann, Aug 5, 2010
  6. 1/2 Submodules: Add the new "ignore" config option for diff and statusJens Lehmann, Aug 5, 2010
  7. 2/2 Submodules: Use "ignore" settings from .gitmodules too for diff and statusJens Lehmann, Aug 5, 2010
  8. Junio C HamanoAug 5, 2010
  9. Jens LehmannAug 5, 2010
  10. Junio C HamanoAug 9, 2010
  11. Johannes SchindelinAug 5, 2010
  12. Junio C HamanoAug 5, 2010
  13. Jens LehmannAug 5, 2010
  14. Add tests for the diff.ignoreSubmodules config optionJens Lehmann, Aug 5, 2010
  15. Junio C HamanoAug 9, 2010

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.