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

Re: [PATCHv3 2/5] t3301: Verify that 'git notes' removes empty notes by default

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 7, 2014, 17:48 UTC
Message-ID
<xmqq61eqhpgv.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1415351961-31567-3-git-send-email-johan@herland.net>
Johan Herland <johan@herland.net> writes:
Show 21 quoted lines
> Add test cases documenting the current behavior when trying to
> add/append/edit empty notes. This is in preparation for adding
> --allow-empty; to allow empty notes to be stored.
>
> Improved-by: Eric Sunshine <sunshine@sunshineco.com>
> Improved-by: Junio C Hamano <gitster@pobox.com>
> Signed-off-by: Johan Herland <johan@herland.net>
> ---
>  t/t3301-notes.sh | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>
> diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
> index cfd67ff..33f0558 100755
> --- a/t/t3301-notes.sh
> +++ b/t/t3301-notes.sh
> @@ -1239,4 +1239,31 @@ test_expect_success 'git notes get-ref (--ref)' '
>  	test "$(GIT_NOTES_REF=refs/notes/bar git notes --ref=baz get-ref)" = "refs/notes/baz"
>  '
>  
> +test_expect_success 'setup testing of empty notes' '
> +	git config --unset core.notesRef &&
Use "test_unconfig" instead?

If the previous test failed (or a different topic that touches this same script is merged to change what the previous test leaves), this configuration variable may not be set, and "config --unset" may fail.

Show 26 quoted lines
> +	test_commit 16th &&
> +	empty_blob=$(git hash-object -w /dev/null)
> +'
> +
> +while read cmd
> +do
> +	test_expect_success "'git notes $cmd' removes empty note" "
> +		test_might_fail git notes remove HEAD &&
> +		MSG= git notes $cmd &&
> +		test_must_fail git notes list HEAD
> +	"
> +done <<\EOF
> +add
> +add -F /dev/null
> +add -m ""
> +add -c "$empty_blob"
> +add -C "$empty_blob"
> +append
> +append -F /dev/null
> +append -m ""
> +append -c "$empty_blob"
> +append -C "$empty_blob"
> +edit
> +EOF
> +
>  test_done
Previous: Johan HerlandNext: Johan Herland
Message 4 of 12 in “[PATCHv3 0/5] Handling empty notes”
  1. Johan HerlandNov 7, 2014
  2. 1/5 builtin/notes: Fix premature failure when trying to add the empty blobJohan Herland, Nov 7, 2014
  3. 2/5 t3301: Verify that 'git notes' removes empty notes by defaultJohan Herland, Nov 7, 2014
  4. Junio C HamanoNov 7, 2014
  5. 3/5 builtin/notes: Add --allow-empty, to allow storing empty notesJohan Herland, Nov 7, 2014
  6. Junio C HamanoNov 7, 2014
  7. Johan HerlandNov 9, 2014
  8. Junio C HamanoNov 10, 2014
  9. 4/5 notes: Empty notes should be shown by 'git log'Johan Herland, Nov 7, 2014
  10. Junio C HamanoNov 7, 2014
  11. 5/5 t3301: Use write_script(), nitpick whitespaceJohan Herland, Nov 7, 2014
  12. Junio C HamanoNov 7, 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.