git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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 &&
?
Previous: Taylor Blau
Message 5 of 5 in “sparse-checkout: stop blocking empty workdirs”
  1. sparse-checkout: stop blocking empty workdirsDerrick Stolee via GitGitGadget, May 4, 2020
  2. Elijah NewrenMay 4, 2020
  3. Junio C HamanoMay 4, 2020
  4. Taylor BlauMay 4, 2020
  5. Christian CouderApr 13, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.