Re: [PATCH v2 2/2] whatchanged: require --i-still-use-this
- From
Patrick Steinhardt <ps@pks.im>
- Date
- May 2, 2025, 09:08 UTC
- Message-ID
- <aBSLgTlfwSc1u_bH@pks.im>
- In-Reply-To
- <20250501225958.2947677-3-gitster@pobox.com>
On Thu, May 01, 2025 at 03:59:58PM -0700, Junio C Hamano wrote:
Show 18 quoted lines
> 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.
Show 11 quoted lines
> @@ -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