Re: [PATCH v3 3/5] t3903: test stash --index merges
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Sep 28, 2026, 15:44 UTC
- Message-ID
- <97f86d82-b5ec-44df-9ccf-8e6cd93e45f4@gmail.com>
- In-Reply-To
- <8b5ea5e6f47ee9a57df3a4d97a457d024b3dec00.1790425008.git.ben.knoble@gmail.com>
Hi Ben
On 26/09/2026 13:16, D. Ben Knoble wrote:
> A future commit will refactor index handling for applied stashes, and we > need to take care to get the order of trees right when merging. Add a > test that covers this case.
The test looks good, but without the changes in patch 5 it fails and so adding it here breaks running "git bisect" on this series. I'd squash this into the final patch and I think we can probably replace an existing "stash apply --index" tests that are not so strict with this one, rather than adding a new test.
Thanks
Phillip
Show 38 quoted lines
> Suggested-by: Phillip Wood <phillip.wood@dunelm.org.uk>
> Signed-off-by: D. Ben Knoble <ben.knoble@gmail.com>
> ---
> t/t3903-stash.sh | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
> index 721158606f..9bc99fa252 100755
> --- a/t/t3903-stash.sh
> +++ b/t/t3903-stash.sh
> @@ -374,6 +374,27 @@ setup_stash() {
> test_cmp expect actual
> '
>
> +# the later "stash -k" test is not expecting us to muck with file so much, so
> +# reset when finished
> +test_expect_success 'stash apply --index merges the correct trees' '
> + head=$(git rev-parse HEAD) &&
> + test_when_finished "git reset --hard $head" &&
> + test_write_lines A B C >file &&
> + git commit -m setup file &&
> + test_write_lines A B staged >file &&
> + git add file &&
> + test_write_lines A B unstaged >file &&
> + git stash &&
> + test_write_lines committed B C >file &&
> + git commit -m to-be-merged file &&
> + git stash pop --index &&
> + git show :file >actual &&
> + test_write_lines committed B staged >expect &&
> + test_cmp expect actual &&
> + test_write_lines committed B unstaged >expect &&
> + test_cmp expect file
> +'
> +
> test_expect_success 'stash -k' '
> echo bar3 >file &&
> echo bar4 >file2 &&