(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'difference in submodules'>)} spids: [4] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<.>} {(DQ ($ Id.VSub_DollarName TEST_DIRECTORY)) <'/diff-lib.sh'>}) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\ttest_tick &&\n'> <'\ttest_create_repo sub &&\n'> <'\t(\n'> <'\t\tcd sub &&\n'> <'\t\techo hello >world &&\n'> <'\t\tgit add world &&\n'> <'\t\tgit commit -m submodule\n'> <'\t) &&\n'> <'\n'> <'\ttest_tick &&\n'> <'\techo frotz >nitfol &&\n'> <'\tgit add nitfol sub &&\n'> <'\tgit commit -m superproject &&\n'> <'\n'> <'\t(\n'> <'\t\tcd sub &&\n'> <'\t\techo goodbye >world &&\n'> <'\t\tgit add world &&\n'> <'\t\tgit commit -m "submodule #2"\n'> <'\t) &&\n'> <'\n'> <'\tset x $(\n'> <'\t\tcd sub &&\n'> <'\t\tgit rev-list HEAD\n'> <'\t) &&\n'> <'\techo ":160000 160000 $3 $_z40 M\tsub" >expect &&\n'> <'\tsubtip=$3 subprev=$2\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff --raw HEAD'>)} {(SQ <'\n'> <'\tgit diff --raw --abbrev=40 HEAD >actual &&\n'> <'\ttest_cmp expect actual\n'>)} ) (C {<test_expect_success>} {(SQ <'git diff-index --raw HEAD'>)} { (SQ <'\n'> <'\tgit diff-index --raw HEAD >actual.index &&\n'> <'\ttest_cmp expect actual.index\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff-files --raw'>)} {(SQ <'\n'> <'\tgit diff-files --raw >actual.files &&\n'> <'\ttest_cmp expect actual.files\n'>)} ) (command.ShFunction name: expect_from_to body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (C {<printf>} { (DQ <'%sSubproject commit %s'> <Id.Lit_BadBackslash '\\'> <'n+Subproject commit %s'> <Id.Lit_BadBackslash '\\'> <n> ) } {(DQ <->)} {(DQ ($ Id.VSub_Number 1))} {(DQ ($ Id.VSub_Number 2))} ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {(SQ <'git diff HEAD'>)} { (SQ <'\n'> <'\tgit diff HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subtip $subprev &&\n'> <'\ttest_cmp expect.body actual.body\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff HEAD with dirty submodule (work tree)'>)} { (SQ <'\n'> <'\techo >>sub/world &&\n'> <'\tgit diff HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subtip $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual.body\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff HEAD with dirty submodule (index)'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd sub &&\n'> <'\t\tgit reset --hard &&\n'> <'\t\techo >>world &&\n'> <'\t\tgit add world\n'> <'\t) &&\n'> <'\tgit diff HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subtip $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual.body\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff HEAD with dirty submodule (untracked)'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd sub &&\n'> <'\t\tgit reset --hard &&\n'> <'\t\tgit clean -qfdx &&\n'> <'\t\t>cruft\n'> <'\t) &&\n'> <'\tgit diff HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subtip $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual.body\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff HEAD with dirty submodule (work tree, refs match)'>)} { (SQ <'\n'> <'\tgit commit -m "x" sub &&\n'> <'\techo >>sub/world &&\n'> <'\tgit diff HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subprev $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit diff --ignore-submodules HEAD >actual2 &&\n'> <'\t! test -s actual2 &&\n'> <'\tgit diff --ignore-submodules=untracked HEAD >actual3 &&\n'> <'\tsed -e "1,/^@@/d" actual3 >actual3.body &&\n'> <'\texpect_from_to >expect.body $subprev $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual3.body &&\n'> <'\tgit diff --ignore-submodules=dirty HEAD >actual4 &&\n'> <'\t! test -s actual4\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff HEAD with dirty submodule (work tree, refs match) [.git/config]'>)} { (SQ <'\n'> <'\tgit config diff.ignoreSubmodules all &&\n'> <'\tgit diff HEAD >actual &&\n'> <'\t! test -s actual &&\n'> <'\tgit config submodule.subname.ignore none &&\n'> <'\tgit config submodule.subname.path sub &&\n'> <'\tgit diff HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subprev $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit config submodule.subname.ignore all &&\n'> <'\tgit diff HEAD >actual2 &&\n'> <'\t! test -s actual2 &&\n'> <'\tgit config submodule.subname.ignore untracked &&\n'> <'\tgit diff HEAD >actual3 &&\n'> <'\tsed -e "1,/^@@/d" actual3 >actual3.body &&\n'> <'\texpect_from_to >expect.body $subprev $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual3.body &&\n'> <'\tgit config submodule.subname.ignore dirty &&\n'> <'\tgit diff HEAD >actual4 &&\n'> <'\t! test -s actual4 &&\n'> <'\tgit diff HEAD --ignore-submodules=none >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subprev $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit config --remove-section submodule.subname &&\n'> <'\tgit config --unset diff.ignoreSubmodules\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff HEAD with dirty submodule (work tree, refs match) [.gitmodules]'>)} { (SQ <'\n'> <'\tgit config diff.ignoreSubmodules dirty &&\n'> <'\tgit diff HEAD >actual &&\n'> <'\t! test -s actual &&\n'> <'\tgit config --add -f .gitmodules submodule.subname.ignore none &&\n'> <'\tgit config --add -f .gitmodules submodule.subname.path sub &&\n'> <'\tgit diff HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subprev $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit config -f .gitmodules submodule.subname.ignore all &&\n'> <'\tgit config -f .gitmodules submodule.subname.path sub &&\n'> <'\tgit diff HEAD >actual2 &&\n'> <'\t! test -s actual2 &&\n'> <'\tgit config -f .gitmodules submodule.subname.ignore untracked &&\n'> <'\tgit diff HEAD >actual3 &&\n'> <'\tsed -e "1,/^@@/d" actual3 >actual3.body &&\n'> <'\texpect_from_to >expect.body $subprev $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual3.body &&\n'> <'\tgit config -f .gitmodules submodule.subname.ignore dirty &&\n'> <'\tgit diff HEAD >actual4 &&\n'> <'\t! test -s actual4 &&\n'> <'\tgit config submodule.subname.ignore none &&\n'> <'\tgit config submodule.subname.path sub &&\n'> <'\tgit diff HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subprev $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit config --remove-section submodule.subname &&\n'> <'\tgit config --remove-section -f .gitmodules submodule.subname &&\n'> <'\tgit config --unset diff.ignoreSubmodules &&\n'> <'\trm .gitmodules\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff HEAD with dirty submodule (index, refs match)'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd sub &&\n'> <'\t\tgit reset --hard &&\n'> <'\t\techo >>world &&\n'> <'\t\tgit add world\n'> <'\t) &&\n'> <'\tgit diff HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subprev $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual.body\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff HEAD with dirty submodule (untracked, refs match)'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd sub &&\n'> <'\t\tgit reset --hard &&\n'> <'\t\tgit clean -qfdx &&\n'> <'\t\t>cruft\n'> <'\t) &&\n'> <'\tgit diff HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subprev $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit diff --ignore-submodules=all HEAD >actual2 &&\n'> <'\t! test -s actual2 &&\n'> <'\tgit diff --ignore-submodules=untracked HEAD >actual3 &&\n'> <'\t! test -s actual3 &&\n'> <'\tgit diff --ignore-submodules=dirty HEAD >actual4 &&\n'> <'\t! test -s actual4\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff HEAD with dirty submodule (untracked, refs match) [.git/config]'>)} { (SQ <'\n'> <'\tgit config submodule.subname.ignore all &&\n'> <'\tgit config submodule.subname.path sub &&\n'> <'\tgit diff HEAD >actual2 &&\n'> <'\t! test -s actual2 &&\n'> <'\tgit config submodule.subname.ignore untracked &&\n'> <'\tgit diff HEAD >actual3 &&\n'> <'\t! test -s actual3 &&\n'> <'\tgit config submodule.subname.ignore dirty &&\n'> <'\tgit diff HEAD >actual4 &&\n'> <'\t! test -s actual4 &&\n'> <'\tgit diff --ignore-submodules=none HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subprev $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit config --remove-section submodule.subname\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff HEAD with dirty submodule (untracked, refs match) [.gitmodules]'>)} { (SQ <'\n'> <'\tgit config --add -f .gitmodules submodule.subname.ignore all &&\n'> <'\tgit config --add -f .gitmodules submodule.subname.path sub &&\n'> <'\tgit diff HEAD >actual2 &&\n'> <'\t! test -s actual2 &&\n'> <'\tgit config -f .gitmodules submodule.subname.ignore untracked &&\n'> <'\tgit diff HEAD >actual3 &&\n'> <'\t! test -s actual3 &&\n'> <'\tgit config -f .gitmodules submodule.subname.ignore dirty &&\n'> <'\tgit diff HEAD >actual4 &&\n'> <'\t! test -s actual4 &&\n'> <'\tgit config submodule.subname.ignore none &&\n'> <'\tgit config submodule.subname.path sub &&\n'> <'\tgit diff HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subprev $subprev-dirty &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit config --remove-section submodule.subname &&\n'> <'\tgit config --remove-section -f .gitmodules submodule.subname &&\n'> <'\trm .gitmodules\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff between submodule commits'>)} { (SQ <'\n'> <'\tgit diff HEAD^..HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subtip $subprev &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit diff --ignore-submodules=dirty HEAD^..HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subtip $subprev &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit diff --ignore-submodules HEAD^..HEAD >actual &&\n'> <'\t! test -s actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff between submodule commits [.git/config]'>)} { (SQ <'\n'> <'\tgit diff HEAD^..HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subtip $subprev &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit config submodule.subname.ignore dirty &&\n'> <'\tgit config submodule.subname.path sub &&\n'> <'\tgit diff HEAD^..HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subtip $subprev &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit config submodule.subname.ignore all &&\n'> <'\tgit diff HEAD^..HEAD >actual &&\n'> <'\t! test -s actual &&\n'> <'\tgit diff --ignore-submodules=dirty HEAD^..HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subtip $subprev &&\n'> <'\tgit config --remove-section submodule.subname\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff between submodule commits [.gitmodules]'>)} { (SQ <'\n'> <'\tgit diff HEAD^..HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subtip $subprev &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit config --add -f .gitmodules submodule.subname.ignore dirty &&\n'> <'\tgit config --add -f .gitmodules submodule.subname.path sub &&\n'> <'\tgit diff HEAD^..HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subtip $subprev &&\n'> <'\ttest_cmp expect.body actual.body &&\n'> <'\tgit config -f .gitmodules submodule.subname.ignore all &&\n'> <'\tgit diff HEAD^..HEAD >actual &&\n'> <'\t! test -s actual &&\n'> <'\tgit config submodule.subname.ignore dirty &&\n'> <'\tgit config submodule.subname.path sub &&\n'> <'\tgit diff HEAD^..HEAD >actual &&\n'> <'\tsed -e "1,/^@@/d" actual >actual.body &&\n'> <'\texpect_from_to >expect.body $subtip $subprev &&\n'> <'\tgit config --remove-section submodule.subname &&\n'> <'\tgit config --remove-section -f .gitmodules submodule.subname &&\n'> <'\trm .gitmodules\n'> ) } ) (C {<test_expect_success>} {(SQ <'git diff (empty submodule dir)'>)} { (SQ <'\n'> <'\t: >empty &&\n'> <'\trm -rf sub/* sub/.git &&\n'> <'\tgit diff > actual.empty &&\n'> <'\ttest_cmp empty actual.empty\n'> ) } ) (C {<test_expect_success>} {(SQ <'conflicted submodule setup'>)} { (SQ <'\n'> <'\n'> <'\t# 39 efs\n'> <'\tc=fffffffffffffffffffffffffffffffffffffff &&\n'> <'\t(\n'> <'\t\techo "000000 $_z40 0\tsub" &&\n'> <'\t\techo "160000 1$c 1\tsub" &&\n'> <'\t\techo "160000 2$c 2\tsub" &&\n'> <'\t\techo "160000 3$c 3\tsub"\n'> <'\t) | git update-index --index-info &&\n'> <'\techo >expect.nosub '> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <'diff --cc sub\n'> <'index 2ffffff,3ffffff..0000000\n'> <'--- a/sub\n'> <'+++ b/sub\n'> <'@@@ -1,1 -1,1 +1,1 @@@\n'> <'- Subproject commit 2fffffffffffffffffffffffffffffffffffffff\n'> <' -Subproject commit 3fffffffffffffffffffffffffffffffffffffff\n'> <'++Subproject commit 0000000000000000000000000000000000000000'> ) (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\''> ch:'\'') (SQ <' &&\n'> <'\n'> <'\thh=$(git rev-parse HEAD) &&\n'> <'\tsed -e "s/$_z40/$hh/" expect.nosub >expect.withsub\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'combined (empty submodule)'>)} { (SQ <'\n'> <'\trm -fr sub && mkdir sub &&\n'> <'\tgit diff >actual &&\n'> <'\ttest_cmp expect.nosub actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'combined (with submodule)'>)} { (SQ <'\n'> <'\trm -fr sub &&\n'> <'\tgit clone --no-checkout . sub &&\n'> <'\tgit diff >actual &&\n'> <'\ttest_cmp expect.withsub actual\n'> ) } ) (C {<test_done>}) ] )