(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"Test notes merging with manual conflict resolution">)} spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ <"setup commits">)} { (SQ <"\n"> <"\ttest_commit 1st &&\n"> <"\ttest_commit 2nd &&\n"> <"\ttest_commit 3rd &&\n"> <"\ttest_commit 4th &&\n"> <"\ttest_commit 5th\n"> ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:commit_sha1) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(rev-parse)} {(1st) (Lit_Other "^") (Lit_LBrace "{") (commit) (Lit_RBrace "}")} ) ] ) left_token: <Left_CommandSub "$("> spids: [44 54] ) } spids: [43] ) ] spids: [43] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:commit_sha2) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(rev-parse)} {(2nd) (Lit_Other "^") (Lit_LBrace "{") (commit) (Lit_RBrace "}")} ) ] ) left_token: <Left_CommandSub "$("> spids: [57 67] ) } spids: [56] ) ] spids: [56] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:commit_sha3) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(rev-parse)} {(3rd) (Lit_Other "^") (Lit_LBrace "{") (commit) (Lit_RBrace "}")} ) ] ) left_token: <Left_CommandSub "$("> spids: [70 80] ) } spids: [69] ) ] spids: [69] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:commit_sha4) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(rev-parse)} {(4th) (Lit_Other "^") (Lit_LBrace "{") (commit) (Lit_RBrace "}")} ) ] ) left_token: <Left_CommandSub "$("> spids: [83 93] ) } spids: [82] ) ] spids: [82] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:commit_sha5) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(git)} {(rev-parse)} {(5th) (Lit_Other "^") (Lit_LBrace "{") (commit) (Lit_RBrace "}")} ) ] ) left_token: <Left_CommandSub "$("> spids: [96 106] ) } spids: [95] ) ] spids: [95] ) (FuncDef name: verify_notes body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:notes_ref) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [117] ) ] spids: [117] ) (AndOr children: [ (Pipeline children: [ (C {(git)} {(-c)} {(core.notesRef) (Lit_Other "=") (DQ (refs/notes/) ($ VSub_Name "$notes_ref"))} {(notes)} ) (SimpleCommand words: [{(sort)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (output_notes_) ($ VSub_Name "$notes_ref"))} spids: [141] ) ] ) ] negated: False ) (AndOr children: [ (C {(test_cmp)} {(DQ (expect_notes_) ($ VSub_Name "$notes_ref"))} {(DQ (output_notes_) ($ VSub_Name "$notes_ref"))} ) (AndOr children: [ (SimpleCommand words: [ {(git)} {(-c)} {(core.notesRef) (Lit_Other "=") (DQ (refs/notes/) ($ VSub_Name "$notes_ref")) } {(log)} {(--format) (Lit_Other "=") (DQ ("%H %s%n%N"))} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (output_log_) ($ VSub_Name "$notes_ref"))} spids: [186] ) ] ) (C {(test_cmp)} {(DQ (expect_log_) ($ VSub_Name "$notes_ref"))} {(DQ (output_log_) ($ VSub_Name "$notes_ref"))} ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [114] ) spids: [109 113] ) (Pipeline children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("6e8e3febca3c2bb896704335cc4d0c34cb2f8715 ") ($ VSub_Name "$commit_sha4") ("\n") ("e5388c10860456ee60673025345fe2e153eb8cf8 ") ($ VSub_Name "$commit_sha3") ("\n") ("ceefa674873670e7ecd131814d909723cce2b669 ") ($ VSub_Name "$commit_sha2") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [212] ) ] ) (SimpleCommand words: [{(sort)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect_notes_x)} spids:[219])] ) ] negated: False ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect_log_x)} spids:[234]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ($ VSub_Name "$commit_sha5") (" 5th\n") ("\n") ($ VSub_Name "$commit_sha4") (" 4th\n") ("x notes on 4th commit\n") ("\n") ($ VSub_Name "$commit_sha3") (" 3rd\n") ("x notes on 3rd commit\n") ("\n") ($ VSub_Name "$commit_sha2") (" 2nd\n") ("x notes on 2nd commit\n") ("\n") ($ VSub_Name "$commit_sha1") (" 1st\n") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [237] ) ] ) (C {(test_expect_success)} {(SQ <"setup merge base (x)">)} { (SQ <"\n"> <"\tgit config core.notesRef refs/notes/x &&\n"> <"\tgit notes add -m \"x notes on 2nd commit\" 2nd &&\n"> <"\tgit notes add -m \"x notes on 3rd commit\" 3rd &&\n"> <"\tgit notes add -m \"x notes on 4th commit\" 4th &&\n"> <"\tverify_notes x\n"> ) } ) (Pipeline children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("e2bfd06a37dd2031684a59a6e2b033e212239c78 ") ($ VSub_Name "$commit_sha4") ("\n") ("5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 ") ($ VSub_Name "$commit_sha3") ("\n") ("b0a6021ec006d07e80e9b20ec9b444cbd9d560d3 ") ($ VSub_Name "$commit_sha1") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [277] ) ] ) (SimpleCommand words: [{(sort)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect_notes_y)} spids:[284])] ) ] negated: False ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect_log_y)} spids:[299]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ($ VSub_Name "$commit_sha5") (" 5th\n") ("\n") ($ VSub_Name "$commit_sha4") (" 4th\n") ("y notes on 4th commit\n") ("\n") ($ VSub_Name "$commit_sha3") (" 3rd\n") ("y notes on 3rd commit\n") ("\n") ($ VSub_Name "$commit_sha2") (" 2nd\n") ("\n") ($ VSub_Name "$commit_sha1") (" 1st\n") ("y notes on 1st commit\n") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [302] ) ] ) (C {(test_expect_success)} {(SQ <"setup local branch (y)">)} { (SQ <"\n"> <"\tgit update-ref refs/notes/y refs/notes/x &&\n"> <"\tgit config core.notesRef refs/notes/y &&\n"> <"\tgit notes add -f -m \"y notes on 1st commit\" 1st &&\n"> <"\tgit notes remove 2nd &&\n"> <"\tgit notes add -f -m \"y notes on 3rd commit\" 3rd &&\n"> <"\tgit notes add -f -m \"y notes on 4th commit\" 4th &&\n"> <"\tverify_notes y\n"> ) } ) (Pipeline children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("cff59c793c20bb49a4e01bc06fb06bad642e0d54 ") ($ VSub_Name "$commit_sha4") ("\n") ("283b48219aee9a4105f6cab337e789065c82c2b9 ") ($ VSub_Name "$commit_sha2") ("\n") ("0a81da8956346e19bcb27a906f04af327e03e31b ") ($ VSub_Name "$commit_sha1") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [344] ) ] ) (SimpleCommand words: [{(sort)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect_notes_z)} spids:[351])] ) ] negated: False ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect_log_z)} spids:[366]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ($ VSub_Name "$commit_sha5") (" 5th\n") ("\n") ($ VSub_Name "$commit_sha4") (" 4th\n") ("z notes on 4th commit\n") ("\n") ($ VSub_Name "$commit_sha3") (" 3rd\n") ("\n") ($ VSub_Name "$commit_sha2") (" 2nd\n") ("z notes on 2nd commit\n") ("\n") ($ VSub_Name "$commit_sha1") (" 1st\n") ("z notes on 1st commit\n") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [369] ) ] ) (C {(test_expect_success)} {(SQ <"setup remote branch (z)">)} { (SQ <"\n"> <"\tgit update-ref refs/notes/z refs/notes/x &&\n"> <"\tgit config core.notesRef refs/notes/z &&\n"> <"\tgit notes add -f -m \"z notes on 1st commit\" 1st &&\n"> <"\tgit notes add -f -m \"z notes on 2nd commit\" 2nd &&\n"> <"\tgit notes remove 3rd &&\n"> <"\tgit notes add -f -m \"z notes on 4th commit\" 4th &&\n"> <"\tverify_notes z\n"> ) } ) (Pipeline children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ($ VSub_Name "$commit_sha1") ("\n") ($ VSub_Name "$commit_sha2") ("\n") ($ VSub_Name "$commit_sha3") ("\n") ($ VSub_Name "$commit_sha4") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [439] ) ] ) (SimpleCommand words: [{(sort)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect_conflicts)} spids:[446])] ) ] negated: False ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(expect_conflict_) ($ VSub_Name "$commit_sha1")} spids: [460] ) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("<<<<<<< refs/notes/m\n") ("y notes on 1st commit\n") ("=======\n") ("z notes on 1st commit\n") (">>>>>>> refs/notes/z\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [464] ) ] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(expect_conflict_) ($ VSub_Name "$commit_sha2")} spids: [475] ) (HereDoc op_id: Redir_DLess fd: -1 body: {(DQ ("z notes on 2nd commit\n"))} do_expansion: True here_end: EOF was_filled: True spids: [479] ) ] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(expect_conflict_) ($ VSub_Name "$commit_sha3")} spids: [486] ) (HereDoc op_id: Redir_DLess fd: -1 body: {(DQ ("y notes on 3rd commit\n"))} do_expansion: True here_end: EOF was_filled: True spids: [490] ) ] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(expect_conflict_) ($ VSub_Name "$commit_sha4")} spids: [497] ) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("<<<<<<< refs/notes/m\n") ("y notes on 4th commit\n") ("=======\n") ("z notes on 4th commit\n") (">>>>>>> refs/notes/z\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [501] ) ] ) (C {(cp)} {(expect_notes_y)} {(expect_notes_m)}) (C {(cp)} {(expect_log_y)} {(expect_log_m)}) (SimpleCommand words: [{(git)} {(rev-parse)} {(refs/notes/y)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(pre_merge_y)} spids:[529])] ) (SimpleCommand words: [{(git)} {(rev-parse)} {(refs/notes/z)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(pre_merge_z)} spids:[539])] ) (C {(test_expect_success)} {(SQ <"merge z into m (== y) with default (\"manual\") resolver => Conflicting 3-way merge">)} { (SQ <"\n"> <"\tgit update-ref refs/notes/m refs/notes/y &&\n"> <"\tgit config core.notesRef refs/notes/m &&\n"> <"\ttest_must_fail git notes merge z >output &&\n"> <"\t# Output should point to where to resolve conflicts\n"> <"\ttest_i18ngrep \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n"> <"\t# Inspect merge conflicts\n"> <"\tls .git/NOTES_MERGE_WORKTREE >output_conflicts &&\n"> <"\ttest_cmp expect_conflicts output_conflicts &&\n"> <"\t( for f in $(cat expect_conflicts); do\n"> <"\t\ttest_cmp \"expect_conflict_$f\" \".git/NOTES_MERGE_WORKTREE/$f\" ||\n"> <"\t\texit 1\n"> <"\tdone ) &&\n"> <"\t# Verify that current notes tree (pre-merge) has not changed (m == y)\n"> <"\tverify_notes y &&\n"> <"\tverify_notes m &&\n"> <"\ttest \"$(git rev-parse refs/notes/m)\" = \"$(cat pre_merge_y)\"\n"> ) } ) (Pipeline children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("00494adecf2d9635a02fa431308d67993f853968 ") ($ VSub_Name "$commit_sha4") ("\n") ("283b48219aee9a4105f6cab337e789065c82c2b9 ") ($ VSub_Name "$commit_sha2") ("\n") ("0a81da8956346e19bcb27a906f04af327e03e31b ") ($ VSub_Name "$commit_sha1") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [573] ) ] ) (SimpleCommand words: [{(sort)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect_notes_z)} spids:[580])] ) ] negated: False ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect_log_z)} spids:[595]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ($ VSub_Name "$commit_sha5") (" 5th\n") ("\n") ($ VSub_Name "$commit_sha4") (" 4th\n") ("z notes on 4th commit\n") ("\n") ("More z notes on 4th commit\n") ("\n") ($ VSub_Name "$commit_sha3") (" 3rd\n") ("\n") ($ VSub_Name "$commit_sha2") (" 2nd\n") ("z notes on 2nd commit\n") ("\n") ($ VSub_Name "$commit_sha1") (" 1st\n") ("z notes on 1st commit\n") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [598] ) ] ) (C {(test_expect_success)} {(SQ <"change notes in z">)} { (SQ <"\n"> <"\tgit notes --ref z append -m \"More z notes on 4th commit\" 4th &&\n"> <"\tverify_notes z\n"> ) } ) (C {(test_expect_success)} {(SQ <"cannot do merge w/conflicts when previous merge is unfinished">)} { (SQ <"\n"> <"\ttest -d .git/NOTES_MERGE_WORKTREE &&\n"> <"\ttest_must_fail git notes merge z >output 2>&1 &&\n"> <"\t# Output should indicate what is wrong\n"> <"\ttest_i18ngrep -q \"\\\\.git/NOTES_MERGE_\\\\* exists\" output\n"> ) } ) (Pipeline children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("ceefa674873670e7ecd131814d909723cce2b669 ") ($ VSub_Name "$commit_sha2") ("\n") ("f75d1df88cbfe4258d49852f26cfc83f2ad4494b ") ($ VSub_Name "$commit_sha1") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [656] ) ] ) (SimpleCommand words: [{(sort)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect_notes_w)} spids:[663])] ) ] negated: False ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect_log_w)} spids:[675]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ($ VSub_Name "$commit_sha5") (" 5th\n") ("\n") ($ VSub_Name "$commit_sha4") (" 4th\n") ("\n") ($ VSub_Name "$commit_sha3") (" 3rd\n") ("\n") ($ VSub_Name "$commit_sha2") (" 2nd\n") ("x notes on 2nd commit\n") ("\n") ($ VSub_Name "$commit_sha1") (" 1st\n") ("w notes on 1st commit\n") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [678] ) ] ) (C {(test_expect_success)} {(SQ <"setup unrelated notes ref (w)">)} { (SQ <"\n"> <"\tgit config core.notesRef refs/notes/w &&\n"> <"\tgit notes add -m \"w notes on 1st commit\" 1st &&\n"> <"\tgit notes add -m \"x notes on 2nd commit\" 2nd &&\n"> <"\tverify_notes w\n"> ) } ) (Pipeline children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("6e8e3febca3c2bb896704335cc4d0c34cb2f8715 ") ($ VSub_Name "$commit_sha4") ("\n") ("e5388c10860456ee60673025345fe2e153eb8cf8 ") ($ VSub_Name "$commit_sha3") ("\n") ("ceefa674873670e7ecd131814d909723cce2b669 ") ($ VSub_Name "$commit_sha2") ("\n") ("f75d1df88cbfe4258d49852f26cfc83f2ad4494b ") ($ VSub_Name "$commit_sha1") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [716] ) ] ) (SimpleCommand words: [{(sort)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect_notes_w)} spids:[723])] ) ] negated: False ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect_log_w)} spids:[741]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ($ VSub_Name "$commit_sha5") (" 5th\n") ("\n") ($ VSub_Name "$commit_sha4") (" 4th\n") ("x notes on 4th commit\n") ("\n") ($ VSub_Name "$commit_sha3") (" 3rd\n") ("x notes on 3rd commit\n") ("\n") ($ VSub_Name "$commit_sha2") (" 2nd\n") ("x notes on 2nd commit\n") ("\n") ($ VSub_Name "$commit_sha1") (" 1st\n") ("w notes on 1st commit\n") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [744] ) ] ) (C {(test_expect_success)} {(SQ <"can do merge without conflicts even if previous merge is unfinished (x => w)">)} { (SQ <"\n"> <"\ttest -d .git/NOTES_MERGE_WORKTREE &&\n"> <"\tgit notes merge x &&\n"> <"\tverify_notes w &&\n"> <"\t# Verify that other notes refs has not changed (x and y)\n"> <"\tverify_notes x &&\n"> <"\tverify_notes y\n"> ) } ) (Pipeline children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("021faa20e931fb48986ffc6282b4bb05553ac946 ") ($ VSub_Name "$commit_sha4") ("\n") ("5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 ") ($ VSub_Name "$commit_sha3") ("\n") ("283b48219aee9a4105f6cab337e789065c82c2b9 ") ($ VSub_Name "$commit_sha2") ("\n") ("0a59e787e6d688aa6309e56e8c1b89431a0fc1c1 ") ($ VSub_Name "$commit_sha1") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [786] ) ] ) (SimpleCommand words: [{(sort)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect_notes_m)} spids:[793])] ) ] negated: False ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect_log_m)} spids:[811]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ($ VSub_Name "$commit_sha5") (" 5th\n") ("\n") ($ VSub_Name "$commit_sha4") (" 4th\n") ("y and z notes on 4th commit\n") ("\n") ($ VSub_Name "$commit_sha3") (" 3rd\n") ("y notes on 3rd commit\n") ("\n") ($ VSub_Name "$commit_sha2") (" 2nd\n") ("z notes on 2nd commit\n") ("\n") ($ VSub_Name "$commit_sha1") (" 1st\n") ("y and z notes on 1st commit\n") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [814] ) ] ) (C {(test_expect_success)} {(SQ <"do not allow mixing --commit and --abort">)} {(SQ <"\n"> <"\ttest_must_fail git notes merge --commit --abort\n">)} ) (C {(test_expect_success)} {(SQ <"do not allow mixing --commit and --strategy">)} {(SQ <"\n"> <"\ttest_must_fail git notes merge --commit --strategy theirs\n">)} ) (C {(test_expect_success)} {(SQ <"do not allow mixing --abort and --strategy">)} {(SQ <"\n"> <"\ttest_must_fail git notes merge --abort --strategy theirs\n">)} ) (C {(test_expect_success)} {(SQ <"finalize conflicting merge (z => m)">)} { (SQ <"\n"> <"\t# Resolve conflicts and finalize merge\n"> <"\tcat >.git/NOTES_MERGE_WORKTREE/$commit_sha1 <<EOF &&\n"> <"y and z notes on 1st commit\n"> <"EOF\n"> <"\tcat >.git/NOTES_MERGE_WORKTREE/$commit_sha4 <<EOF &&\n"> <"y and z notes on 4th commit\n"> <"EOF\n"> <"\tgit notes merge --commit &&\n"> <"\t# No .git/NOTES_MERGE_* files left\n"> <"\ttest_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&\n"> <"\ttest_cmp /dev/null output &&\n"> <"\t# Merge commit has pre-merge y and pre-merge z as parents\n"> <"\ttest \"$(git rev-parse refs/notes/m^1)\" = \"$(cat pre_merge_y)\" &&\n"> <"\ttest \"$(git rev-parse refs/notes/m^2)\" = \"$(cat pre_merge_z)\" &&\n"> <"\t# Merge commit mentions the notes refs merged\n"> <"\tgit log -1 --format=%B refs/notes/m > merge_commit_msg &&\n"> <"\tgrep -q refs/notes/m merge_commit_msg &&\n"> <"\tgrep -q refs/notes/z merge_commit_msg &&\n"> <"\t# Merge commit mentions conflicting notes\n"> <"\tgrep -q \"Conflicts\" merge_commit_msg &&\n"> <"\t( for sha1 in $(cat expect_conflicts); do\n"> <"\t\tgrep -q \"$sha1\" merge_commit_msg ||\n"> <"\t\texit 1\n"> <"\tdone ) &&\n"> <"\t# Verify contents of merge result\n"> <"\tverify_notes m &&\n"> <"\t# Verify that other notes refs has not changed (w, x, y and z)\n"> <"\tverify_notes w &&\n"> <"\tverify_notes x &&\n"> <"\tverify_notes y &&\n"> <"\tverify_notes z\n"> ) } ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(expect_conflict_) ($ VSub_Name "$commit_sha4")} spids: [917] ) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("<<<<<<< refs/notes/m\n") ("y notes on 4th commit\n") ("=======\n") ("z notes on 4th commit\n") ("\n") ("More z notes on 4th commit\n") (">>>>>>> refs/notes/z\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [921] ) ] ) (C {(cp)} {(expect_notes_y)} {(expect_notes_m)}) (C {(cp)} {(expect_log_y)} {(expect_log_m)}) (SimpleCommand words: [{(git)} {(rev-parse)} {(refs/notes/y)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(pre_merge_y)} spids:[951])] ) (SimpleCommand words: [{(git)} {(rev-parse)} {(refs/notes/z)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(pre_merge_z)} spids:[961])] ) (C {(test_expect_success)} { (SQ < "redo merge of z into m (== y) with default (\"manual\") resolver => Conflicting 3-way merge" > ) } { (SQ <"\n"> <"\tgit update-ref refs/notes/m refs/notes/y &&\n"> <"\tgit config core.notesRef refs/notes/m &&\n"> <"\ttest_must_fail git notes merge z >output &&\n"> <"\t# Output should point to where to resolve conflicts\n"> <"\ttest_i18ngrep \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n"> <"\t# Inspect merge conflicts\n"> <"\tls .git/NOTES_MERGE_WORKTREE >output_conflicts &&\n"> <"\ttest_cmp expect_conflicts output_conflicts &&\n"> <"\t( for f in $(cat expect_conflicts); do\n"> <"\t\ttest_cmp \"expect_conflict_$f\" \".git/NOTES_MERGE_WORKTREE/$f\" ||\n"> <"\t\texit 1\n"> <"\tdone ) &&\n"> <"\t# Verify that current notes tree (pre-merge) has not changed (m == y)\n"> <"\tverify_notes y &&\n"> <"\tverify_notes m &&\n"> <"\ttest \"$(git rev-parse refs/notes/m)\" = \"$(cat pre_merge_y)\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"abort notes merge">)} { (SQ <"\n"> <"\tgit notes merge --abort &&\n"> <"\t# No .git/NOTES_MERGE_* files left\n"> <"\ttest_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&\n"> <"\ttest_cmp /dev/null output &&\n"> <"\t# m has not moved (still == y)\n"> <"\ttest \"$(git rev-parse refs/notes/m)\" = \"$(cat pre_merge_y)\" &&\n"> <"\t# Verify that other notes refs has not changed (w, x, y and z)\n"> <"\tverify_notes w &&\n"> <"\tverify_notes x &&\n"> <"\tverify_notes y &&\n"> <"\tverify_notes z\n"> ) } ) (SimpleCommand words: [{(git)} {(rev-parse)} {(refs/notes/y)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(pre_merge_y)} spids:[1021])] ) (SimpleCommand words: [{(git)} {(rev-parse)} {(refs/notes/z)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(pre_merge_z)} spids:[1031])] ) (C {(test_expect_success)} { (SQ < "redo merge of z into m (== y) with default (\"manual\") resolver => Conflicting 3-way merge" > ) } { (SQ <"\n"> <"\ttest_must_fail git notes merge z >output &&\n"> <"\t# Output should point to where to resolve conflicts\n"> <"\ttest_i18ngrep \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n"> <"\t# Inspect merge conflicts\n"> <"\tls .git/NOTES_MERGE_WORKTREE >output_conflicts &&\n"> <"\ttest_cmp expect_conflicts output_conflicts &&\n"> <"\t( for f in $(cat expect_conflicts); do\n"> <"\t\ttest_cmp \"expect_conflict_$f\" \".git/NOTES_MERGE_WORKTREE/$f\" ||\n"> <"\t\texit 1\n"> <"\tdone ) &&\n"> <"\t# Verify that current notes tree (pre-merge) has not changed (m == y)\n"> <"\tverify_notes y &&\n"> <"\tverify_notes m &&\n"> <"\ttest \"$(git rev-parse refs/notes/m)\" = \"$(cat pre_merge_y)\"\n"> ) } ) (Pipeline children: [ (SimpleCommand words: [{(cat)}] redirects: [ (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ("304dfb4325cf243025b9957486eb605a9b51c199 ") ($ VSub_Name "$commit_sha5") ("\n") ("283b48219aee9a4105f6cab337e789065c82c2b9 ") ($ VSub_Name "$commit_sha2") ("\n") ("0a59e787e6d688aa6309e56e8c1b89431a0fc1c1 ") ($ VSub_Name "$commit_sha1") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [1063] ) ] ) (SimpleCommand words: [{(sort)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expect_notes_m)} spids:[1070])] ) ] negated: False ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect_log_m)} spids:[1085]) (HereDoc op_id: Redir_DLess fd: -1 body: { (DQ ($ VSub_Name "$commit_sha5") (" 5th\n") ("new note on 5th commit\n") ("\n") ($ VSub_Name "$commit_sha4") (" 4th\n") ("\n") ($ VSub_Name "$commit_sha3") (" 3rd\n") ("\n") ($ VSub_Name "$commit_sha2") (" 2nd\n") ("z notes on 2nd commit\n") ("\n") ($ VSub_Name "$commit_sha1") (" 1st\n") ("y and z notes on 1st commit\n") ("\n") ) } do_expansion: True here_end: EOF was_filled: True spids: [1088] ) ] ) (C {(test_expect_success)} {(SQ <"add + remove notes in finalized merge (z => m)">)} { (SQ <"\n"> <"\t# Resolve one conflict\n"> <"\tcat >.git/NOTES_MERGE_WORKTREE/$commit_sha1 <<EOF &&\n"> <"y and z notes on 1st commit\n"> <"EOF\n"> <"\t# Remove another conflict\n"> <"\trm .git/NOTES_MERGE_WORKTREE/$commit_sha4 &&\n"> <"\t# Remove a D/F conflict\n"> <"\trm .git/NOTES_MERGE_WORKTREE/$commit_sha3 &&\n"> <"\t# Add a new note\n"> <"\techo \"new note on 5th commit\" > .git/NOTES_MERGE_WORKTREE/$commit_sha5 &&\n"> <"\t# Finalize merge\n"> <"\tgit notes merge --commit &&\n"> <"\t# No .git/NOTES_MERGE_* files left\n"> <"\ttest_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&\n"> <"\ttest_cmp /dev/null output &&\n"> <"\t# Merge commit has pre-merge y and pre-merge z as parents\n"> <"\ttest \"$(git rev-parse refs/notes/m^1)\" = \"$(cat pre_merge_y)\" &&\n"> <"\ttest \"$(git rev-parse refs/notes/m^2)\" = \"$(cat pre_merge_z)\" &&\n"> <"\t# Merge commit mentions the notes refs merged\n"> <"\tgit log -1 --format=%B refs/notes/m > merge_commit_msg &&\n"> <"\tgrep -q refs/notes/m merge_commit_msg &&\n"> <"\tgrep -q refs/notes/z merge_commit_msg &&\n"> <"\t# Merge commit mentions conflicting notes\n"> <"\tgrep -q \"Conflicts\" merge_commit_msg &&\n"> <"\t( for sha1 in $(cat expect_conflicts); do\n"> <"\t\tgrep -q \"$sha1\" merge_commit_msg ||\n"> <"\t\texit 1\n"> <"\tdone ) &&\n"> <"\t# Verify contents of merge result\n"> <"\tverify_notes m &&\n"> <"\t# Verify that other notes refs has not changed (w, x, y and z)\n"> <"\tverify_notes w &&\n"> <"\tverify_notes x &&\n"> <"\tverify_notes y &&\n"> <"\tverify_notes z\n"> ) } ) (C {(cp)} {(expect_notes_y)} {(expect_notes_m)}) (C {(cp)} {(expect_log_y)} {(expect_log_m)}) (C {(test_expect_success)} { (SQ < "redo merge of z into m (== y) with default (\"manual\") resolver => Conflicting 3-way merge" > ) } { (SQ <"\n"> <"\tgit update-ref refs/notes/m refs/notes/y &&\n"> <"\ttest_must_fail git notes merge z >output &&\n"> <"\t# Output should point to where to resolve conflicts\n"> <"\ttest_i18ngrep \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n"> <"\t# Inspect merge conflicts\n"> <"\tls .git/NOTES_MERGE_WORKTREE >output_conflicts &&\n"> <"\ttest_cmp expect_conflicts output_conflicts &&\n"> <"\t( for f in $(cat expect_conflicts); do\n"> <"\t\ttest_cmp \"expect_conflict_$f\" \".git/NOTES_MERGE_WORKTREE/$f\" ||\n"> <"\t\texit 1\n"> <"\tdone ) &&\n"> <"\t# Verify that current notes tree (pre-merge) has not changed (m == y)\n"> <"\tverify_notes y &&\n"> <"\tverify_notes m &&\n"> <"\ttest \"$(git rev-parse refs/notes/m)\" = \"$(cat pre_merge_y)\"\n"> ) } ) (C {(cp)} {(expect_notes_w)} {(expect_notes_m)}) (C {(cp)} {(expect_log_w)} {(expect_log_m)}) (C {(test_expect_success)} {(SQ <"reset notes ref m to somewhere else (w)">)} { (SQ <"\n"> <"\tgit update-ref refs/notes/m refs/notes/w &&\n"> <"\tverify_notes m &&\n"> <"\ttest \"$(git rev-parse refs/notes/m)\" = \"$(git rev-parse refs/notes/w)\"\n"> ) } ) (C {(test_expect_success)} { (SQ < "fail to finalize conflicting merge if underlying ref has moved in the meantime (m != NOTES_MERGE_PARTIAL^1)" > ) } { (SQ <"\n"> <"\t# Resolve conflicts\n"> <"\tcat >.git/NOTES_MERGE_WORKTREE/$commit_sha1 <<EOF &&\n"> <"y and z notes on 1st commit\n"> <"EOF\n"> <"\tcat >.git/NOTES_MERGE_WORKTREE/$commit_sha4 <<EOF &&\n"> <"y and z notes on 4th commit\n"> <"EOF\n"> <"\t# Fail to finalize merge\n"> <"\ttest_must_fail git notes merge --commit >output 2>&1 &&\n"> <"\t# .git/NOTES_MERGE_* must remain\n"> <"\ttest -f .git/NOTES_MERGE_PARTIAL &&\n"> <"\ttest -f .git/NOTES_MERGE_REF &&\n"> <"\ttest -f .git/NOTES_MERGE_WORKTREE/$commit_sha1 &&\n"> <"\ttest -f .git/NOTES_MERGE_WORKTREE/$commit_sha2 &&\n"> <"\ttest -f .git/NOTES_MERGE_WORKTREE/$commit_sha3 &&\n"> <"\ttest -f .git/NOTES_MERGE_WORKTREE/$commit_sha4 &&\n"> <"\t# Refs are unchanged\n"> <"\ttest \"$(git rev-parse refs/notes/m)\" = \"$(git rev-parse refs/notes/w)\" &&\n"> <"\ttest \"$(git rev-parse refs/notes/y)\" = \"$(git rev-parse NOTES_MERGE_PARTIAL^1)\" &&\n"> < "\ttest \"$(git rev-parse refs/notes/m)\" != \"$(git rev-parse NOTES_MERGE_PARTIAL^1)\" &&\n" > <"\t# Mention refs/notes/m, and its current and expected value in output\n"> <"\tgrep -q \"refs/notes/m\" output &&\n"> <"\tgrep -q \"$(git rev-parse refs/notes/m)\" output &&\n"> <"\tgrep -q \"$(git rev-parse NOTES_MERGE_PARTIAL^1)\" output &&\n"> <"\t# Verify that other notes refs has not changed (w, x, y and z)\n"> <"\tverify_notes w &&\n"> <"\tverify_notes x &&\n"> <"\tverify_notes y &&\n"> <"\tverify_notes z\n"> ) } ) (C {(test_expect_success)} {(SQ <"resolve situation by aborting the notes merge">)} { (SQ <"\n"> <"\tgit notes merge --abort &&\n"> <"\t# No .git/NOTES_MERGE_* files left\n"> <"\ttest_might_fail ls .git/NOTES_MERGE_* >output 2>/dev/null &&\n"> <"\ttest_cmp /dev/null output &&\n"> <"\t# m has not moved (still == w)\n"> <"\ttest \"$(git rev-parse refs/notes/m)\" = \"$(git rev-parse refs/notes/w)\" &&\n"> <"\t# Verify that other notes refs has not changed (w, x, y and z)\n"> <"\tverify_notes w &&\n"> <"\tverify_notes x &&\n"> <"\tverify_notes y &&\n"> <"\tverify_notes z\n"> ) } ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(expect_notes)} spids:[1286]) (HereDoc op_id: Redir_DLess fd: -1 body: {(DQ ("foo\n") ("bar\n"))} do_expansion: True here_end: EOF was_filled: True spids: [1289] ) ] ) (C {(test_expect_success)} {(SQ <"switch cwd before committing notes merge">)} { (SQ <"\n"> <"\tgit notes add -m foo HEAD &&\n"> <"\tgit notes --ref=other add -m bar HEAD &&\n"> <"\ttest_must_fail git notes merge refs/notes/other &&\n"> <"\t(\n"> <"\t\tcd .git/NOTES_MERGE_WORKTREE &&\n"> <"\t\techo \"foo\" > $(git rev-parse HEAD) &&\n"> <"\t\techo \"bar\" >> $(git rev-parse HEAD) &&\n"> <"\t\tgit notes merge --commit\n"> <"\t) &&\n"> <"\tgit notes show HEAD > actual_notes &&\n"> <"\ttest_cmp expect_notes actual_notes\n"> ) } ) (C {(test_done)}) ] )