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

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

From
Derrick Stolee <derrickstolee@github.com>
Date
Mar 14, 2022, 15:10 UTC
Message-ID
<41db12c3-029f-2e44-703c-90cb45ed9875@github.com>
In-Reply-To
<052499bbc93cb6a60a3b7f7861de78dd4075fd7f.1647043729.git.gitgitgadget@gmail.com>
On 3/11/2022 7:08 PM, Victoria Dye via GitGitGadget wrote:
Show 5 quoted lines
> From: Victoria Dye <vdye@github.com>
> 
> Add the options '-q' and '--refresh' to the 'git reset' executed in
> 'reset_head()', and '--refresh' to the 'git reset -q' executed in
> 'do_push_stash(...)'.
Show 10 quoted lines
> diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
> index 5e68180f3b2..f2076545133 100755
> --- a/t/t7102-reset.sh
> +++ b/t/t7102-reset.sh
> @@ -482,7 +482,7 @@ test_index_refreshed () {
>  	git rm --cached file2 &&
>  
>  	# Step 2
> -	git reset $1 --mixed HEAD &&
> +	git reset $@ --mixed HEAD &&

I see you change this from "$1" to "$@", which won't help with the "-c key=value" issues from earlier.

Show 9 quoted lines
>  
>  	# Step 3
>  	git read-tree -m HEAD~1
> @@ -491,48 +491,66 @@ test_index_refreshed () {
>  test_expect_success '--mixed refreshes the index' '
>  	# Verify default behavior (with no config settings or command line
>  	# options)
> -	test_index_refreshed &&
> +	test_index_refreshed
Ah, I see you fixed this here, probably just a rebase issue, then.
Show 8 quoted lines
>  test_expect_success '--mixed --[no-]quiet sets default refresh behavior' '
>  	# Verify that --[no-]quiet and `reset.quiet` (without --[no-]refresh)
>  	# determine refresh behavior
>  
> -	# Config setting
> -	test_must_fail test_index_refreshed -c reset.quiet=true &&
> -	test_index_refreshed -c reset.quiet=true &&
> -

Ah, and the -c changes are removed here. You could still test them using the trick I mention in reply to patch 2.

Show 21 quoted lines
>  	# Command line option
> -	test_must_fail test_index_refreshed --quiet &&
> +	! test_index_refreshed --quiet &&
>  	test_index_refreshed --no-quiet &&
>  
> -	# Command line option overrides config setting
> -	test_must_fail test_index_refreshed -c reset.quiet=false --quiet &&
> -	test_index_refreshed -c reset.refresh=true --no-quiet
> +	# Config: reset.quiet=false
> +	test_config reset.quiet false &&
> +	(
> +		test_index_refreshed &&
> +		! test_index_refreshed --quiet
> +	) &&
> +
> +	# Config: reset.quiet=true
> +	test_config reset.quiet true &&
> +	(
> +		! test_index_refreshed &&
> +		test_index_refreshed --no-quiet
> +	)

I'm not sure why you need sub-shells here. The test_config is not scoped to the shell. These lines could be avoided with the -c trick, which should make it a bit simpler to show what you intend to be testing here.

Thanks, -Stolee

Previous: Victoria Dye via GitGitGadgetNext: Victoria Dye
Message 10 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.