On Thu, Oct 21, 2021 at 6:25 PM Øystein Walle <oystwa@xxxxxxxxx> wrote: > The v2 porcelain format is very convenient for obtaining a lot of > information about the current state of the repo, but does not contain > any info about the stash. git status already accepts --show-stash but > it's silently ignored when --porcelain=v2 is given. > > Let's add a simple line to print the number of stash entries but in a > format similar in style to the rest of the format. > > Signed-off-by: Øystein Walle <oystwa@xxxxxxxxx> > --- > diff --git a/t/t7064-wtstatus-pv2.sh b/t/t7064-wtstatus-pv2.sh > @@ -113,6 +113,21 @@ test_expect_success 'after first commit, create unstaged changes' ' > +test_expect_success 'after first commit, stash existing changes' ' > + cat >expect <<-EOF && > + # branch.oid $H0 > + # branch.head initial-branch > + # stash 2 > + EOF > + > + test_when_finished "git stash pop && git stash pop" && If it's indeed important to clean up the stashes when the test finishes, then the test_when_finished() invocation should probably be a bit more robust... > + git stash -- file_x && > + git stash && ... since, as it is now, if an error occurs between these two git-stash invocations or before them, then there will only be zero or one stashes, so the double stash-pop by test_when_finished() will itself errout out. Better, perhaps to do this: test_when_finished "git stash pop && git stash pop || :" && > + git status --porcelain=v2 --branch --show-stash --untracked-files=no >actual && > + test_cmp expect actual > +'