mirror of
https://github.com/git/git
synced 2024-10-30 04:01:21 +00:00
a48fcd8369
Breaks in a test assertion's && chain can potentially hide failures from earlier commands in the chain. Commands intended to fail should be marked with !, test_must_fail, or test_might_fail. The examples in this patch do not require that. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
38 lines
821 B
Bash
Executable file
38 lines
821 B
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='Examples from the git-notes man page
|
|
|
|
Make sure the manual is not full of lies.'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'setup' '
|
|
test_commit A &&
|
|
test_commit B &&
|
|
test_commit C
|
|
'
|
|
|
|
test_expect_success 'example 1: notes to add an Acked-by line' '
|
|
cat <<-\EOF >expect &&
|
|
B
|
|
|
|
Notes:
|
|
Acked-by: A C Ker <acker@example.com>
|
|
EOF
|
|
git notes add -m "Acked-by: A C Ker <acker@example.com>" B &&
|
|
git show -s B^{commit} >log &&
|
|
tail -n 4 log >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'example 2: binary notes' '
|
|
cp "$TEST_DIRECTORY"/test4012.png . &&
|
|
git checkout B &&
|
|
blob=$(git hash-object -w test4012.png) &&
|
|
git notes --ref=logo add -C "$blob" &&
|
|
git notes --ref=logo copy B C &&
|
|
git notes --ref=logo show C >actual &&
|
|
test_cmp test4012.png actual
|
|
'
|
|
|
|
test_done
|