]>
Commit | Line | Data |
---|---|---|
8d6888ec JN |
1 | #!/bin/sh |
2 | ||
3 | test_description='Examples from the git-notes man page | |
4 | ||
5 | Make sure the manual is not full of lies.' | |
6 | ||
055e57b7 | 7 | TEST_PASSES_SANITIZE_LEAK=true |
8d6888ec JN |
8 | . ./test-lib.sh |
9 | ||
10 | test_expect_success 'setup' ' | |
11 | test_commit A && | |
12 | test_commit B && | |
13 | test_commit C | |
14 | ' | |
15 | ||
16 | test_expect_success 'example 1: notes to add an Acked-by line' ' | |
17 | cat <<-\EOF >expect && | |
18 | B | |
19 | ||
20 | Notes: | |
21 | Acked-by: A C Ker <acker@example.com> | |
22 | EOF | |
23 | git notes add -m "Acked-by: A C Ker <acker@example.com>" B && | |
24 | git show -s B^{commit} >log && | |
25 | tail -n 4 log >actual && | |
26 | test_cmp expect actual | |
27 | ' | |
28 | ||
29 | test_expect_success 'example 2: binary notes' ' | |
b5967f82 | 30 | cp "$TEST_DIRECTORY"/test-binary-1.png . && |
8d6888ec | 31 | git checkout B && |
b5967f82 | 32 | blob=$(git hash-object -w test-binary-1.png) && |
8d6888ec JN |
33 | git notes --ref=logo add -C "$blob" && |
34 | git notes --ref=logo copy B C && | |
35 | git notes --ref=logo show C >actual && | |
b5967f82 | 36 | test_cmp test-binary-1.png actual |
8d6888ec JN |
37 | ' |
38 | ||
39 | test_done |