Re: [PATCH 0/5] Separate '--skip-refresh' from '--quiet' in 'reset', use '--quiet' internally in 'stash'
- From
Derrick Stolee <derrickstolee@github.com>
- Date
- Mar 14, 2022, 15:13 UTC
- Message-ID
- <09550c4c-10ce-5439-98ac-ca71b9309c69@github.com>
- In-Reply-To
- <pull.1170.git.1647043729.gitgitgadget@gmail.com>
On 3/11/2022 7:08 PM, Victoria Dye via GitGitGadget wrote:
Show 28 quoted lines
> In the process of working on tests for 'git stash' sparse index integration, > I found that the '--quiet' option in 'git stash' does not suppress all > non-error output when used with '--index'. Specifically, this comes from an > invocation of 'git reset' without the '--quiet' flag in 'reset_head()'. Upon > enabling that flag, though, I discovered that 1) 'reset' does not refresh > the index if '--quiet' is specified (as of [1]) and 2) 'git stash' needs the > index to be refreshed after the reset. > > This series aims to decouple the "suppress logging" and "skip index refresh" > behaviors in 'git reset --mixed', then allow 'stash' to internally use reset > with logs suppressed but index refresh enabled. This is accomplished by > introducing the '--[no-]refresh' option and 'reset.refresh' config setting > to 'git reset'. Additionally, in the spirit of backward-compatibility, > '--quiet' and/or 'reset.quiet=true' without any specified "refresh" > option/config will continue to skip 'refresh_index(...)'. > > There are also some minor updates to the advice that suggests skipping the > index refresh: > > * replace recommendation to use "--quiet" with "--no-refresh" > * use 'advise()' rather than 'printf()' > * rename the advice config setting from 'advice.resetQuiet' to to > 'advice.resetNoRefresh' > * suppress advice if '--quiet' is specified in 'reset' > > Finally, tests are added to 't7102-reset.sh' verifying whether index refresh > happens when expected and to 't3903-stash.sh' verifying that 'apply --quiet' > no longer prints extraneous logs.
Good find! Code looks great.
There are some test issues in Patch 2 that you correct in patch 5, so maybe we just need to squash the changes in the right order.
However, I recommended two alternate ways to design your helper so you can test config and command-line options more easily.
Thanks, -Stolee