Thread (21 messages) 21 messages, 3 authors, 2022-08-10

Re: [PATCH v1 2/4] pathspec.h: move pathspec_needs_expanded_index() from reset.c to here

From: Derrick Stolee <hidden>
Date: 2022-08-03 14:35:39

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help