git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Feb 20, 2024, 11:01 UTC
Message-ID
<78a8733b-c74a-4017-8905-d29b2e05adb1@gmail.com>
In-Reply-To
<df020dcc-afe8-4dd8-b476-4ca032206214@gmail.com>
Hi Ricardo
On 18/02/2024 17:54, Ricardo C wrote:
Show 15 quoted lines
> Hi Phillip,
> 
> On 2/18/24 05:32, Phillip Wood wrote:
>> 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.
> 
> Both `git rebase --autostash` and `git merge --autostash` seem to be 
> hardcoded to clean the index, regardless of the configuration or CLI 
> flags. They do not use regular `git stash` to do so, but rather `git 
> stash create`. This is unaffected by my changes, since it follows a 
> different code path and does not accept `--keep-index` nor 
> `--include-untracked`.

Ah, I'd forgotten that we hand "git stash create" as well as "git stash push". It's good that these changes do not affect "git stash create" but I think Junio is right to be concerned about the effect on tools that are using "git stash push" where they arguably ought to be using "git stash create".

> I'll add some tests for `git rebase --autostash` 
> and `git merge --autostash`, just in case this behavior is changed in 
> the future and causes breakage.

That's a good idea but I think it would be better to test that "git stash create" is not affected by the config as we don't want to change the behavior of its behavior.

Show 16 quoted lines
>> I've only given the patch a very quick scan, but it looked sensible. 
>> The only thing that jumped out at me was that quite a few tests seem 
>> to do
>>
>>      git init repo &&
>>      (
>>          cd repo &&
>>          # test things
>>      ) &&
>>
>> Our normal practice is to run all the tests in the same file in the 
>> same repository rather than setting up a new one each time.
> 
> I was doing this because it makes comparing different commands easier, 
> but looking through other tests again, it seems like I should be 
> comparing the outputs to hardcoded files anyway.
Yes, that is our usual practice.
Best Wishes
Phillip
Previous: Ricardo CNext: Junio C Hamano
Message 4 of 16 in “builtin/stash: configs keepIndex, includeUntracked”
  1. builtin/stash: configs keepIndex, includeUntrackedMithicSpirit, Feb 18, 2024
  2. Phillip WoodFeb 18, 2024
  3. Ricardo CFeb 18, 2024
  4. Phillip WoodFeb 20, 2024
  5. Junio C HamanoFeb 20, 2024
  6. Ricardo CFeb 21, 2024
  7. Junio C HamanoFeb 21, 2024
  8. Ricardo CFeb 21, 2024
  9. Junio C HamanoFeb 21, 2024
  10. Junio C HamanoFeb 20, 2024
  11. Ricardo CFeb 20, 2024
  12. Junio C HamanoFeb 20, 2024
  13. Ricardo CFeb 20, 2024
  14. Kristoffer HaugsbakkFeb 20, 2024
  15. Jean-Noël AvilaFeb 19, 2024
  16. Ricardo CFeb 19, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.