(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"Test commit notes">)} spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (SimpleCommand words: [{(write_script)} {(fake_editor)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: {("echo \"$MSG\" >\"$1\"\n") ("echo \"$MSG\" >&2\n")} do_expansion: False here_end: EOF was_filled: True spids: [28] ) ] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:GIT_EDITOR) op:Equal rhs:{(./fake_editor)} spids:[32])] spids: [32] ) (C {(export)} {(GIT_EDITOR)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:indent) op:Equal rhs:{(DQ (" "))} spids:[40])] spids: [40] ) (C {(test_expect_success)} {(SQ <"cannot annotate non-existing HEAD">)} {(SQ <"\n"> <"\ttest_must_fail env MSG=3 git notes add\n">)} ) (C {(test_expect_success)} {(SQ <setup>)} {(SQ <"\n"> <"\ttest_commit 1st &&\n"> <"\ttest_commit 2nd\n">)} ) (C {(test_expect_success)} {(SQ <"need valid notes ref">)} { (SQ <"\n"> <"\ttest_must_fail env MSG=1 GIT_NOTES_REF=/ git notes show &&\n"> <"\ttest_must_fail env MSG=2 GIT_NOTES_REF=/ git notes show\n"> ) } ) (C {(test_expect_success)} {(SQ <"refusing to add notes in refs/heads/">)} {(SQ <"\n"> <"\ttest_must_fail env MSG=1 GIT_NOTES_REF=refs/heads/bogus git notes add\n">)} ) (C {(test_expect_success)} {(SQ <"refusing to edit notes in refs/remotes/">)} {(SQ <"\n"> <"\ttest_must_fail env MSG=1 GIT_NOTES_REF=refs/heads/bogus git notes edit\n">)} ) (C {(test_expect_success)} {(SQ <"handle empty notes gracefully">)} {(SQ <"\n"> <"\ttest_expect_code 1 git notes show\n">)} ) (C {(test_expect_success)} {(SQ <"show non-existent notes entry with %N">)} { (SQ <"\n"> <"\ttest_write_lines A B >expect &&\n"> <"\tgit show -s --format=\"A%n%NB\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"create notes">)} { (SQ <"\n"> <"\tMSG=b4 git notes add &&\n"> <"\ttest_path_is_missing .git/NOTES_EDITMSG &&\n"> <"\tgit ls-tree -r refs/notes/commits >actual &&\n"> <"\ttest_line_count = 1 actual &&\n"> <"\ttest \"b4\" = \"$(git notes show)\" &&\n"> <"\tgit show HEAD^ &&\n"> <"\ttest_must_fail git notes show HEAD^\n"> ) } ) (C {(test_expect_success)} {(SQ <"show notes entry with %N">)} { (SQ <"\n"> <"\ttest_write_lines A b4 B >expect &&\n"> <"\tgit show -s --format=\"A%n%NB\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"create reflog entry">)} { (SQ <"\n"> <"\tcat <<-EOF >expect &&\n"> <"\t\ta1d8fa6 refs/notes/commits@{0}: notes: Notes added by "> ) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <"git notes add">) (EscapedLiteralPart token:<Lit_EscapedChar "\\'">) (SQ <"\n"> <"\tEOF\n"> <"\tgit reflog show refs/notes/commits >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"edit existing notes">)} { (SQ <"\n"> <"\tMSG=b3 git notes edit &&\n"> <"\ttest_path_is_missing .git/NOTES_EDITMSG &&\n"> <"\tgit ls-tree -r refs/notes/commits >actual &&\n"> <"\ttest_line_count = 1 actual &&\n"> <"\ttest \"b3\" = \"$(git notes show)\" &&\n"> <"\tgit show HEAD^ &&\n"> <"\ttest_must_fail git notes show HEAD^\n"> ) } ) (C {(test_expect_success)} {(SQ <"show notes from treeish">)} { (SQ <"\n"> <"\ttest \"b3\" = \"$(git notes --ref commits^{tree} show)\" &&\n"> <"\ttest \"b4\" = \"$(git notes --ref commits@{1} show)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cannot edit notes from non-ref">)} { (SQ <"\n"> <"\ttest_must_fail git notes --ref commits^{tree} edit &&\n"> <"\ttest_must_fail git notes --ref commits@{1} edit\n"> ) } ) (C {(test_expect_success)} {(SQ <"cannot \"git notes add -m\" where notes already exists">)} { (SQ <"\n"> <"\ttest_must_fail git notes add -m \"b2\" &&\n"> <"\ttest_path_is_missing .git/NOTES_EDITMSG &&\n"> <"\tgit ls-tree -r refs/notes/commits >actual &&\n"> <"\ttest_line_count = 1 actual &&\n"> <"\ttest \"b3\" = \"$(git notes show)\" &&\n"> <"\tgit show HEAD^ &&\n"> <"\ttest_must_fail git notes show HEAD^\n"> ) } ) (C {(test_expect_success)} {(SQ <"can overwrite existing note with \"git notes add -f -m\"">)} { (SQ <"\n"> <"\tgit notes add -f -m \"b1\" &&\n"> <"\ttest_path_is_missing .git/NOTES_EDITMSG &&\n"> <"\tgit ls-tree -r refs/notes/commits >actual &&\n"> <"\ttest_line_count = 1 actual &&\n"> <"\ttest \"b1\" = \"$(git notes show)\" &&\n"> <"\tgit show HEAD^ &&\n"> <"\ttest_must_fail git notes show HEAD^\n"> ) } ) (C {(test_expect_success)} {(SQ <"add w/no options on existing note morphs into edit">)} { (SQ <"\n"> <"\tMSG=b2 git notes add &&\n"> <"\ttest_path_is_missing .git/NOTES_EDITMSG &&\n"> <"\tgit ls-tree -r refs/notes/commits >actual &&\n"> <"\ttest_line_count = 1 actual &&\n"> <"\ttest \"b2\" = \"$(git notes show)\" &&\n"> <"\tgit show HEAD^ &&\n"> <"\ttest_must_fail git notes show HEAD^\n"> ) } ) (C {(test_expect_success)} {(SQ <"can overwrite existing note with \"git notes add -f\"">)} { (SQ <"\n"> <"\tMSG=b1 git notes add -f &&\n"> <"\ttest_path_is_missing .git/NOTES_EDITMSG &&\n"> <"\tgit ls-tree -r refs/notes/commits >actual &&\n"> <"\ttest_line_count = 1 actual &&\n"> <"\ttest \"b1\" = \"$(git notes show)\" &&\n"> <"\tgit show HEAD^ &&\n"> <"\ttest_must_fail git notes show HEAD^\n"> ) } ) (C {(test_expect_success)} {(SQ <"show notes">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 7a4ca6ee52a974a66cbaa78e33214535dff1d691\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:14:13 2005 -0700\n"> <"\n"> <"\t\t${indent}2nd\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}b1\n"> <"\tEOF\n"> <"\t! (git cat-file commit HEAD | grep b1) &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"show multi-line notes">)} { (SQ <"\n"> <"\ttest_commit 3rd &&\n"> <"\tMSG=\"b3${LF}c3c3c3c3${LF}d3d3d3\" git notes add &&\n"> <"\tcat >expect-multiline <<-EOF &&\n"> <"\t\tcommit d07d62e5208f22eb5695e7eb47667dc8b9860290\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:15:13 2005 -0700\n"> <"\n"> <"\t\t${indent}3rd\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}b3\n"> <"\t\t${indent}c3c3c3c3\n"> <"\t\t${indent}d3d3d3\n"> <"\n"> <"\tEOF\n"> <"\tcat expect >>expect-multiline &&\n"> <"\tgit log -2 >actual &&\n"> <"\ttest_cmp expect-multiline actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"show -F notes">)} { (SQ <"\n"> <"\ttest_commit 4th &&\n"> <"\techo \"xyzzy\" >note5 &&\n"> <"\tgit notes add -F note5 &&\n"> <"\tcat >expect-F <<-EOF &&\n"> <"\t\tcommit 0f7aa3ec6325aeb88b910453bb3eb37c49d75c11\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:16:13 2005 -0700\n"> <"\n"> <"\t\t${indent}4th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}xyzzy\n"> <"\n"> <"\tEOF\n"> <"\tcat expect-multiline >>expect-F &&\n"> <"\tgit log -3 >actual &&\n"> <"\ttest_cmp expect-F actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Re-adding -F notes without -f fails">)} { (SQ <"\n"> <"\techo \"zyxxy\" >note5 &&\n"> <"\ttest_must_fail git notes add -F note5 &&\n"> <"\tgit log -3 >actual &&\n"> <"\ttest_cmp expect-F actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git log --pretty=raw does not show notes">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 0f7aa3ec6325aeb88b910453bb3eb37c49d75c11\n"> <"\t\ttree 05ac65288c4c4b3b709a020ae94b2ece2f2201ae\n"> <"\t\tparent d07d62e5208f22eb5695e7eb47667dc8b9860290\n"> <"\t\tauthor A U Thor <author@example.com> 1112912173 -0700\n"> <"\t\tcommitter C O Mitter <committer@example.com> 1112912173 -0700\n"> <"\n"> <"\t\t${indent}4th\n"> <"\tEOF\n"> <"\tgit log -1 --pretty=raw >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git log --show-notes">)} { (SQ <"\n"> <"\tcat >>expect <<-EOF &&\n"> <"\n"> <"\tNotes:\n"> <"\t${indent}xyzzy\n"> <"\tEOF\n"> <"\tgit log -1 --pretty=raw --show-notes >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git log --no-notes">)} {(SQ <"\n"> <"\tgit log -1 --no-notes >actual &&\n"> <"\t! grep xyzzy actual\n">)} ) (C {(test_expect_success)} {(SQ <"git format-patch does not show notes">)} {(SQ <"\n"> <"\tgit format-patch -1 --stdout >actual &&\n"> <"\t! grep xyzzy actual\n">)} ) (C {(test_expect_success)} {(SQ <"git format-patch --show-notes does show notes">)} { (SQ <"\n"> <"\tgit format-patch --show-notes -1 --stdout >actual &&\n"> <"\tgrep xyzzy actual\n"> ) } ) (ForEach iter_name: pretty iter_words: [ {(DQ )} {(--pretty)} {(--pretty) (Lit_Other "=") (raw)} {(--pretty) (Lit_Other "=") (short)} {(--pretty) (Lit_Other "=") (medium)} {(--pretty) (Lit_Other "=") (full)} {(--pretty) (Lit_Other "=") (fuller)} {(--pretty) (Lit_Other "=") (format) (Lit_Other ":") (Lit_Other "%") (s)} {(--oneline)} ] do_arg_iter: False body: (DoGroup children: [ (Case to_match: {(DQ ($ VSub_Name "$pretty"))} arms: [ (case_arm pat_list: [{(DQ )}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:p) op: Equal rhs: {(SQ )} spids: [544] ) (assign_pair lhs: (LhsName name:not) op: Equal rhs: {(SQ )} spids: [546] ) (assign_pair lhs: (LhsName name:negate) op: Equal rhs: {(DQ )} spids: [548] ) ] spids: [544] ) ] spids: [-1 542 552 -1] ) (case_arm pat_list: [{(Lit_Other "?") (Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:p) op: Equal rhs: {(DQ ($ VSub_Name "$pretty"))} spids: [559] ) (assign_pair lhs: (LhsName name:not) op: Equal rhs: {(DQ (" not"))} spids: [564] ) (assign_pair lhs: (LhsName name:negate) op: Equal rhs: {(DQ ("!"))} spids: [569] ) ] spids: [559] ) ] spids: [555 557 574 -1] ) ] spids: [531 537 577] ) (C {(test_expect_success)} { (DQ ("git show ") ($ VSub_Name "$pretty") (" does") ($ VSub_Name "$not") (" show notes")) } {(SQ <"\n"> <"\t\tgit show $p >actual &&\n"> <"\t\teval \"$negate grep xyzzy actual\"\n"> <"\t">)} ) ] spids: [528 597] ) spids: [489 -1] ) (C {(test_expect_success)} {(SQ <"setup alternate notes ref">)} {(SQ <"\n"> <"\tgit notes --ref=alternate add -m alternate\n">)} ) (C {(test_expect_success)} {(SQ <"git log --notes shows default notes">)} { (SQ <"\n"> <"\tgit log -1 --notes >actual &&\n"> <"\tgrep xyzzy actual &&\n"> <"\t! grep alternate actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git log --notes=X shows only X">)} { (SQ <"\n"> <"\tgit log -1 --notes=alternate >actual &&\n"> <"\t! grep xyzzy actual &&\n"> <"\tgrep alternate actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git log --notes --notes=X shows both">)} { (SQ <"\n"> <"\tgit log -1 --notes --notes=alternate >actual &&\n"> <"\tgrep xyzzy actual &&\n"> <"\tgrep alternate actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git log --no-notes resets default state">)} { (SQ <"\n"> <"\tgit log -1 --notes --notes=alternate \\\n"> <"\t\t--no-notes --notes=alternate \\\n"> <"\t\t>actual &&\n"> <"\t! grep xyzzy actual &&\n"> <"\tgrep alternate actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git log --no-notes resets ref list">)} { (SQ <"\n"> <"\tgit log -1 --notes --notes=alternate \\\n"> <"\t\t--no-notes --notes \\\n"> <"\t\t>actual &&\n"> <"\tgrep xyzzy actual &&\n"> <"\t! grep alternate actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"show -m notes">)} { (SQ <"\n"> <"\ttest_commit 5th &&\n"> <"\tgit notes add -m spam -m \"foo${LF}bar${LF}baz\" &&\n"> <"\tcat >expect-m <<-EOF &&\n"> <"\t\tcommit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:17:13 2005 -0700\n"> <"\n"> <"\t\t${indent}5th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}spam\n"> <"\t\t${indent}\n"> <"\t\t${indent}foo\n"> <"\t\t${indent}bar\n"> <"\t\t${indent}baz\n"> <"\n"> <"\tEOF\n"> <"\tcat expect-F >>expect-m &&\n"> <"\tgit log -4 >actual &&\n"> <"\ttest_cmp expect-m actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"remove note with add -f -F /dev/null">)} { (SQ <"\n"> <"\tgit notes add -f -F /dev/null &&\n"> <"\tcat >expect-rm-F <<-EOF &&\n"> <"\t\tcommit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:17:13 2005 -0700\n"> <"\n"> <"\t\t${indent}5th\n"> <"\n"> <"\tEOF\n"> <"\tcat expect-F >>expect-rm-F &&\n"> <"\tgit log -4 >actual &&\n"> <"\ttest_cmp expect-rm-F actual &&\n"> <"\ttest_must_fail git notes show\n"> ) } ) (C {(test_expect_success)} {(SQ <"do not create empty note with -m \"\"">)} { (SQ <"\n"> <"\tgit notes add -m \"\" &&\n"> <"\tgit log -4 >actual &&\n"> <"\ttest_cmp expect-rm-F actual &&\n"> <"\ttest_must_fail git notes show\n"> ) } ) (C {(test_expect_success)} {(SQ <"create note with combination of -m and -F">)} { (SQ <"\n"> <"\tcat >expect-combine_m_and_F <<-EOF &&\n"> <"\t\tfoo\n"> <"\n"> <"\t\txyzzy\n"> <"\n"> <"\t\tbar\n"> <"\n"> <"\t\tzyxxy\n"> <"\n"> <"\t\tbaz\n"> <"\tEOF\n"> <"\techo \"xyzzy\" >note_a &&\n"> <"\techo \"zyxxy\" >note_b &&\n"> <"\tgit notes add -m \"foo\" -F note_a -m \"bar\" -F note_b -m \"baz\" &&\n"> <"\tgit notes show >actual &&\n"> <"\ttest_cmp expect-combine_m_and_F actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"remove note with \"git notes remove\"">)} { (SQ <"\n"> <"\tgit notes remove HEAD^ &&\n"> <"\tgit notes remove &&\n"> <"\tcat >expect-rm-remove <<-EOF &&\n"> <"\t\tcommit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:17:13 2005 -0700\n"> <"\n"> <"\t\t${indent}5th\n"> <"\n"> <"\t\tcommit 0f7aa3ec6325aeb88b910453bb3eb37c49d75c11\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:16:13 2005 -0700\n"> <"\n"> <"\t\t${indent}4th\n"> <"\n"> <"\tEOF\n"> <"\tcat expect-multiline >>expect-rm-remove &&\n"> <"\tgit log -4 >actual &&\n"> <"\ttest_cmp expect-rm-remove actual &&\n"> <"\ttest_must_fail git notes show HEAD^\n"> ) } ) (C {(test_expect_success)} {(SQ <"removing non-existing note should not create new commit">)} { (SQ <"\n"> <"\tgit rev-parse --verify refs/notes/commits >before_commit &&\n"> <"\ttest_must_fail git notes remove HEAD^ &&\n"> <"\tgit rev-parse --verify refs/notes/commits >after_commit &&\n"> <"\ttest_cmp before_commit after_commit\n"> ) } ) (C {(test_expect_success)} {(SQ <"removing more than one">)} { (SQ <"\n"> <"\tbefore=$(git rev-parse --verify refs/notes/commits) &&\n"> <"\ttest_when_finished \"git update-ref refs/notes/commits $before\" &&\n"> <"\n"> <"\t# We have only two -- add another and make sure it stays\n"> <"\tgit notes add -m \"extra\" &&\n"> <"\tgit notes list HEAD >after-removal-expect &&\n"> <"\tgit notes remove HEAD^^ HEAD^^^ &&\n"> <"\tgit notes list | sed -e \"s/ .*//\" >actual &&\n"> <"\ttest_cmp after-removal-expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"removing is atomic">)} { (SQ <"\n"> <"\tbefore=$(git rev-parse --verify refs/notes/commits) &&\n"> <"\ttest_when_finished \"git update-ref refs/notes/commits $before\" &&\n"> <"\ttest_must_fail git notes remove HEAD^^ HEAD^^^ HEAD^ &&\n"> <"\tafter=$(git rev-parse --verify refs/notes/commits) &&\n"> <"\ttest \"$before\" = \"$after\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"removing with --ignore-missing">)} { (SQ <"\n"> <"\tbefore=$(git rev-parse --verify refs/notes/commits) &&\n"> <"\ttest_when_finished \"git update-ref refs/notes/commits $before\" &&\n"> <"\n"> <"\t# We have only two -- add another and make sure it stays\n"> <"\tgit notes add -m \"extra\" &&\n"> <"\tgit notes list HEAD >after-removal-expect &&\n"> <"\tgit notes remove --ignore-missing HEAD^^ HEAD^^^ HEAD^ &&\n"> <"\tgit notes list | sed -e \"s/ .*//\" >actual &&\n"> <"\ttest_cmp after-removal-expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"removing with --ignore-missing but bogus ref">)} { (SQ <"\n"> <"\tbefore=$(git rev-parse --verify refs/notes/commits) &&\n"> <"\ttest_when_finished \"git update-ref refs/notes/commits $before\" &&\n"> <"\ttest_must_fail git notes remove --ignore-missing HEAD^^ HEAD^^^ NO-SUCH-COMMIT &&\n"> <"\tafter=$(git rev-parse --verify refs/notes/commits) &&\n"> <"\ttest \"$before\" = \"$after\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"remove reads from --stdin">)} { (SQ <"\n"> <"\tbefore=$(git rev-parse --verify refs/notes/commits) &&\n"> <"\ttest_when_finished \"git update-ref refs/notes/commits $before\" &&\n"> <"\n"> <"\t# We have only two -- add another and make sure it stays\n"> <"\tgit notes add -m \"extra\" &&\n"> <"\tgit notes list HEAD >after-removal-expect &&\n"> <"\tgit rev-parse HEAD^^ HEAD^^^ >input &&\n"> <"\tgit notes remove --stdin <input &&\n"> <"\tgit notes list | sed -e \"s/ .*//\" >actual &&\n"> <"\ttest_cmp after-removal-expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"remove --stdin is also atomic">)} { (SQ <"\n"> <"\tbefore=$(git rev-parse --verify refs/notes/commits) &&\n"> <"\ttest_when_finished \"git update-ref refs/notes/commits $before\" &&\n"> <"\tgit rev-parse HEAD^^ HEAD^^^ HEAD^ >input &&\n"> <"\ttest_must_fail git notes remove --stdin <input &&\n"> <"\tafter=$(git rev-parse --verify refs/notes/commits) &&\n"> <"\ttest \"$before\" = \"$after\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"removing with --stdin --ignore-missing">)} { (SQ <"\n"> <"\tbefore=$(git rev-parse --verify refs/notes/commits) &&\n"> <"\ttest_when_finished \"git update-ref refs/notes/commits $before\" &&\n"> <"\n"> <"\t# We have only two -- add another and make sure it stays\n"> <"\tgit notes add -m \"extra\" &&\n"> <"\tgit notes list HEAD >after-removal-expect &&\n"> <"\tgit rev-parse HEAD^^ HEAD^^^ HEAD^ >input &&\n"> <"\tgit notes remove --ignore-missing --stdin <input &&\n"> <"\tgit notes list | sed -e \"s/ .*//\" >actual &&\n"> <"\ttest_cmp after-removal-expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"list notes with \"git notes list\"">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t\tc9c6af7f78bc47490dbf3e822cf2f3c24d4b9061 7a4ca6ee52a974a66cbaa78e33214535dff1d691\n" > <"\t\tc18dc024e14f08d18d14eea0d747ff692d66d6a3 d07d62e5208f22eb5695e7eb47667dc8b9860290\n"> <"\tEOF\n"> <"\tgit notes list >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"list notes with \"git notes\"">)} {(SQ <"\n"> <"\tgit notes >actual &&\n"> <"\ttest_cmp expect actual\n">)} ) (C {(test_expect_success)} {(SQ <"list specific note with \"git notes list <object>\"">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tc18dc024e14f08d18d14eea0d747ff692d66d6a3\n"> <"\tEOF\n"> <"\tgit notes list HEAD^^ >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"listing non-existing notes fails">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tEOF\n"> <"\ttest_must_fail git notes list HEAD >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"append to existing note with \"git notes append\"">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tInitial set of notes\n"> <"\n"> <"\t\tMore notes appended with git notes append\n"> <"\tEOF\n"> <"\tgit notes add -m \"Initial set of notes\" &&\n"> <"\tgit notes append -m \"More notes appended with git notes append\" &&\n"> <"\tgit notes show >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"\"git notes list\" does not expand to \"git notes list HEAD\"">)} { (SQ <"\n"> <"\tcat >expect_list <<-EOF &&\n"> < "\t\tc9c6af7f78bc47490dbf3e822cf2f3c24d4b9061 7a4ca6ee52a974a66cbaa78e33214535dff1d691\n" > <"\t\t4b6ad22357cc8a1296720574b8d2fbc22fab0671 7f9ad8836c775acb134c0a055fc55fb4cd1ba361\n"> < "\t\tc18dc024e14f08d18d14eea0d747ff692d66d6a3 d07d62e5208f22eb5695e7eb47667dc8b9860290\n" > <"\tEOF\n"> <"\tgit notes list >actual &&\n"> <"\ttest_cmp expect_list actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"appending empty string does not change existing note">)} { (SQ <"\n"> <"\tgit notes append -m \"\" &&\n"> <"\tgit notes show >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes append == add when there is no existing note">)} { (SQ <"\n"> <"\tgit notes remove HEAD &&\n"> <"\ttest_must_fail git notes list HEAD &&\n"> < "\tgit notes append -m \"Initial set of notes${LF}${LF}More notes appended with git notes append\" &&\n" > <"\tgit notes show >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"appending empty string to non-existing note does not create note">)} { (SQ <"\n"> <"\tgit notes remove HEAD &&\n"> <"\ttest_must_fail git notes list HEAD &&\n"> <"\tgit notes append -m \"\" &&\n"> <"\ttest_must_fail git notes list HEAD\n"> ) } ) (C {(test_expect_success)} {(SQ <"create other note on a different notes ref (setup)">)} { (SQ <"\n"> <"\ttest_commit 6th &&\n"> <"\tGIT_NOTES_REF=\"refs/notes/other\" git notes add -m \"other note\" &&\n"> <"\tcat >expect-not-other <<-EOF &&\n"> <"\t\tcommit 2c125331118caba0ff8238b7f4958ac6e93fe39c\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:18:13 2005 -0700\n"> <"\n"> <"\t\t${indent}6th\n"> <"\tEOF\n"> <"\tcp expect-not-other expect-other &&\n"> <"\tcat >>expect-other <<-EOF\n"> <"\n"> <"\t\tNotes (other):\n"> <"\t\t${indent}other note\n"> <"\tEOF\n"> ) } ) (C {(test_expect_success)} {(SQ <"Do not show note on other ref by default">)} {(SQ <"\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect-not-other actual\n">)} ) (C {(test_expect_success)} {(SQ <"Do show note when ref is given in GIT_NOTES_REF">)} { (SQ <"\n"> <"\tGIT_NOTES_REF=\"refs/notes/other\" git log -1 >actual &&\n"> <"\ttest_cmp expect-other actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Do show note when ref is given in core.notesRef config">)} { (SQ <"\n"> <"\ttest_config core.notesRef \"refs/notes/other\" &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect-other actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Do not show note when core.notesRef is overridden">)} { (SQ <"\n"> <"\ttest_config core.notesRef \"refs/notes/other\" &&\n"> <"\tGIT_NOTES_REF=\"refs/notes/wrong\" git log -1 >actual &&\n"> <"\ttest_cmp expect-not-other actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Show all notes when notes.displayRef=refs/notes/*">)} { (SQ <"\n"> <"\tcat >expect-both <<-EOF &&\n"> <"\t\tcommit 2c125331118caba0ff8238b7f4958ac6e93fe39c\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:18:13 2005 -0700\n"> <"\n"> <"\t\t${indent}6th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}order test\n"> <"\n"> <"\t\tNotes (other):\n"> <"\t\t${indent}other note\n"> <"\n"> <"\t\tcommit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:17:13 2005 -0700\n"> <"\n"> <"\t\t${indent}5th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}replacement for deleted note\n"> <"\tEOF\n"> <"\tGIT_NOTES_REF=refs/notes/commits git notes add \\\n"> <"\t\t-m\"replacement for deleted note\" HEAD^ &&\n"> <"\tGIT_NOTES_REF=refs/notes/commits git notes add -m\"order test\" &&\n"> <"\ttest_unconfig core.notesRef &&\n"> <"\ttest_config notes.displayRef \"refs/notes/*\" &&\n"> <"\tgit log -2 >actual &&\n"> <"\ttest_cmp expect-both actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"core.notesRef is implicitly in notes.displayRef">)} { (SQ <"\n"> <"\ttest_config core.notesRef refs/notes/commits &&\n"> <"\ttest_config notes.displayRef refs/notes/other &&\n"> <"\tgit log -2 >actual &&\n"> <"\ttest_cmp expect-both actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"notes.displayRef can be given more than once">)} { (SQ <"\n"> <"\ttest_unconfig core.notesRef &&\n"> <"\ttest_config notes.displayRef refs/notes/commits &&\n"> <"\tgit config --add notes.displayRef refs/notes/other &&\n"> <"\tgit log -2 >actual &&\n"> <"\ttest_cmp expect-both actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"notes.displayRef respects order">)} { (SQ <"\n"> <"\tcat >expect-both-reversed <<-EOF &&\n"> <"\t\tcommit 2c125331118caba0ff8238b7f4958ac6e93fe39c\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:18:13 2005 -0700\n"> <"\n"> <"\t\t${indent}6th\n"> <"\n"> <"\t\tNotes (other):\n"> <"\t\t${indent}other note\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}order test\n"> <"\tEOF\n"> <"\ttest_config core.notesRef refs/notes/other &&\n"> <"\ttest_config notes.displayRef refs/notes/commits &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect-both-reversed actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"GIT_NOTES_DISPLAY_REF works">)} { (SQ <"\n"> <"\tGIT_NOTES_DISPLAY_REF=refs/notes/commits:refs/notes/other \\\n"> <"\t\tgit log -2 >actual &&\n"> <"\ttest_cmp expect-both actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"GIT_NOTES_DISPLAY_REF overrides config">)} { (SQ <"\n"> <"\tcat >expect-none <<-EOF &&\n"> <"\t\tcommit 2c125331118caba0ff8238b7f4958ac6e93fe39c\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:18:13 2005 -0700\n"> <"\n"> <"\t\t${indent}6th\n"> <"\n"> <"\t\tcommit 7f9ad8836c775acb134c0a055fc55fb4cd1ba361\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:17:13 2005 -0700\n"> <"\n"> <"\t\t${indent}5th\n"> <"\tEOF\n"> <"\ttest_config notes.displayRef \"refs/notes/*\" &&\n"> <"\tGIT_NOTES_REF= GIT_NOTES_DISPLAY_REF= git log -2 >actual &&\n"> <"\ttest_cmp expect-none actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"--show-notes=* adds to GIT_NOTES_DISPLAY_REF">)} { (SQ <"\n"> <"\tGIT_NOTES_REF= GIT_NOTES_DISPLAY_REF= git log --show-notes=* -2 >actual &&\n"> <"\ttest_cmp expect-both actual\n"> ) } ) (C {(test_expect_success)} {(SQ <--no-standard-notes>)} { (SQ <"\n"> <"\tcat >expect-commits <<-EOF &&\n"> <"\t\tcommit 2c125331118caba0ff8238b7f4958ac6e93fe39c\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:18:13 2005 -0700\n"> <"\n"> <"\t\t${indent}6th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}order test\n"> <"\tEOF\n"> <"\tgit log --no-standard-notes --show-notes=commits -1 >actual &&\n"> <"\ttest_cmp expect-commits actual\n"> ) } ) (C {(test_expect_success)} {(SQ <--standard-notes>)} { (SQ <"\n"> <"\ttest_config notes.displayRef \"refs/notes/*\" &&\n"> <"\tgit log --no-standard-notes --show-notes=commits \\\n"> <"\t\t--standard-notes -2 >actual &&\n"> <"\ttest_cmp expect-both actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"--show-notes=ref accumulates">)} { (SQ <"\n"> <"\tgit log --show-notes=other --show-notes=commits \\\n"> <"\t\t --no-standard-notes -1 >actual &&\n"> <"\ttest_cmp expect-both-reversed actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Allow notes on non-commits (trees, blobs, tags)">)} { (SQ <"\n"> <"\ttest_config core.notesRef refs/notes/other &&\n"> <"\techo \"Note on a tree\" >expect &&\n"> <"\tgit notes add -m \"Note on a tree\" HEAD: &&\n"> <"\tgit notes show HEAD: >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\techo \"Note on a blob\" >expect &&\n"> <"\tfilename=$(git ls-tree --name-only HEAD | head -n1) &&\n"> <"\tgit notes add -m \"Note on a blob\" HEAD:$filename &&\n"> <"\tgit notes show HEAD:$filename >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\techo \"Note on a tag\" >expect &&\n"> <"\tgit tag -a -m \"This is an annotated tag\" foobar HEAD^ &&\n"> <"\tgit notes add -m \"Note on a tag\" foobar &&\n"> <"\tgit notes show foobar >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"create note from other note with \"git notes add -C\"">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit fb01e0ca8c33b6cc0c6451dde747f97df567cb5c\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:19:13 2005 -0700\n"> <"\n"> <"\t\t${indent}7th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}order test\n"> <"\tEOF\n"> <"\ttest_commit 7th &&\n"> <"\tgit notes add -C $(git notes list HEAD^) &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\ttest \"$(git notes list HEAD)\" = \"$(git notes list HEAD^)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"create note from non-existing note with \"git notes add -C\" fails">)} { (SQ <"\n"> <"\ttest_commit 8th &&\n"> <"\ttest_must_fail git notes add -C deadbeef &&\n"> <"\ttest_must_fail git notes list HEAD\n"> ) } ) (C {(test_expect_success)} {(SQ <"create note from non-blob with \"git notes add -C\" fails">)} { (SQ <"\n"> <"\tcommit=$(git rev-parse --verify HEAD) &&\n"> <"\ttree=$(git rev-parse --verify HEAD:) &&\n"> <"\ttest_must_fail git notes add -C $commit &&\n"> <"\ttest_must_fail git notes add -C $tree &&\n"> <"\ttest_must_fail git notes list HEAD\n"> ) } ) (C {(test_expect_success)} {(SQ <"create note from blob with \"git notes add -C\" reuses blob id">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 9a4c31c7f722b5d517e92c64e932dd751e1413bf\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:20:13 2005 -0700\n"> <"\n"> <"\t\t${indent}8th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}This is a blob object\n"> <"\tEOF\n"> <"\tblob=$(echo \"This is a blob object\" | git hash-object -w --stdin) &&\n"> <"\tgit notes add -C $blob &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\ttest \"$(git notes list HEAD)\" = \"$blob\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"create note from other note with \"git notes add -c\"">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 2e0db4bc649e174d667a1cde19e725cf897a5bd2\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:21:13 2005 -0700\n"> <"\n"> <"\t\t${indent}9th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}yet another note\n"> <"\tEOF\n"> <"\ttest_commit 9th &&\n"> <"\tMSG=\"yet another note\" git notes add -c $(git notes list HEAD^^) &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"create note from non-existing note with \"git notes add -c\" fails">)} { (SQ <"\n"> <"\ttest_commit 10th &&\n"> <"\ttest_must_fail env MSG=\"yet another note\" git notes add -c deadbeef &&\n"> <"\ttest_must_fail git notes list HEAD\n"> ) } ) (C {(test_expect_success)} {(SQ <"append to note from other note with \"git notes append -C\"">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 2e0db4bc649e174d667a1cde19e725cf897a5bd2\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:21:13 2005 -0700\n"> <"\n"> <"\t\t${indent}9th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}yet another note\n"> <"\t\t${indent}\n"> <"\t\t${indent}yet another note\n"> <"\tEOF\n"> <"\tgit notes append -C $(git notes list HEAD^) HEAD^ &&\n"> <"\tgit log -1 HEAD^ >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"create note from other note with \"git notes append -c\"">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 7c3b87ab368f81e11b1ea87b2ab99a71ccd25406\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:22:13 2005 -0700\n"> <"\n"> <"\t\t${indent}10th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}other note\n"> <"\tEOF\n"> <"\tMSG=\"other note\" git notes append -c $(git notes list HEAD^) &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"append to note from other note with \"git notes append -c\"">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 7c3b87ab368f81e11b1ea87b2ab99a71ccd25406\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:22:13 2005 -0700\n"> <"\n"> <"\t\t${indent}10th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}other note\n"> <"\t\t${indent}\n"> <"\t\t${indent}yet another note\n"> <"\tEOF\n"> <"\tMSG=\"yet another note\" git notes append -c $(git notes list HEAD) &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"copy note with \"git notes copy\"">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit a446fff8777efdc6eb8f4b7c8a5ff699484df0d5\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:23:13 2005 -0700\n"> <"\n"> <"\t\t${indent}11th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}other note\n"> <"\t\t${indent}\n"> <"\t\t${indent}yet another note\n"> <"\tEOF\n"> <"\ttest_commit 11th &&\n"> <"\tgit notes copy HEAD^ HEAD &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\ttest \"$(git notes list HEAD)\" = \"$(git notes list HEAD^)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"prevent overwrite with \"git notes copy\"">)} { (SQ <"\n"> <"\ttest_must_fail git notes copy HEAD~2 HEAD &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\ttest \"$(git notes list HEAD)\" = \"$(git notes list HEAD^)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"allow overwrite with \"git notes copy -f\"">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit a446fff8777efdc6eb8f4b7c8a5ff699484df0d5\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:23:13 2005 -0700\n"> <"\n"> <"\t\t${indent}11th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}yet another note\n"> <"\t\t${indent}\n"> <"\t\t${indent}yet another note\n"> <"\tEOF\n"> <"\tgit notes copy -f HEAD~2 HEAD &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\ttest \"$(git notes list HEAD)\" = \"$(git notes list HEAD~2)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"cannot copy note from object without notes">)} { (SQ <"\n"> <"\ttest_commit 12th &&\n"> <"\ttest_commit 13th &&\n"> <"\ttest_must_fail git notes copy HEAD^ HEAD\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes copy --stdin">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit e871aa61182b1d95d0a6fb75445d891722863b6b\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:25:13 2005 -0700\n"> <"\n"> <"\t\t${indent}13th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}yet another note\n"> <"\t\t${indent}\n"> <"\t\t${indent}yet another note\n"> <"\n"> <"\t\tcommit 65e263ded02ae4e8839bc151095113737579dc12\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:24:13 2005 -0700\n"> <"\n"> <"\t\t${indent}12th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}other note\n"> <"\t\t${indent}\n"> <"\t\t${indent}yet another note\n"> <"\tEOF\n"> <"\t(echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^); \\\n"> <"\techo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) |\n"> <"\tgit notes copy --stdin &&\n"> <"\tgit log -2 >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\ttest \"$(git notes list HEAD)\" = \"$(git notes list HEAD~2)\" &&\n"> <"\ttest \"$(git notes list HEAD^)\" = \"$(git notes list HEAD~3)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes copy --for-rewrite (unconfigured)">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 4acf42e847e7fffbbf89ee365c20ac7caf40de89\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:27:13 2005 -0700\n"> <"\n"> <"\t\t${indent}15th\n"> <"\n"> <"\t\tcommit 07c85d77059393ed0154b8c96906547a59dfcddd\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:26:13 2005 -0700\n"> <"\n"> <"\t\t${indent}14th\n"> <"\tEOF\n"> <"\ttest_commit 14th &&\n"> <"\ttest_commit 15th &&\n"> <"\t(echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^); \\\n"> <"\techo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) |\n"> <"\tgit notes copy --for-rewrite=foo &&\n"> <"\tgit log -2 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes copy --for-rewrite (enabled)">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 4acf42e847e7fffbbf89ee365c20ac7caf40de89\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:27:13 2005 -0700\n"> <"\n"> <"\t\t${indent}15th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}yet another note\n"> <"\t\t${indent}\n"> <"\t\t${indent}yet another note\n"> <"\n"> <"\t\tcommit 07c85d77059393ed0154b8c96906547a59dfcddd\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:26:13 2005 -0700\n"> <"\n"> <"\t\t${indent}14th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}other note\n"> <"\t\t${indent}\n"> <"\t\t${indent}yet another note\n"> <"\tEOF\n"> <"\ttest_config notes.rewriteMode overwrite &&\n"> <"\ttest_config notes.rewriteRef \"refs/notes/*\" &&\n"> <"\t(echo $(git rev-parse HEAD~3) $(git rev-parse HEAD^); \\\n"> <"\techo $(git rev-parse HEAD~2) $(git rev-parse HEAD)) |\n"> <"\tgit notes copy --for-rewrite=foo &&\n"> <"\tgit log -2 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes copy --for-rewrite (disabled)">)} { (SQ <"\n"> <"\ttest_config notes.rewrite.bar false &&\n"> <"\techo $(git rev-parse HEAD~3) $(git rev-parse HEAD) |\n"> <"\tgit notes copy --for-rewrite=bar &&\n"> <"\tgit log -2 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes copy --for-rewrite (overwrite)">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 4acf42e847e7fffbbf89ee365c20ac7caf40de89\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:27:13 2005 -0700\n"> <"\n"> <"\t\t${indent}15th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}a fresh note\n"> <"\tEOF\n"> <"\tgit notes add -f -m\"a fresh note\" HEAD^ &&\n"> <"\ttest_config notes.rewriteMode overwrite &&\n"> <"\ttest_config notes.rewriteRef \"refs/notes/*\" &&\n"> <"\techo $(git rev-parse HEAD^) $(git rev-parse HEAD) |\n"> <"\tgit notes copy --for-rewrite=foo &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes copy --for-rewrite (ignore)">)} { (SQ <"\n"> <"\ttest_config notes.rewriteMode ignore &&\n"> <"\ttest_config notes.rewriteRef \"refs/notes/*\" &&\n"> <"\techo $(git rev-parse HEAD^) $(git rev-parse HEAD) |\n"> <"\tgit notes copy --for-rewrite=foo &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes copy --for-rewrite (append)">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 4acf42e847e7fffbbf89ee365c20ac7caf40de89\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:27:13 2005 -0700\n"> <"\n"> <"\t\t${indent}15th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}a fresh note\n"> <"\t\t${indent}\n"> <"\t\t${indent}another fresh note\n"> <"\tEOF\n"> <"\tgit notes add -f -m\"another fresh note\" HEAD^ &&\n"> <"\ttest_config notes.rewriteMode concatenate &&\n"> <"\ttest_config notes.rewriteRef \"refs/notes/*\" &&\n"> <"\techo $(git rev-parse HEAD^) $(git rev-parse HEAD) |\n"> <"\tgit notes copy --for-rewrite=foo &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes copy --for-rewrite (append two to one)">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 4acf42e847e7fffbbf89ee365c20ac7caf40de89\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:27:13 2005 -0700\n"> <"\n"> <"\t\t${indent}15th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}a fresh note\n"> <"\t\t${indent}\n"> <"\t\t${indent}another fresh note\n"> <"\t\t${indent}\n"> <"\t\t${indent}append 1\n"> <"\t\t${indent}\n"> <"\t\t${indent}append 2\n"> <"\tEOF\n"> <"\tgit notes add -f -m\"append 1\" HEAD^ &&\n"> <"\tgit notes add -f -m\"append 2\" HEAD^^ &&\n"> <"\ttest_config notes.rewriteMode concatenate &&\n"> <"\ttest_config notes.rewriteRef \"refs/notes/*\" &&\n"> <"\t(echo $(git rev-parse HEAD^) $(git rev-parse HEAD);\n"> <"\techo $(git rev-parse HEAD^^) $(git rev-parse HEAD)) |\n"> <"\tgit notes copy --for-rewrite=foo &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes copy --for-rewrite (append empty)">)} { (SQ <"\n"> <"\tgit notes remove HEAD^ &&\n"> <"\ttest_config notes.rewriteMode concatenate &&\n"> <"\ttest_config notes.rewriteRef \"refs/notes/*\" &&\n"> <"\techo $(git rev-parse HEAD^) $(git rev-parse HEAD) |\n"> <"\tgit notes copy --for-rewrite=foo &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"GIT_NOTES_REWRITE_MODE works">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 4acf42e847e7fffbbf89ee365c20ac7caf40de89\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:27:13 2005 -0700\n"> <"\n"> <"\t\t${indent}15th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}replacement note 1\n"> <"\tEOF\n"> <"\ttest_config notes.rewriteMode concatenate &&\n"> <"\ttest_config notes.rewriteRef \"refs/notes/*\" &&\n"> <"\tgit notes add -f -m\"replacement note 1\" HEAD^ &&\n"> <"\techo $(git rev-parse HEAD^) $(git rev-parse HEAD) |\n"> <"\tGIT_NOTES_REWRITE_MODE=overwrite git notes copy --for-rewrite=foo &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"GIT_NOTES_REWRITE_REF works">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t\tcommit 4acf42e847e7fffbbf89ee365c20ac7caf40de89\n"> <"\t\tAuthor: A U Thor <author@example.com>\n"> <"\t\tDate: Thu Apr 7 15:27:13 2005 -0700\n"> <"\n"> <"\t\t${indent}15th\n"> <"\n"> <"\t\tNotes:\n"> <"\t\t${indent}replacement note 2\n"> <"\tEOF\n"> <"\tgit notes add -f -m\"replacement note 2\" HEAD^ &&\n"> <"\ttest_config notes.rewriteMode overwrite &&\n"> <"\ttest_unconfig notes.rewriteRef &&\n"> <"\techo $(git rev-parse HEAD^) $(git rev-parse HEAD) |\n"> <"\tGIT_NOTES_REWRITE_REF=refs/notes/commits:refs/notes/other \\\n"> <"\t\tgit notes copy --for-rewrite=foo &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"GIT_NOTES_REWRITE_REF overrides config">)} { (SQ <"\n"> <"\tgit notes add -f -m\"replacement note 3\" HEAD^ &&\n"> <"\ttest_config notes.rewriteMode overwrite &&\n"> <"\ttest_config notes.rewriteRef refs/notes/other &&\n"> <"\techo $(git rev-parse HEAD^) $(git rev-parse HEAD) |\n"> <"\tGIT_NOTES_REWRITE_REF= git notes copy --for-rewrite=foo &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes copy diagnoses too many or too few parameters">)} { (SQ <"\n"> <"\ttest_must_fail git notes copy &&\n"> <"\ttest_must_fail git notes copy one two three\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes get-ref expands refs/heads/master to refs/notes/refs/heads/master">)} { (SQ <"\n"> <"\ttest_unconfig core.notesRef &&\n"> <"\tsane_unset GIT_NOTES_REF &&\n"> < "\ttest \"$(git notes --ref=refs/heads/master get-ref)\" = \"refs/notes/refs/heads/master\"\n" > ) } ) (C {(test_expect_success)} {(SQ <"git notes get-ref (no overrides)">)} { (SQ <"\n"> <"\ttest_unconfig core.notesRef &&\n"> <"\tsane_unset GIT_NOTES_REF &&\n"> <"\ttest \"$(git notes get-ref)\" = \"refs/notes/commits\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes get-ref (core.notesRef)">)} { (SQ <"\n"> <"\ttest_config core.notesRef refs/notes/foo &&\n"> <"\ttest \"$(git notes get-ref)\" = \"refs/notes/foo\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes get-ref (GIT_NOTES_REF)">)} { (SQ <"\n"> <"\ttest \"$(GIT_NOTES_REF=refs/notes/bar git notes get-ref)\" = \"refs/notes/bar\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"git notes get-ref (--ref)">)} { (SQ <"\n"> < "\ttest \"$(GIT_NOTES_REF=refs/notes/bar git notes --ref=baz get-ref)\" = \"refs/notes/baz\"\n" > ) } ) (C {(test_expect_success)} {(SQ <"setup testing of empty notes">)} { (SQ <"\n"> <"\ttest_unconfig core.notesRef &&\n"> <"\ttest_commit 16th &&\n"> <"\tempty_blob=$(git hash-object -w /dev/null) &&\n"> <"\techo \"$empty_blob\" >expect_empty\n"> ) } ) (While cond: [(C {(read)} {(cmd)})] body: (DoGroup children: [ (C {(test_expect_success)} {(DQ ("'git notes ") ($ VSub_Name "$cmd") ("' removes empty note"))} { (DQ ("\n") ("\t\ttest_might_fail git notes remove HEAD &&\n") ("\t\tMSG= git notes ") ($ VSub_Name "$cmd") (" &&\n") ("\t\ttest_must_fail git notes list HEAD\n") ("\t") ) } ) (C {(test_expect_success)} {(DQ ("'git notes ") ($ VSub_Name "$cmd") (" --allow-empty' stores empty note"))} { (DQ ("\n") ("\t\ttest_might_fail git notes remove HEAD &&\n") ("\t\tMSG= git notes ") ($ VSub_Name "$cmd") (" --allow-empty &&\n") ("\t\tgit notes list HEAD >actual &&\n") ("\t\ttest_cmp expect_empty actual\n") ("\t") ) } ) ] spids: [2128 2170] ) redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: {("add\n") ("add -F /dev/null\n") ("add -m \"\"\n") ("add -c \"$empty_blob\"\n") ("add -C \"$empty_blob\"\n") ("append\n") ("append -F /dev/null\n") ("append -m \"\"\n") ("append -c \"$empty_blob\"\n") ("append -C \"$empty_blob\"\n") ("edit\n") } do_expansion: False here_end: EOF was_filled: True spids: [2172] ) ] ) (C {(test_expect_success)} {(SQ <"empty notes are displayed by git log">)} { (SQ <"\n"> <"\ttest_commit 17th &&\n"> <"\tgit log -1 >expect &&\n"> <"\tcat >>expect <<-EOF &&\n"> <"\n"> <"\t\tNotes:\n"> <"\tEOF\n"> <"\tgit notes add -C \"$empty_blob\" --allow-empty &&\n"> <"\tgit log -1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_done)}) ] )