(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <'combined diff'>)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(.)} {(DQ ($ VSub_Name '$TEST_DIRECTORY')) (/diff-lib.sh)}) (FuncDef name: setup_helper body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:one) op: Equal rhs: {($ VSub_Number '$1')} spids: [30] ) (assign_pair lhs: (LhsName name:branch) op: Equal rhs: {($ VSub_Number '$2')} spids: [33] ) (assign_pair lhs: (LhsName name:side) op: Equal rhs: {($ VSub_Number '$3')} spids: [36] ) ] spids: [30] ) (AndOr children: [ (C {(git)} {(branch)} {($ VSub_Name '$side')} {($ VSub_Name '$branch')}) (AndOr children: [ (ForEach iter_name: l iter_words: [{($ VSub_Name '$one')} {(two)} {(three)} {(fyra)}] do_arg_iter: False body: (DoGroup children:[(C {(echo)} {($ VSub_Name '$l')})] spids:[69 77]) redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(file)} spids: [79] ) ] spids: [59 16777215] ) (AndOr children: [ (C {(git)} {(add)} {(file)}) (AndOr children: [ (C {(test_tick)}) (AndOr children: [ (C {(git)} {(commit)} {(-m)} {($ VSub_Name '$branch')}) (AndOr children: [ (C {(git)} {(checkout)} {($ VSub_Name '$side')}) (AndOr children: [ (ForEach iter_name: l iter_words: [ {($ VSub_Name '$one')} {(two)} {(three)} {(quatro)} ] do_arg_iter: False body: (DoGroup children: [(C {(echo)} {($ VSub_Name '$l')})] spids: [134 142] ) redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(file)} spids: [144] ) ] spids: [124 16777215] ) (AndOr children: [ (C {(git)} {(add)} {(file)}) (AndOr children: [ (C {(test_tick)}) (AndOr children: [ (C {(git)} {(commit)} {(-m)} {($ VSub_Name '$side')} ) (AndOr children: [ (C {(test_must_fail)} {(git)} {(merge)} {($ VSub_Name '$branch')} ) (AndOr children: [ (ForEach iter_name: l iter_words: [ {($ VSub_Name '$one')} {(three)} {(four)} ] do_arg_iter: False body: (DoGroup children: [ (C {(echo)} {($ VSub_Name '$l')} ) ] spids: [199 207] ) redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(file)} spids: [209] ) ] spids: [191 16777215] ) (AndOr children: [ (C {(git)} {(add)} {(file)}) (AndOr children: [ (C {(test_tick)}) (C {(git)} {(commit)} {(-m)} { (DQ ('merge ') ($ VSub_Name '$branch') (' into ') ($ VSub_Name '$side') ) } ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [27] ) spids: [22 26] ) (FuncDef name: verify_helper body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:it) op: Equal rhs: {($ VSub_Number '$1')} spids: [253] ) ] spids: [253] ) (AndOr children: [ (SimpleCommand words: [ {(sed)} {(-e)} { (SQ <'\n'> <'\t\t1,/^@@@/d\n'> <'\t\t/^ -/d\n'> <'\t\ts/^\\(.\\)./\\1/\n'> <'\t'> ) } {(DQ ($ VSub_Name '$it'))} ] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ ($ VSub_Name '$it') (.actual.1))} spids: [280] ) ] ) (AndOr children: [ (SimpleCommand words: [ {(sed)} {(-e)} { (SQ <'\n'> <'\t\t1,/^@@@/d\n'> <'\t\t/^- /d\n'> <'\t\ts/^.\\(.\\)/\\1/\n'> <'\t'> ) } {(DQ ($ VSub_Name '$it'))} ] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ ($ VSub_Name '$it') (.actual.2))} spids: [305] ) ] ) (AndOr children: [ (Pipeline children: [ (C {(git)} {(diff)} {(DQ ($ VSub_Name '$it') ('^'))} {(DQ ($ VSub_Name '$it'))} {(--)} ) (SimpleCommand words: [{(sed)} {(-e)} {(SQ <'1,/^@@/d'>)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ ($ VSub_Name '$it') (.expect.1))} spids: [340] ) ] ) ] negated: False ) (AndOr children: [ (C {(test_cmp)} {(DQ ($ VSub_Name '$it') (.expect.1))} {(DQ ($ VSub_Name '$it') (.actual.1))} ) (AndOr children: [ (Pipeline children: [ (C {(git)} {(diff)} {(DQ ($ VSub_Name '$it') ('^2'))} {(DQ ($ VSub_Name '$it'))} {(--)} ) (SimpleCommand words: [{(sed)} {(-e)} {(SQ <'1,/^@@/d'>)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ ($ VSub_Name '$it') (.expect.2))} spids: [390] ) ] ) ] negated: False ) (C {(test_cmp)} {(DQ ($ VSub_Name '$it') (.expect.2))} {(DQ ($ VSub_Name '$it') (.actual.2))} ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [250] ) spids: [245 249] ) (C {(test_expect_success)} {(setup)} { (SQ <'\n'> <'\t>file &&\n'> <'\tgit add file &&\n'> <'\ttest_tick &&\n'> <'\tgit commit -m initial &&\n'> <'\n'> <'\tgit branch withone &&\n'> <'\tgit branch sansone &&\n'> <'\n'> <'\tgit checkout withone &&\n'> <'\tsetup_helper one withone sidewithone &&\n'> <'\n'> <'\tgit checkout sansone &&\n'> <'\tsetup_helper "" sansone sidesansone\n'> ) } ) (C {(test_expect_success)} {(SQ <'check combined output (1)'>)} {(SQ <'\n'> <'\tgit show sidewithone -- >sidewithone &&\n'> <'\tverify_helper sidewithone\n'>)} ) (C {(test_expect_success)} {(SQ <'check combined output (2)'>)} {(SQ <'\n'> <'\tgit show sidesansone -- >sidesansone &&\n'> <'\tverify_helper sidesansone\n'>)} ) (C {(test_expect_success)} {(SQ <'diagnose truncated file'>)} { (SQ <'\n'> <'\t>file &&\n'> <'\tgit add file &&\n'> <'\tgit commit --amend -C HEAD &&\n'> <'\tgit show >out &&\n'> <'\tgrep "diff --cc file" out\n'> ) } ) (C {(test_expect_success)} {(SQ <'setup for --cc --raw'>)} { (SQ <'\n'> <'\tblob=$(echo file | git hash-object --stdin -w) &&\n'> <'\tbase_tree=$(echo "100644 blob $blob\tfile" | git mktree) &&\n'> <'\ttrees= &&\n'> <'\tfor i in $(test_seq 1 40)\n'> <'\tdo\n'> <'\t\tblob=$(echo file$i | git hash-object --stdin -w) &&\n'> <'\t\ttrees="$trees$(echo "100644 blob $blob\tfile" | git mktree)$LF"\n'> <'\tdone\n'> ) } ) (C {(test_expect_success)} {(SQ <'check --cc --raw with four trees'>)} { (SQ <'\n'> <'\tfour_trees=$(echo "$trees" | sed -e 4q) &&\n'> <'\tgit diff --cc --raw $four_trees $base_tree >out &&\n'> <'\t# Check for four leading colons in the output:\n'> <'\tgrep "^::::[^:]" out\n'> ) } ) (C {(test_expect_success)} {(SQ <'check --cc --raw with forty trees'>)} { (SQ <'\n'> <'\tgit diff --cc --raw $trees $base_tree >out &&\n'> <'\t# Check for forty leading colons in the output:\n'> <'\tgrep "^::::::::::::::::::::::::::::::::::::::::[^:]" out\n'> ) } ) (C {(test_expect_success)} {(SQ <'setup combined ignore spaces'>)} { (SQ <'\n'> <'\tgit checkout master &&\n'> <'\t>test &&\n'> <'\tgit add test &&\n'> <'\tgit commit -m initial &&\n'> <'\n'> <'\ttr -d Q <<-\\EOF >test &&\n'> <'\talways coalesce\n'> <'\teol space coalesce Q\n'> <'\tspace change coalesce\n'> <'\tall spa ces coalesce\n'> <'\teol spaces Q\n'> <'\tspace change\n'> <'\tall spa ces\n'> <'\tEOF\n'> <'\tgit commit -m "test space change" -a &&\n'> <'\n'> <'\tgit checkout -b side HEAD^ &&\n'> <'\ttr -d Q <<-\\EOF >test &&\n'> <'\talways coalesce\n'> <'\teol space coalesce\n'> <'\tspace change coalesce\n'> <'\tall spaces coalesce\n'> <'\teol spaces\n'> <'\tspace change\n'> <'\tall spaces\n'> <'\tEOF\n'> <'\tgit commit -m "test other space changes" -a &&\n'> <'\n'> <'\ttest_must_fail git merge master &&\n'> <'\ttr -d Q <<-\\EOF >test &&\n'> <'\teol spaces Q\n'> <'\tspace change\n'> <'\tall spa ces\n'> <'\tEOF\n'> <'\tgit commit -m merged -a\n'> ) } ) (C {(test_expect_success)} {(SQ <'check combined output (no ignore space)'>)} { (SQ <'\n'> <'\tgit show >actual.tmp &&\n'> <'\tsed -e "1,/^@@@/d" < actual.tmp >actual &&\n'> <'\ttr -d Q <<-\\EOF >expected &&\n'> <'\t--always coalesce\n'> <'\t- eol space coalesce\n'> <'\t- space change coalesce\n'> <'\t- all spaces coalesce\n'> <'\t- eol spaces\n'> <'\t- space change\n'> <'\t- all spaces\n'> <'\t -eol space coalesce Q\n'> <'\t -space change coalesce\n'> <'\t -all spa ces coalesce\n'> <'\t+ eol spaces Q\n'> <'\t+ space change\n'> <'\t+ all spa ces\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'check combined output (ignore space at eol)'>)} { (SQ <'\n'> <'\tgit show --ignore-space-at-eol >actual.tmp &&\n'> <'\tsed -e "1,/^@@@/d" < actual.tmp >actual &&\n'> <'\ttr -d Q <<-\\EOF >expected &&\n'> <'\t--always coalesce\n'> <'\t--eol space coalesce\n'> <'\t- space change coalesce\n'> <'\t- all spaces coalesce\n'> <'\t -space change coalesce\n'> <'\t -all spa ces coalesce\n'> <'\t eol spaces Q\n'> <'\t- space change\n'> <'\t- all spaces\n'> <'\t+ space change\n'> <'\t+ all spa ces\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'check combined output (ignore space change)'>)} { (SQ <'\n'> <'\tgit show -b >actual.tmp &&\n'> <'\tsed -e "1,/^@@@/d" < actual.tmp >actual &&\n'> <'\ttr -d Q <<-\\EOF >expected &&\n'> <'\t--always coalesce\n'> <'\t--eol space coalesce\n'> <'\t--space change coalesce\n'> <'\t- all spaces coalesce\n'> <'\t -all spa ces coalesce\n'> <'\t eol spaces Q\n'> <'\t space change\n'> <'\t- all spaces\n'> <'\t+ all spa ces\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'check combined output (ignore all spaces)'>)} { (SQ <'\n'> <'\tgit show -w >actual.tmp &&\n'> <'\tsed -e "1,/^@@@/d" < actual.tmp >actual &&\n'> <'\ttr -d Q <<-\\EOF >expected &&\n'> <'\t--always coalesce\n'> <'\t--eol space coalesce\n'> <'\t--space change coalesce\n'> <'\t--all spaces coalesce\n'> <'\t eol spaces Q\n'> <'\t space change\n'> <'\t all spa ces\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'combine diff coalesce simple'>)} { (SQ <'\n'> <'\t>test &&\n'> <'\tgit add test &&\n'> <'\tgit commit -m initial &&\n'> <'\ttest_seq 4 >test &&\n'> <'\tgit commit -a -m empty1 &&\n'> <'\tgit branch side1 &&\n'> <'\tgit checkout HEAD^ &&\n'> <'\ttest_seq 5 >test &&\n'> <'\tgit commit -a -m empty2 &&\n'> <'\ttest_must_fail git merge side1 &&\n'> <'\t>test &&\n'> <'\tgit commit -a -m merge &&\n'> <'\tgit show >actual.tmp &&\n'> <'\tsed -e "1,/^@@@/d" < actual.tmp >actual &&\n'> <'\ttr -d Q <<-\\EOF >expected &&\n'> <'\t--1\n'> <'\t--2\n'> <'\t--3\n'> <'\t--4\n'> <'\t- 5\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'combine diff coalesce tricky'>)} { (SQ <'\n'> <'\t>test &&\n'> <'\tgit add test &&\n'> <'\tgit commit -m initial --allow-empty &&\n'> <'\tcat <<-\\EOF >test &&\n'> <'\t3\n'> <'\t1\n'> <'\t2\n'> <'\t3\n'> <'\t4\n'> <'\tEOF\n'> <'\tgit commit -a -m empty1 &&\n'> <'\tgit branch -f side1 &&\n'> <'\tgit checkout HEAD^ &&\n'> <'\tcat <<-\\EOF >test &&\n'> <'\t1\n'> <'\t3\n'> <'\t5\n'> <'\t4\n'> <'\tEOF\n'> <'\tgit commit -a -m empty2 &&\n'> <'\tgit branch -f side2 &&\n'> <'\ttest_must_fail git merge side1 &&\n'> <'\t>test &&\n'> <'\tgit commit -a -m merge &&\n'> <'\tgit show >actual.tmp &&\n'> <'\tsed -e "1,/^@@@/d" < actual.tmp >actual &&\n'> <'\ttr -d Q <<-\\EOF >expected &&\n'> <'\t -3\n'> <'\t--1\n'> <'\t -2\n'> <'\t--3\n'> <'\t- 5\n'> <'\t--4\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected actual &&\n'> <'\tgit checkout -f side1 &&\n'> <'\ttest_must_fail git merge side2 &&\n'> <'\t>test &&\n'> <'\tgit commit -a -m merge &&\n'> <'\tgit show >actual.tmp &&\n'> <'\tsed -e "1,/^@@@/d" < actual.tmp >actual &&\n'> <'\ttr -d Q <<-\\EOF >expected &&\n'> <'\t- 3\n'> <'\t--1\n'> <'\t- 2\n'> <'\t--3\n'> <'\t -5\n'> <'\t--4\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected actual\n'> ) } ) (C {(test_expect_failure)} {(SQ <'combine diff coalesce three parents'>)} { (SQ <'\n'> <'\t>test &&\n'> <'\tgit add test &&\n'> <'\tgit commit -m initial --allow-empty &&\n'> <'\tcat <<-\\EOF >test &&\n'> <'\t3\n'> <'\t1\n'> <'\t2\n'> <'\t3\n'> <'\t4\n'> <'\tEOF\n'> <'\tgit commit -a -m empty1 &&\n'> <'\tgit checkout -B side1 &&\n'> <'\tgit checkout HEAD^ &&\n'> <'\tcat <<-\\EOF >test &&\n'> <'\t1\n'> <'\t3\n'> <'\t7\n'> <'\t5\n'> <'\t4\n'> <'\tEOF\n'> <'\tgit commit -a -m empty2 &&\n'> <'\tgit branch -f side2 &&\n'> <'\tgit checkout HEAD^ &&\n'> <'\tcat <<-\\EOF >test &&\n'> <'\t3\n'> <'\t1\n'> <'\t6\n'> <'\t5\n'> <'\t4\n'> <'\tEOF\n'> <'\tgit commit -a -m empty3 &&\n'> <'\t>test &&\n'> <'\tgit add test &&\n'> <'\tTREE=$(git write-tree) &&\n'> <'\tCOMMIT=$(git commit-tree -p HEAD -p side1 -p side2 -m merge $TREE) &&\n'> <'\tgit show $COMMIT >actual.tmp &&\n'> <'\tsed -e "1,/^@@@/d" < actual.tmp >actual &&\n'> <'\ttr -d Q <<-\\EOF >expected &&\n'> <'\t-- 3\n'> <'\t---1\n'> <'\t- 6\n'> <'\t - 2\n'> <'\t --3\n'> <'\t -7\n'> <'\t- -5\n'> <'\t---4\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'combine diff missing delete bug'>)} { (SQ <'\n'> <'\tgit commit -m initial --allow-empty &&\n'> <'\tcat <<-\\EOF >test &&\n'> <'\t1\n'> <'\t2\n'> <'\t3\n'> <'\t4\n'> <'\tEOF\n'> <'\tgit add test &&\n'> <'\tgit commit -a -m side1 &&\n'> <'\tgit checkout -B side1 &&\n'> <'\tgit checkout HEAD^ &&\n'> <'\tcat <<-\\EOF >test &&\n'> <'\t0\n'> <'\t1\n'> <'\t2\n'> <'\t3\n'> <'\t4modified\n'> <'\tEOF\n'> <'\tgit add test &&\n'> <'\tgit commit -m side2 &&\n'> <'\tgit branch -f side2 &&\n'> <'\ttest_must_fail git merge --no-commit side1 &&\n'> <'\tcat <<-\\EOF >test &&\n'> <'\t1\n'> <'\t2\n'> <'\t3\n'> <'\t4modified\n'> <'\tEOF\n'> <'\tgit add test &&\n'> <'\tgit commit -a -m merge &&\n'> <'\tgit diff-tree -c -p HEAD >actual.tmp &&\n'> <'\tsed -e "1,/^@@@/d" < actual.tmp >actual &&\n'> <'\ttr -d Q <<-\\EOF >expected &&\n'> <'\t- 0\n'> <'\t 1\n'> <'\t 2\n'> <'\t 3\n'> <'\t -4\n'> <'\t +4modified\n'> <'\tEOF\n'> <'\tcompare_diff_patch expected actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'combine diff gets tree sorting right'>)} { (SQ <'\n'> <'\t# create a directory and a file that sort differently in trees\n'> <'\t# versus byte-wise (implied "/" sorts after ".")\n'> <'\tgit checkout -f master &&\n'> <'\tmkdir foo &&\n'> <'\techo base >foo/one &&\n'> <'\techo base >foo/two &&\n'> <'\techo base >foo.ext &&\n'> <'\tgit add foo foo.ext &&\n'> <'\tgit commit -m base &&\n'> <'\n'> <'\t# one side modifies a file in the directory, along with the root\n'> <'\t# file...\n'> <'\techo master >foo/one &&\n'> <'\techo master >foo.ext &&\n'> <'\tgit commit -a -m master &&\n'> <'\n'> <'\t# the other side modifies the other file in the directory\n'> <'\tgit checkout -b other HEAD^ &&\n'> <'\techo other >foo/two &&\n'> <'\tgit commit -a -m other &&\n'> <'\n'> <'\t# And now we merge. The files in the subdirectory will resolve cleanly,\n'> <'\t# meaning that a combined diff will not find them interesting. But it\n'> <'\t# will find the tree itself interesting, because it had to be merged.\n'> <'\tgit checkout master &&\n'> <'\tgit merge other &&\n'> <'\n'> <'\tprintf "MM\\tfoo\\n" >expect &&\n'> <'\tgit diff-tree -c --name-status -t HEAD >actual.tmp &&\n'> <'\tsed 1d <actual.tmp >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_done)}) ] )