Re: [PATCH v2] advice: add stashBeforeCheckout advice for dirty branch switches
- From
Arsh Srivastava <arshsrivastava00@gmail.com>
- Date
- Mar 10, 2026, 13:36 UTC
- Message-ID
- <CAOAgETMe_yGyuaV4Eo9WDNYBa+eG-SEYDTCDoV45itNh_TE_GA@mail.gmail.com>
- In-Reply-To
- <abAZw-Z1mKf4tAuH@pks.im>
Thank you so much for looking into my PR and i believe advice.h is used in the add.c file. And advice really helps young developers understand what's wrong in their files because navigating git and trying to find solutions is very difficult, causing them to go to ai models making them copy pasting machines.
On Tue, 10 Mar 2026 at 18:46, Patrick Steinhardt <ps@pks.im> wrote:
Show 25 quoted lines
>
> 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