Subject: Re: [PATCH] builtin/stash: configs keepIndex, includeUntracked

From: Junio C Hamano <[email-masked]>
Date: Mon, 19 Feb 2024 18:52:44 -0800

Phillip Wood <[email-masked]> writes:

> How does "stash.keepIndex" interact with "git rebase --autostash" and
> "git merge --autostash"? I think both those commands expect a clean
> index after running "git stash". They could just override the config
> setting but it might get a bit confusing if some commands respect the
> config and others don't.

The "autostash" feature fundamentally should not respect such
configuration variables, as the reason why they exist is not to
create a stash of any unusual kind the user expresses preference to
by the configuration variable(s), but to clear the slate and bring
both the working tree and the index pristine with respect to HEAD.
Also, when able, they would automatically unstash after the main
operation to rebase or merge is done, right?  IOW, normally the use
of the stash ought to be invisible to the end users.  I would not
worry too much about the "confusion" factor for these reasons.

You are however right that this will confuse the toolchain.  These
two commands we provide may not be affected (or we can make them not
affected by changing their implementation if needed, while we add
such configuration variables at the same time), but third-party
tools and end-user scripts that has trusted that when they write
"git stash", the command will give them a clean index and working
tree will be broken big time.

So, I am somewhat negative on the patch in the current form, until I
see how the plan to help third-party tools and end-user scripts that
rely on the promise we have given them looks like.

Thanks.