Subject: Re: [PATCH v2] advice: add stashBeforeCheckout advice for dirty branch switches

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 10 Mar 2026 14:16:51 +0100

On Tue, Mar 10, 2026 at 10:59:24AM +0000, Arsh Srivastava via GitGitGadget wrote:
> diff --git a/advice.c b/advice.c
> index 0018501b7b..e1264f525c 100644
> --- a/advice.c
> +++ b/advice.c
> @@ -81,6 +81,7 @@ static struct {
>  	[ADVICE_SET_UPSTREAM_FAILURE]			= { "setUpstreamFailure" },
>  	[ADVICE_SKIPPED_CHERRY_PICKS]			= { "skippedCherryPicks" },
>  	[ADVICE_SPARSE_INDEX_EXPANDED]			= { "sparseIndexExpanded" },
> +	[ADVICE_STASH_BEFORE_CHECKOUT] = { "stashBeforeCheckout" },
>  	[ADVICE_STATUS_AHEAD_BEHIND_WARNING]		= { "statusAheadBehindWarning" },
>  	[ADVICE_STATUS_HINTS]				= { "statusHints" },
>  	[ADVICE_STATUS_U_OPTION]			= { "statusUoption" },
> @@ -312,3 +313,29 @@ void advise_on_moving_dirty_path(struct string_list *pathspec_list)
>  			    "* Use \"git add --sparse <paths>\" to update the index\n"
>  			    "* Use \"git sparse-checkout reapply\" to apply the sparsity rules"));
>  }
> +
> +void advise_on_checkout_dirty_files(struct string_list *file_list)

Huh. So this patch wires up a new function and advice, but we don't ever
seem to use it. Am I missing something?

Patrick