diff mbox series

[15/27] sparse-checkout: ensure full index

Message ID 92ccd31dd343c20bad4a6b8d89c50559209e7236.1615929436.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series Sparse Index: API protections | expand

Commit Message

Derrick Stolee March 16, 2021, 9:17 p.m. UTC
From: Derrick Stolee <dstolee@microsoft.com>

When adjusting the sparse-checkout definition, ensure that a sparse
index is expanded to a full one to avoid unexpected behavior. This is a
top candidate for later integration with the sparse-index, but requires
careful testing.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 builtin/stash.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Elijah Newren March 18, 2021, 5:22 a.m. UTC | #1
On Tue, Mar 16, 2021 at 2:17 PM Derrick Stolee via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Derrick Stolee <dstolee@microsoft.com>
>
> When adjusting the sparse-checkout definition, ensure that a sparse
> index is expanded to a full one to avoid unexpected behavior. This is a
> top candidate for later integration with the sparse-index, but requires
> careful testing.


I was going to comment on most of these collectively, but your commit
message is completely divorced from the patch; it appears you either
place the wrong commit message here or copied it from the one for a
sparse-checkout.  The code modifies stash, though.

> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> ---
>  builtin/stash.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/builtin/stash.c b/builtin/stash.c
> index ba774cce674f..b3d4fe814b6b 100644
> --- a/builtin/stash.c
> +++ b/builtin/stash.c
> @@ -1350,6 +1350,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
>                 int i;
>                 char *ps_matched = xcalloc(ps->nr, 1);
>
> +               ensure_full_index(&the_index);
>                 for (i = 0; i < active_nr; i++)
>                         ce_path_match(&the_index, active_cache[i], ps,
>                                       ps_matched);
> --
> gitgitgadget
Derrick Stolee March 23, 2021, 1:13 p.m. UTC | #2
On 3/18/2021 1:22 AM, Elijah Newren wrote:
> On Tue, Mar 16, 2021 at 2:17 PM Derrick Stolee via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>>
>> From: Derrick Stolee <dstolee@microsoft.com>
>>
>> When adjusting the sparse-checkout definition, ensure that a sparse
>> index is expanded to a full one to avoid unexpected behavior. This is a
>> top candidate for later integration with the sparse-index, but requires
>> careful testing.
> 
> 
> I was going to comment on most of these collectively, but your commit
> message is completely divorced from the patch; it appears you either
> place the wrong commit message here or copied it from the one for a
> sparse-checkout.  The code modifies stash, though.

Thanks for pointing this out. Must have been a bad squash during one
of many rebases.

-Stolee
diff mbox series

Patch

diff --git a/builtin/stash.c b/builtin/stash.c
index ba774cce674f..b3d4fe814b6b 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -1350,6 +1350,7 @@  static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
 		int i;
 		char *ps_matched = xcalloc(ps->nr, 1);
 
+		ensure_full_index(&the_index);
 		for (i = 0; i < active_nr; i++)
 			ce_path_match(&the_index, active_cache[i], ps,
 				      ps_matched);