Skip to content

Commit d0923b6

Browse files
jherlandgitster
authored andcommitted
t3301: verify that 'git notes' removes empty notes by default
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 <[email protected]> Improved-by: Junio C Hamano <[email protected]> Signed-off-by: Johan Herland <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 511726e commit d0923b6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

t/t3301-notes.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,4 +1239,31 @@ test_expect_success 'git notes get-ref (--ref)' '
12391239
test "$(GIT_NOTES_REF=refs/notes/bar git notes --ref=baz get-ref)" = "refs/notes/baz"
12401240
'
12411241

1242+
test_expect_success 'setup testing of empty notes' '
1243+
test_unconfig core.notesRef &&
1244+
test_commit 16th &&
1245+
empty_blob=$(git hash-object -w /dev/null)
1246+
'
1247+
1248+
while read cmd
1249+
do
1250+
test_expect_success "'git notes $cmd' removes empty note" "
1251+
test_might_fail git notes remove HEAD &&
1252+
MSG= git notes $cmd &&
1253+
test_must_fail git notes list HEAD
1254+
"
1255+
done <<\EOF
1256+
add
1257+
add -F /dev/null
1258+
add -m ""
1259+
add -c "$empty_blob"
1260+
add -C "$empty_blob"
1261+
append
1262+
append -F /dev/null
1263+
append -m ""
1264+
append -c "$empty_blob"
1265+
append -C "$empty_blob"
1266+
edit
1267+
EOF
1268+
12421269
test_done

0 commit comments

Comments
 (0)