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

Re: [PATCH v3 5/5] stash: make internal resets quiet and refresh index

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 15, 2022, 10:23 UTC
Message-ID
<xmqqee33h5ty.fsf@gitster.g>
In-Reply-To
<4c45351a0c4b8b955a9101ed9445a763750ca3c3.1647308982.git.gitgitgadget@gmail.com>
"Victoria Dye via GitGitGadget" <gitgitgadget@gmail.com> writes:
> +test_expect_success 'apply --index -q is quiet' '

Hmph. So being quiet and refreshing index are tested separately in different tests, and this one is only about being quiet?

I wonder if a single test that checks chattiness and refreshing of "git stash -q" and "git apply --index -q" (that's 2x2 which is 4) would be sufficient?

Show 7 quoted lines
> +	# Added file, deleted file, modified file all staged for commit
> +	echo foo >new-file &&
> +	echo test >file &&
> +	git add new-file file &&
> +	git rm other-file &&
> +
> +	git stash &&

As this is only about chattiness about "apply --index -q", this command goes unchecked (4 - 2 = 2).

> +	git stash apply --index -q >output.out 2>&1 &&

And this is only about chattiness so we do not test if the index gets refreshed after this operation (2 - 1 = 1).

> +	test_must_be_empty output.out

This ensures that "git stash apply --index -q" is silent, as that is the main objective of this step: make sure reset won't chatter, especially when stash is told to be --quiet, which is good.

But with a few more lines, this set-up can also test the other three with minimum additional effort, no?

Show 14 quoted lines
> +'
> +
>  test_expect_success 'save -q is quiet' '
>  	git stash save --quiet >output.out 2>&1 &&
>  	test_must_be_empty output.out
> @@ -291,6 +303,27 @@ test_expect_success 'drop -q is quiet' '
>  	test_must_be_empty output.out
>  '
>  
> +test_expect_success 'stash push -q --staged refreshes the index' '
> +	git reset --hard &&
> +	echo test >file &&
> +	git add file &&
> +	git stash push -q --staged &&

"git stash" and "git stash push -q --staged" may do different things, so leaving the plain "git stash" untested for refreshing in an earlier test, and "git stash" with different options being tested for refreshing here, makes me wonder about a gap in test coverage.

The overall theme of the whole topic was that chatty output from "git reset" run as an implementation detail seeps through from "git stash", IIUC. So, making sure that our index is refreshed after the operation is good, but at the same time, wouldn't we want to see what the output of this command says (or be silent)?

Previous: Victoria Dye via GitGitGadgetNext: Victoria Dye
Message 37 of 39 in “Separate '--skip-refresh' from '--quiet' in 'reset', use '--quiet' internally in 'stash'”
  1. 0/5 Separate '--skip-refresh' from '--quiet' in 'reset', use '--quiet' internally in 'stash'Victoria Dye via GitGitGadget, Mar 12, 2022
  2. 1/5 reset: revise index refresh adviceVictoria Dye via GitGitGadget, Mar 12, 2022
  3. 2/5 reset: introduce --[no-]refresh option to --mixedVictoria Dye via GitGitGadget, Mar 12, 2022
  4. Derrick StoleeMar 14, 2022
  5. Derrick StoleeMar 14, 2022
  6. Victoria DyeMar 14, 2022
  7. 3/5 reset: replace '--quiet' with '--no-refresh' in performance adviceVictoria Dye via GitGitGadget, Mar 12, 2022
  8. 4/5 reset: suppress '--no-refresh' advice if logging is silencedVictoria Dye via GitGitGadget, Mar 12, 2022
  9. 5/5 stash: make internal resets quiet and refresh indexVictoria Dye via GitGitGadget, Mar 12, 2022
  10. Derrick StoleeMar 14, 2022
  11. Victoria DyeMar 14, 2022
  12. Victoria DyeMar 12, 2022
  13. Junio C HamanoMar 14, 2022
  14. Derrick StoleeMar 14, 2022
  15. 0/5 Allow 'reset --quiet' to refresh the index, use 'reset --quiet' in 'stash'Victoria Dye via GitGitGadget, Mar 14, 2022
  16. 2/5 reset: introduce --[no-]refresh option to --mixedVictoria Dye via GitGitGadget, Mar 14, 2022
  17. Junio C HamanoMar 14, 2022
  18. Victoria DyeMar 14, 2022
  19. 1/5 reset: revise index refresh adviceVictoria Dye via GitGitGadget, Mar 14, 2022
  20. 4/5 reset: suppress '--no-refresh' advice if logging is silencedVictoria Dye via GitGitGadget, Mar 14, 2022
  21. Junio C HamanoMar 14, 2022
  22. 3/5 reset: replace '--quiet' with '--no-refresh' in performance adviceVictoria Dye via GitGitGadget, Mar 14, 2022
  23. 5/5 stash: make internal resets quiet and refresh indexVictoria Dye via GitGitGadget, Mar 14, 2022
  24. Junio C HamanoMar 14, 2022
  25. Victoria DyeMar 14, 2022
  26. Derrick StoleeMar 14, 2022
  27. Junio C HamanoMar 14, 2022
  28. 0/5 Allow 'reset --quiet' to refresh the index, use 'reset --quiet' in 'stash'Victoria Dye via GitGitGadget, Mar 15, 2022
  29. 1/5 reset: revise index refresh adviceVictoria Dye via GitGitGadget, Mar 15, 2022
  30. 3/5 reset: replace '--quiet' with '--no-refresh' in performance adviceVictoria Dye via GitGitGadget, Mar 15, 2022
  31. 2/5 reset: introduce --[no-]refresh option to --mixedVictoria Dye via GitGitGadget, Mar 15, 2022
  32. Phillip WoodMar 18, 2022
  33. Junio C HamanoMar 18, 2022
  34. Victoria DyeMar 18, 2022
  35. 4/5 reset: suppress '--no-refresh' advice if logging is silencedVictoria Dye via GitGitGadget, Mar 15, 2022
  36. 5/5 stash: make internal resets quiet and refresh indexVictoria Dye via GitGitGadget, Mar 15, 2022
  37. Junio C HamanoMar 15, 2022
  38. Victoria DyeMar 16, 2022
  39. Junio C HamanoMar 16, 2022

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.