#!/bin/sh global test_description := ''Examples from the git-notes man page Make sure the manual is not full of lies.'' source ./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 EOF git notes add -m "Acked-by: A C Ker " 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"/test-binary-1.png . && git checkout B && blob=$(git hash-object -w test-binary-1.png) && git notes --ref=logo add -C "$blob" && git notes --ref=logo copy B C && git notes --ref=logo show C >actual && test_cmp test-binary-1.png actual ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: { (SQ <"Examples from the git-notes man page\n"> <"\n"> <"Make sure the manual is not full of lies."> ) } spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ )} {(SQ <"\n"> <"\ttest_commit A &&\n"> <"\ttest_commit B &&\n"> <"\ttest_commit C\n">)} ) (C {(test_expect_success)} {(SQ <"example 1: notes to add an Acked-by line">)} { (SQ <"\n"> <"\tcat <<-\\EOF >expect &&\n"> <"\t B\n"> <"\n"> <"\tNotes:\n"> <"\t Acked-by: A C Ker \n"> <"\tEOF\n"> <"\tgit notes add -m \"Acked-by: A C Ker \" B &&\n"> <"\tgit show -s B^{commit} >log &&\n"> <"\ttail -n 4 log >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"example 2: binary notes">)} { (SQ <"\n"> <"\tcp \"$TEST_DIRECTORY\"/test-binary-1.png . &&\n"> <"\tgit checkout B &&\n"> <"\tblob=$(git hash-object -w test-binary-1.png) &&\n"> <"\tgit notes --ref=logo add -C \"$blob\" &&\n"> <"\tgit notes --ref=logo copy B C &&\n"> <"\tgit notes --ref=logo show C >actual &&\n"> <"\ttest_cmp test-binary-1.png actual\n"> ) } ) (C {(test_done)}) ] )