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

Re: [PATCH v7 2/5] remove_subtree(): test removing nested directories

From
Stefan Beller <sbeller@google.com>
Date
Apr 3, 2017, 22:35 UTC
Message-ID
<CAGZ79kbrPjKV=Gi0AHHwSAS_DviysvpSd_6g-w-XuD0R3ceDwg@mail.gmail.com>
In-Reply-To
<1491163388-41255-3-git-send-email-bnmvco@gmail.com>
On Sun, Apr 2, 2017 at 1:03 PM, Daniel Ferreira <bnmvco@gmail.com> wrote:
Show 30 quoted lines
> Test removing a nested directory when an attempt is made to restore the
> index to a state where it does not exist. A similar test could be found
> previously in t/t2000-checkout-cache-clash.sh, but it did not check for
> nested directories, which could allow a faulty implementation of
> remove_subtree() pass the tests.
>
> Signed-off-by: Daniel Ferreira <bnmvco@gmail.com>
> ---
>  t/t2000-checkout-cache-clash.sh | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh
> index de3edb5..ac10ba3 100755
> --- a/t/t2000-checkout-cache-clash.sh
> +++ b/t/t2000-checkout-cache-clash.sh
> @@ -57,4 +57,15 @@ test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' '
>         git checkout-index -a -f --prefix=there/
>  '
>
> +test_expect_success 'git checkout-index -f should remove nested subtrees' '
> +       echo content >path &&
> +       git update-index --add path &&
> +       rm path &&
> +       mkdir -p path/with/nested/paths &&
> +       echo content >path/file1 &&
> +       echo content >path/with/nested/paths/file2 &&
> +       git checkout-index -f -a &&
> +       test ! -d path
> +'
> +
Looks good to me.

Thanks, Stefan

Previous: Daniel FerreiraNext: Daniel Ferreira
Message 5 of 13 in “[GSoC] remove_subtree(): reimplement using iterators”
  1. 0/5 [GSoC] remove_subtree(): reimplement using iteratorsDaniel Ferreira, Apr 2, 2017
  2. 1/5 dir_iterator: add tests for dir_iterator APIDaniel Ferreira, Apr 2, 2017
  3. Stefan BellerApr 3, 2017
  4. 2/5 remove_subtree(): test removing nested directoriesDaniel Ferreira, Apr 2, 2017
  5. Stefan BellerApr 3, 2017
  6. 3/5 dir_iterator: add helpers to dir_iterator_advanceDaniel Ferreira, Apr 2, 2017
  7. Stefan BellerApr 3, 2017
  8. 4/5 dir_iterator: refactor state machine modelDaniel Ferreira, Apr 2, 2017
  9. Michael HaggertyApr 3, 2017
  10. Daniel Ferreira (theiostream)Apr 3, 2017
  11. Michael HaggertyApr 4, 2017
  12. 5/5 remove_subtree(): reimplement using iteratorsDaniel Ferreira, Apr 2, 2017
  13. Michael HaggertyApr 3, 2017

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.