On 8/3/2022 12:51 AM, Shaoxuan Yuan wrote: > Method pathspec_needs_expanded_index() in reset.c from 4d1cfc1351 > (reset: make --mixed sparse-aware, 2021-11-29) is reusable when we > need to verify if the index needs to be expanded when the command > is utilizing a pathspec rather than a literal path. > > Move it to pathspec.h for reusability. > > Add a few items to the function so it can better serve its purpose as > a standalone public function: > > * Add a check in front so if the index is not sparse, return early since > no expansion is needed. > > * Add documentation to the function. I took a look at this diff on my machine with --color-moved, which highlighted the other valuable thing about this move: it takes an arbitrary 'struct index_state' pointer instead of using the_index and active_cache. These are good things that might be worth mentioning in the commit message. Thanks, -Stolee