Re: [PATCH v5 15/17] sparse-checkout: update working directory in-process
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Nov 19, 2019, 17:07 UTC
- Message-ID
- <20191119170751.GI23183@szeder.dev>
- In-Reply-To
- <d7af75672ba20ed208d51a35243b96ce10202a54.1571666187.git.gitgitgadget@gmail.com>
On Mon, Oct 21, 2019 at 01:56:24PM +0000, Derrick Stolee via GitGitGadget wrote:
Show 12 quoted lines
> From: Derrick Stolee <dstolee@microsoft.com> > > The sparse-checkout builtin used 'git read-tree -mu HEAD' to update the > skip-worktree bits in the index and to update the working directory. > This extra process is overly complex, and prone to failure. It also > requires that we write our changes to the sparse-checkout file before > trying to update the index. > > Remove this extra process call by creating a direct call to > unpack_trees() in the same way 'git read-tree -mu HEAD' does. In > addition, provide an in-memory list of patterns so we can avoid > reading from the sparse-checkout file.
OK, the way I understand the above two paragraphs is that after this patch it won't be necessary to write the updated patterns to the 'sparse-checkout' file before calling unpack_trees(), and to me it implies that it won't be necessary to write the "include everything" pattern to that file during disabling sparse checkout.
> @@ -378,7 +436,8 @@ static int sparse_checkout_disable(int argc, const char **argv) > fprintf(fp, "/*\n"); > fclose(fp);
However, as the patch context here shows we still write that "include everything" pattern to the 'sparse-checkout' file during disabling.
FWIW, deleting those lines updating the 'sparse-checkout' file make the 'sparse-checkout disable' test fail.
Did I misunderstand what the commit message is trying to say?
Show 6 quoted lines
> - if (update_working_directory())
> + core_apply_sparse_checkout = 1;
> + if (update_working_directory(NULL))
> die(_("error while refreshing working directory"));
>
> unlink(sparse_filename);