Subject: Re: [PATCH v2 2/2] whatchanged: require --i-still-use-this

From: Patrick Steinhardt <[email-masked]>
Date: Fri, 2 May 2025 11:08:17 +0200

On Thu, May 01, 2025 at 03:59:58PM -0700, Junio C Hamano wrote:
> diff --git a/builtin/log.c b/builtin/log.c
> index 04a6ef97bc..0f98ac8a34 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -113,6 +113,13 @@ struct log_config {
>  	int fmt_patch_name_max;
>  	char *fmt_pretty;
>  	char *default_date_mode;
> +
> +	/*
> +	 * Note: git_log_config() does not touch this member and that
> +	 * is very deliberate.  This member is only to be used to
> +	 * resurrect whatchanged that is deprecated.
> +	 */
> +	int i_still_use_this;
>  };
>  
>  static void log_config_init(struct log_config *cfg)

I was briefly wondering why this variable wasn't just declared in
`cmd_whatchanged()`, but that's because parsing is of course done by
`cmd_log_init_finish()`. Nothing worth thinking about too much.

> @@ -656,6 +665,10 @@ int cmd_whatchanged(int argc,
>  	opt.def = "HEAD";
>  	opt.revarg_opt = REVARG_COMMITTISH;
>  	cmd_log_init(argc, argv, prefix, &rev, &opt, &cfg);
> +
> +	if (!cfg.i_still_use_this)
> +		you_still_use_that("git whatchanged");
> +
>  	if (!rev.diffopt.output_format)
>  		rev.diffopt.output_format = DIFF_FORMAT_RAW;
>  

I think it would help potential users of this command quite a bit if we
explicitly told them what the replacement is. So maybe we can extend
`you_still_use_that()` to accept an explanation?

Patrick