(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'Test notes merging with manual conflict resolution'>)} 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'> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:commit_sha1) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<1st> <Id.Lit_Other '^'> <Id.Lit_LBrace '{'> <commit> <Id.Lit_RBrace '}'>} ) ) } spids: [43] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:commit_sha2) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<2nd> <Id.Lit_Other '^'> <Id.Lit_LBrace '{'> <commit> <Id.Lit_RBrace '}'>} ) ) } spids: [56] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:commit_sha3) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<3rd> <Id.Lit_Other '^'> <Id.Lit_LBrace '{'> <commit> <Id.Lit_RBrace '}'>} ) ) } spids: [69] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:commit_sha4) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<4th> <Id.Lit_Other '^'> <Id.Lit_LBrace '{'> <commit> <Id.Lit_RBrace '}'>} ) ) } spids: [82] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:commit_sha5) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<5th> <Id.Lit_Other '^'> <Id.Lit_LBrace '{'> <commit> <Id.Lit_RBrace '}'>} ) ) } spids: [95] ) ] ) (command.ShFunction name: verify_notes body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:notes_ref) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number '$1'))} spids: [117] ) ] ) (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.Pipeline children: [ (C {<git>} {<-c>} {<core.notesRef> <Id.Lit_Equals '='> (DQ <'refs/notes/'> ($ Id.VSub_DollarName '$notes_ref')) } {<notes>} ) (command.Simple words: [{<sort>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ <output_notes_> ($ Id.VSub_DollarName '$notes_ref'))} ) ] do_fork: T ) ] negated: F ) (C {<test_cmp>} {(DQ <expect_notes_> ($ Id.VSub_DollarName '$notes_ref'))} {(DQ <output_notes_> ($ Id.VSub_DollarName '$notes_ref'))} ) (command.Simple words: [ {<git>} {<-c>} {<core.notesRef> <Id.Lit_Equals '='> (DQ <'refs/notes/'> ($ Id.VSub_DollarName '$notes_ref')) } {<log>} {<--format> <Id.Lit_Equals '='> (DQ <'%H %s%n%N'>)} ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ <output_log_> ($ Id.VSub_DollarName '$notes_ref'))} ) ] do_fork: T ) (C {<test_cmp>} {(DQ <expect_log_> ($ Id.VSub_DollarName '$notes_ref'))} {(DQ <output_log_> ($ Id.VSub_DollarName '$notes_ref'))} ) ] ) ] ) ) (command.Pipeline children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 232 stdin_parts: [ <'6e8e3febca3c2bb896704335cc4d0c34cb2f8715 '> ($ Id.VSub_DollarName '$commit_sha4') <'\n'> <'e5388c10860456ee60673025345fe2e153eb8cf8 '> ($ Id.VSub_DollarName '$commit_sha3') <'\n'> <'ceefa674873670e7ecd131814d909723cce2b669 '> ($ Id.VSub_DollarName '$commit_sha2') <'\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<sort>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_notes_x>})] do_fork: T ) ] negated: F ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_log_x>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 261 stdin_parts: [ ($ Id.VSub_DollarName '$commit_sha5') <' 5th\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha4') <' 4th\n'> <'x notes on 4th commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha3') <' 3rd\n'> <'x notes on 3rd commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha2') <' 2nd\n'> <'x notes on 2nd commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha1') <' 1st\n'> <'\n'> ] ) ) ] do_fork: T ) (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'> ) } ) (command.Pipeline children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 301 stdin_parts: [ <'e2bfd06a37dd2031684a59a6e2b033e212239c78 '> ($ Id.VSub_DollarName '$commit_sha4') <'\n'> <'5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 '> ($ Id.VSub_DollarName '$commit_sha3') <'\n'> <'b0a6021ec006d07e80e9b20ec9b444cbd9d560d3 '> ($ Id.VSub_DollarName '$commit_sha1') <'\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<sort>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_notes_y>})] do_fork: T ) ] negated: F ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_log_y>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 330 stdin_parts: [ ($ Id.VSub_DollarName '$commit_sha5') <' 5th\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha4') <' 4th\n'> <'y notes on 4th commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha3') <' 3rd\n'> <'y notes on 3rd commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha2') <' 2nd\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha1') <' 1st\n'> <'y notes on 1st commit\n'> <'\n'> ] ) ) ] do_fork: T ) (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'> ) } ) (command.Pipeline children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 372 stdin_parts: [ <'cff59c793c20bb49a4e01bc06fb06bad642e0d54 '> ($ Id.VSub_DollarName '$commit_sha4') <'\n'> <'283b48219aee9a4105f6cab337e789065c82c2b9 '> ($ Id.VSub_DollarName '$commit_sha2') <'\n'> <'0a81da8956346e19bcb27a906f04af327e03e31b '> ($ Id.VSub_DollarName '$commit_sha1') <'\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<sort>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_notes_z>})] do_fork: T ) ] negated: F ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_log_z>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 401 stdin_parts: [ ($ Id.VSub_DollarName '$commit_sha5') <' 5th\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha4') <' 4th\n'> <'z notes on 4th commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha3') <' 3rd\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha2') <' 2nd\n'> <'z notes on 2nd commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha1') <' 1st\n'> <'z notes on 1st commit\n'> <'\n'> ] ) ) ] do_fork: T ) (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'> ) } ) (command.Pipeline children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 470 stdin_parts: [ ($ Id.VSub_DollarName '$commit_sha1') <'\n'> ($ Id.VSub_DollarName '$commit_sha2') <'\n'> ($ Id.VSub_DollarName '$commit_sha3') <'\n'> ($ Id.VSub_DollarName '$commit_sha4') <'\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<sort>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_conflicts>})] do_fork: T ) ] negated: F ) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expect_conflict_> ($ Id.VSub_DollarName '$commit_sha1')} ) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 487 stdin_parts: [ <'<<<<<<< refs/notes/m\n'> <'y notes on 1st commit\n'> <'=======\n'> <'z notes on 1st commit\n'> <'>>>>>>> refs/notes/z\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expect_conflict_> ($ Id.VSub_DollarName '$commit_sha2')} ) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 500 stdin_parts: [<'z notes on 2nd commit\n'>] ) ) ] do_fork: T ) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expect_conflict_> ($ Id.VSub_DollarName '$commit_sha3')} ) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 513 stdin_parts: [<'y notes on 3rd commit\n'>] ) ) ] do_fork: T ) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expect_conflict_> ($ Id.VSub_DollarName '$commit_sha4')} ) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 530 stdin_parts: [ <'<<<<<<< refs/notes/m\n'> <'y notes on 4th commit\n'> <'=======\n'> <'z notes on 4th commit\n'> <'>>>>>>> refs/notes/z\n'> ] ) ) ] do_fork: T ) (C {<cp>} {<expect_notes_y>} {<expect_notes_m>}) (C {<cp>} {<expect_log_y>} {<expect_log_m>}) (command.Simple words: [{<git>} {<rev-parse>} {<'refs/notes/y'>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<pre_merge_y>})] do_fork: T ) (command.Simple words: [{<git>} {<rev-parse>} {<'refs/notes/z'>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<pre_merge_z>})] do_fork: T ) (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'> ) } ) (command.Pipeline children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 615 stdin_parts: [ <'00494adecf2d9635a02fa431308d67993f853968 '> ($ Id.VSub_DollarName '$commit_sha4') <'\n'> <'283b48219aee9a4105f6cab337e789065c82c2b9 '> ($ Id.VSub_DollarName '$commit_sha2') <'\n'> <'0a81da8956346e19bcb27a906f04af327e03e31b '> ($ Id.VSub_DollarName '$commit_sha1') <'\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<sort>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_notes_z>})] do_fork: T ) ] negated: F ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_log_z>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 646 stdin_parts: [ ($ Id.VSub_DollarName '$commit_sha5') <' 5th\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha4') <' 4th\n'> <'z notes on 4th commit\n'> <'\n'> <'More z notes on 4th commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha3') <' 3rd\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha2') <' 2nd\n'> <'z notes on 2nd commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha1') <' 1st\n'> <'z notes on 1st commit\n'> <'\n'> ] ) ) ] do_fork: T ) (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'> ) } ) (command.Pipeline children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 699 stdin_parts: [ <'ceefa674873670e7ecd131814d909723cce2b669 '> ($ Id.VSub_DollarName '$commit_sha2') <'\n'> <'f75d1df88cbfe4258d49852f26cfc83f2ad4494b '> ($ Id.VSub_DollarName '$commit_sha1') <'\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<sort>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_notes_w>})] do_fork: T ) ] negated: F ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_log_w>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 727 stdin_parts: [ ($ Id.VSub_DollarName '$commit_sha5') <' 5th\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha4') <' 4th\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha3') <' 3rd\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha2') <' 2nd\n'> <'x notes on 2nd commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha1') <' 1st\n'> <'w notes on 1st commit\n'> <'\n'> ] ) ) ] do_fork: T ) (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'> ) } ) (command.Pipeline children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 769 stdin_parts: [ <'6e8e3febca3c2bb896704335cc4d0c34cb2f8715 '> ($ Id.VSub_DollarName '$commit_sha4') <'\n'> <'e5388c10860456ee60673025345fe2e153eb8cf8 '> ($ Id.VSub_DollarName '$commit_sha3') <'\n'> <'ceefa674873670e7ecd131814d909723cce2b669 '> ($ Id.VSub_DollarName '$commit_sha2') <'\n'> <'f75d1df88cbfe4258d49852f26cfc83f2ad4494b '> ($ Id.VSub_DollarName '$commit_sha1') <'\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<sort>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_notes_w>})] do_fork: T ) ] negated: F ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_log_w>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 799 stdin_parts: [ ($ Id.VSub_DollarName '$commit_sha5') <' 5th\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha4') <' 4th\n'> <'x notes on 4th commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha3') <' 3rd\n'> <'x notes on 3rd commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha2') <' 2nd\n'> <'x notes on 2nd commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha1') <' 1st\n'> <'w notes on 1st commit\n'> <'\n'> ] ) ) ] do_fork: T ) (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'> ) } ) (command.Pipeline children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 843 stdin_parts: [ <'021faa20e931fb48986ffc6282b4bb05553ac946 '> ($ Id.VSub_DollarName '$commit_sha4') <'\n'> <'5772f42408c0dd6f097a7ca2d24de0e78d1c46b1 '> ($ Id.VSub_DollarName '$commit_sha3') <'\n'> <'283b48219aee9a4105f6cab337e789065c82c2b9 '> ($ Id.VSub_DollarName '$commit_sha2') <'\n'> <'0a59e787e6d688aa6309e56e8c1b89431a0fc1c1 '> ($ Id.VSub_DollarName '$commit_sha1') <'\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<sort>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_notes_m>})] do_fork: T ) ] negated: F ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_log_m>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 873 stdin_parts: [ ($ Id.VSub_DollarName '$commit_sha5') <' 5th\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha4') <' 4th\n'> <'y and z notes on 4th commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha3') <' 3rd\n'> <'y notes on 3rd commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha2') <' 2nd\n'> <'z notes on 2nd commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha1') <' 1st\n'> <'y and z notes on 1st commit\n'> <'\n'> ] ) ) ] do_fork: T ) (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'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expect_conflict_> ($ Id.VSub_DollarName '$commit_sha4')} ) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 970 stdin_parts: [ <'<<<<<<< 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_fork: T ) (C {<cp>} {<expect_notes_y>} {<expect_notes_m>}) (C {<cp>} {<expect_log_y>} {<expect_log_m>}) (command.Simple words: [{<git>} {<rev-parse>} {<'refs/notes/y'>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<pre_merge_y>})] do_fork: T ) (command.Simple words: [{<git>} {<rev-parse>} {<'refs/notes/z'>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<pre_merge_z>})] do_fork: T ) (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'> ) } ) (command.Simple words: [{<git>} {<rev-parse>} {<'refs/notes/y'>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<pre_merge_y>})] do_fork: T ) (command.Simple words: [{<git>} {<rev-parse>} {<'refs/notes/z'>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<pre_merge_z>})] do_fork: T ) (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'> ) } ) (command.Pipeline children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 1123 stdin_parts: [ <'304dfb4325cf243025b9957486eb605a9b51c199 '> ($ Id.VSub_DollarName '$commit_sha5') <'\n'> <'283b48219aee9a4105f6cab337e789065c82c2b9 '> ($ Id.VSub_DollarName '$commit_sha2') <'\n'> <'0a59e787e6d688aa6309e56e8c1b89431a0fc1c1 '> ($ Id.VSub_DollarName '$commit_sha1') <'\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<sort>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_notes_m>})] do_fork: T ) ] negated: F ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_log_m>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 1152 stdin_parts: [ ($ Id.VSub_DollarName '$commit_sha5') <' 5th\n'> <'new note on 5th commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha4') <' 4th\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha3') <' 3rd\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha2') <' 2nd\n'> <'z notes on 2nd commit\n'> <'\n'> ($ Id.VSub_DollarName '$commit_sha1') <' 1st\n'> <'y and z notes on 1st commit\n'> <'\n'> ] ) ) ] do_fork: T ) (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'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect_notes>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 1339 stdin_parts: [<'foo\n'> <'bar\n'>] ) ) ] do_fork: T ) (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>}) ] )