Re: [PATCH] sparse-checkout: stop blocking empty workdirs
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Apr 13, 2021, 04:55 UTC
- Message-ID
- <CAP8UFD13-osOHU7Ug_2iToQZyx2T2neOXzZB=ssmDZLEQoF4eg@mail.gmail.com>
- In-Reply-To
- <pull.624.git.1588616864222.gitgitgadget@gmail.com>
On Mon, May 4, 2020 at 8:30 PM Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 8 quoted lines
> @@ -302,8 +300,8 @@ test_expect_success 'revert to old sparse-checkout on empty update' ' > echo >file && > git add file && > git commit -m "test" && > - test_must_fail git sparse-checkout set nothing 2>err && > - test_i18ngrep "Sparse checkout leaves no entry on working directory" err && > + git sparse-checkout set nothing 2>err && > + test_i18ngrep ! "Sparse checkout leaves no entry on working directory" err &&
It looks like this check is obsolete as the "Sparse checkout leaves no entry on working directory" error has been removed by this patch below...
> test_i18ngrep ! ".git/index.lock" err && > git sparse-checkout set file > )
[...]
Show 16 quoted lines
> @@ -1706,19 +1704,6 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
>
> if (apply_sparse_checkout(&o->result, ce, o))
> ret = 1;
> -
> - if (!ce_skip_worktree(ce))
> - empty_worktree = 0;
> - }
> - /*
> - * Sparse checkout is meant to narrow down checkout area
> - * but it does not make sense to narrow down to empty working
> - * tree. This is usually a mistake in sparse checkout rules.
> - * Do not allow users to do that.
> - */
> - if (o->result.cache_nr && empty_worktree) {
> - ret = unpack_failed(o, "Sparse checkout leaves no entry on working directory");...here...
> - goto done;
> }
> if (ret == 1) {
> /*[...]
Show 17 quoted lines
> @@ -1824,28 +1808,12 @@ enum update_sparsity_result update_sparsity(struct unpack_trees_options *o)
>
> if (apply_sparse_checkout(o->src_index, ce, o))
> ret = UPDATE_SPARSITY_WARNINGS;
> -
> - if (!ce_skip_worktree(ce))
> - empty_worktree = 0;
> - }
> -
> - /*
> - * Sparse checkout is meant to narrow down checkout area
> - * but it does not make sense to narrow down to empty working
> - * tree. This is usually a mistake in sparse checkout rules.
> - * Do not allow users to do that.
> - */
> - if (o->src_index->cache_nr && empty_worktree) {
> - unpack_failed(o, "Sparse checkout leaves no entry on working directory");...and here.
> - ret = UPDATE_SPARSITY_INDEX_UPDATE_FAILURES; > - goto done; > }
So maybe instead of the 3 lines below:
> + git sparse-checkout set nothing 2>err && > + test_i18ngrep ! "Sparse checkout leaves no entry on working directory" err && > test_i18ngrep ! ".git/index.lock" err &&
we should just have:
git sparse-checkout set nothing &&
?