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

Re: [PATCH 1/2] t9300: test filedelete root

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 28, 2014, 22:30 UTC
Message-ID
<xmqqa96o8cxa.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1409237674-74185-2-git-send-email-satori@yandex-team.ru>
Maxim Bublis <satori@yandex-team.ru> writes:
> Add new fast-import test series for filedelete command.
>
> Signed-off-by: Maxim Bublis <satori@yandex-team.ru>
> ---

You may have been concentrating on the "delete root" case, but as long as you claim "We add a series to test filedelete command", it would be sensible to test more typical cases of deleting files, not the entire tree as well, no? Perhaps add three paths in the initial commit e.g. hello.c, good/night.txt and good/bye.txt, first remove good/night.txt and validate the result, then remove good/ directory and validate the result, and finally remove the whole thing and validate the result, or something like that?

In a patch series that introduces a demonstration of existing breakage and then fixes the breakage in a separate patch, mark the test that shows the known breakage with test_expect_failure and then turn that line into test_expect_success in the later patch that fixes the breakage.

What the test checks and the fix in 2/2 both looked sensible from a cursory read.

Thanks.
Show 58 quoted lines
>  t/t9300-fast-import.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
>
> diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
> index 5fc9ef2..3d557b3 100755
> --- a/t/t9300-fast-import.sh
> +++ b/t/t9300-fast-import.sh
> @@ -3017,4 +3017,50 @@ test_expect_success 'T: empty reset doesnt delete branch' '
>  	git rev-parse --verify refs/heads/not-to-delete
>  '
>  
> +###
> +### series U (filedelete)
> +###
> +
> +cat >input <<INPUT_END
> +commit refs/heads/U
> +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
> +data <<COMMIT
> +test setup
> +COMMIT
> +M 100644 inline hello.c
> +data <<BLOB
> +blob 1
> +BLOB
> +
> +INPUT_END
> +
> +test_expect_success 'U: initialize for U tests' '
> +	git fast-import <input
> +'
> +
> +cat >input <<INPUT_END
> +commit refs/heads/U
> +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
> +data <<COMMIT
> +must succeed
> +COMMIT
> +from refs/heads/U^0
> +D ""
> +
> +INPUT_END
> +
> +test_expect_success 'U: filedelete root succeeds' '
> +    git fast-import <input
> +'
> +
> +cat >expect <<EOF
> +:100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D	hello.c
> +EOF
> +
> +git diff-tree -M -r U^1 U >actual
> +
> +test_expect_success 'U: validate filedelete result' '
> +	compare_diff_raw expect actual
> +'
> +
>  test_done
Previous: Maxim BublisNext: Maxim Bublis
Message 3 of 7 in “fast-import: fix segfault and tests”
  1. 0/2 fast-import: fix segfault and testsMaxim Bublis, Aug 28, 2014
  2. 1/2 t9300: test filedelete rootMaxim Bublis, Aug 28, 2014
  3. Junio C HamanoAug 28, 2014
  4. Maxim BublisAug 29, 2014
  5. 2/2 fast-import: fix segfault in store_tree()Maxim Bublis, Aug 28, 2014
  6. Junio C HamanoAug 28, 2014
  7. Maxim BublisAug 29, 2014

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.