2010-05-09 07:21:34 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='Examples from the git-notes man page
|
|
|
|
|
|
|
|
Make sure the manual is not full of lies.'
|
|
|
|
|
2022-08-02 18:33:13 +03:00
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
2010-05-09 07:21:34 +04:00
|
|
|
. ./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' '
|
2011-07-19 21:21:47 +04:00
|
|
|
cp "$TEST_DIRECTORY"/test-binary-1.png . &&
|
2010-05-09 07:21:34 +04:00
|
|
|
git checkout B &&
|
2011-07-19 21:21:47 +04:00
|
|
|
blob=$(git hash-object -w test-binary-1.png) &&
|
2010-05-09 07:21:34 +04:00
|
|
|
git notes --ref=logo add -C "$blob" &&
|
|
|
|
git notes --ref=logo copy B C &&
|
|
|
|
git notes --ref=logo show C >actual &&
|
2011-07-19 21:21:47 +04:00
|
|
|
test_cmp test-binary-1.png actual
|
2010-05-09 07:21:34 +04:00
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|