(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: { (SQ <"Summary support for submodules\n"> <"\n"> <"This test tries to verify the sanity of summary subcommand of git submodule.\n"> ) } spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (FuncDef name: add_file body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sm) op: Equal rhs: {($ VSub_Number "$1")} spids: [34] ) ] spids: [34] ) (C {(shift)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:owd) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub "$("> spids: [42 44] ) } spids: [41] ) ] spids: [41] ) (C {(cd)} {(DQ ($ VSub_Name "$sm"))}) (ForEach iter_name: name do_arg_iter: True body: (DoGroup children: [ (AndOr children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Name "$name"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Name "$name"))} spids: [68] ) ] ) (AndOr children: [ (C {(git)} {(add)} {(DQ ($ VSub_Name "$name"))}) (AndOr children: [ (C {(test_tick)}) (C {(git)} {(commit)} {(-m)} {(DQ ("Add ") ($ VSub_Name "$name"))}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [59 105] ) redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[107])] spids: [-1 -1] ) (Pipeline children: [(C {(git)} {(rev-parse)} {(--verify)} {(HEAD)}) (C {(cut)} {(-c1-7)})] negated: False ) (C {(cd)} {(DQ ($ VSub_Name "$owd"))}) ] spids: [31] ) spids: [26 30] ) (FuncDef name: commit_file body: (BraceGroup children: [ (AndOr children: [ (C {(test_tick)}) (SimpleCommand words: [ {(git)} {(commit)} {(DQ ($ VSub_At "$@"))} {(-m)} {(DQ ("Commit ") ($ VSub_Star "$*"))} ] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[162])] ) ] op_id: Op_DAmp ) ] spids: [139] ) spids: [134 138] ) (AndOr children: [ (C {(test_create_repo)} {(sm1)}) (SimpleCommand words: [{(add_file)} {(.)} {(foo)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[180])] ) ] op_id: Op_DAmp ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:head1) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(add_file)} {(sm1)} {(foo1)} {(foo2)})]) left_token: <Left_CommandSub "$("> spids: [185 193] ) } spids: [184] ) ] spids: [184] ) (C {(test_expect_success)} {(SQ <"added submodule">)} { (DQ ("\n") ("\tgit add sm1 &&\n") ("\tgit submodule summary >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 0000000...") ($ VSub_Name "$head1") (" (2):\n") (" > Add foo2\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual\n") ) } ) (C {(test_expect_success)} {(SQ <"added submodule (subdirectory)">)} { (DQ ("\n") ("\tmkdir sub &&\n") ("\t(\n") ("\t\tcd sub &&\n") ("\t\tgit submodule summary >../actual\n") ("\t) &&\n") ("\tcat >expected <<-EOF &&\n") ("* ../sm1 0000000...") ($ VSub_Name "$head1") (" (2):\n") (" > Add foo2\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual\n") ) } ) (C {(test_expect_success)} {(SQ <"added submodule (subdirectory only)">)} { (DQ ("\n") ("\t(\n") ("\t\tcd sub &&\n") ("\t\tgit submodule summary . >../actual\n") ("\t) &&\n") ("\t>expected &&\n") ("\ttest_cmp expected actual\n") ) } ) (C {(test_expect_success)} {(SQ <"added submodule (subdirectory with explicit path)">)} { (DQ ("\n") ("\t(\n") ("\t\tcd sub &&\n") ("\t\tgit submodule summary ../sm1 >../actual\n") ("\t) &&\n") ("\tcat >expected <<-EOF &&\n") ("* ../sm1 0000000...") ($ VSub_Name "$head1") (" (2):\n") (" > Add foo2\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual\n") ) } ) (AndOr children: [ (C {(commit_file)} {(sm1)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:head2) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(add_file)} {(sm1)} {(foo3)})]) left_token: <Left_CommandSub "$("> spids: [288 294] ) } spids: [287] ) ] spids: [287] ) ] op_id: Op_DAmp ) (C {(test_expect_success)} {(SQ <"modified submodule(forward)">)} { (DQ ("\n") ("\tgit submodule summary >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head1") (...) ($ VSub_Name "$head2") (" (1):\n") (" > Add foo3\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual\n") ) } ) (C {(test_expect_success)} {(SQ <"modified submodule(forward), --files">)} { (DQ ("\n") ("\tgit submodule summary --files >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head1") (...) ($ VSub_Name "$head2") (" (1):\n") (" > Add foo3\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual\n") ) } ) (C {(test_expect_success)} {(SQ <"no ignore=all setting has any effect">)} { (DQ ("\n") ("\tgit config -f .gitmodules submodule.sm1.path sm1 &&\n") ("\tgit config -f .gitmodules submodule.sm1.ignore all &&\n") ("\tgit config submodule.sm1.ignore all &&\n") ("\tgit config diff.ignoreSubmodules all &&\n") ("\tgit submodule summary >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head1") (...) ($ VSub_Name "$head2") (" (1):\n") (" > Add foo3\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual &&\n") ("\tgit config --unset diff.ignoreSubmodules &&\n") ("\tgit config --remove-section submodule.sm1 &&\n") ("\tgit config -f .gitmodules --remove-section submodule.sm1\n") ) } ) (AndOr children: [ (C {(commit_file)} {(sm1)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:head3) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr children: [ (C {(cd)} {(sm1)}) (AndOr children: [ (SimpleCommand words: [{(git)} {(reset)} {(--hard)} {(HEAD) (Lit_Tilde "~") (2)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [398] ) ] ) (Pipeline children: [ (C {(git)} {(rev-parse)} {(--verify)} {(HEAD)}) (C {(cut)} {(-c1-7)}) ] negated: False ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] ) left_token: <Left_CommandSub "$("> spids: [378 418] ) } spids: [377] ) ] spids: [377] ) ] op_id: Op_DAmp ) (C {(test_expect_success)} {(SQ <"modified submodule(backward)">)} { (DQ ("\n") ("\tgit submodule summary >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head2") (...) ($ VSub_Name "$head3") (" (2):\n") (" < Add foo3\n") (" < Add foo2\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual\n") ) } ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:head4) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(add_file)} {(sm1)} {(foo4)} {(foo5)})]) left_token: <Left_CommandSub "$("> spids: [445 453] ) } spids: [444] ) ] spids: [444] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:head4_full) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (SimpleCommand words: [{(git)} {(rev-parse)} {(--verify)} {(HEAD)}] more_env: [(env_pair name:GIT_DIR val:{(sm1/.git)} spids:[459])] ) ] ) left_token: <Left_CommandSub "$("> spids: [458 469] ) } spids: [457] ) ] spids: [457] ) ] op_id: Op_DAmp ) (C {(test_expect_success)} {(SQ <"modified submodule(backward and forward)">)} { (DQ ("\n") ("\tgit submodule summary >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head2") (...) ($ VSub_Name "$head4") (" (4):\n") (" > Add foo5\n") (" > Add foo4\n") (" < Add foo3\n") (" < Add foo2\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual\n") ) } ) (C {(test_expect_success)} {(SQ <--summary-limit>)} { (DQ ("\n") ("\tgit submodule summary -n 3 >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head2") (...) ($ VSub_Name "$head4") (" (4):\n") (" > Add foo5\n") (" > Add foo4\n") (" < Add foo3\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual\n") ) } ) (AndOr children: [ (C {(commit_file)} {(sm1)}) (AndOr children: [ (C {(mv)} {(sm1)} {(sm1-bak)}) (AndOr children: [ (SimpleCommand words: [{(echo)} {(sm1)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(sm1)} spids:[538])] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:head5) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(hash-object)} {(sm1)}) (C {(cut)} {(-c1-7)}) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [544 556] ) } spids: [543] ) ] spids: [543] ) (AndOr children: [ (C {(git)} {(add)} {(sm1)}) (AndOr children: [(C {(rm)} {(-f)} {(sm1)}) (C {(mv)} {(sm1-bak)} {(sm1)})] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) (C {(test_expect_success)} {(SQ <"typechanged submodule(submodule->blob), --cached">)} { (DQ ("\n") ("\tgit submodule summary --cached >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head4") ("(submodule)->") ($ VSub_Name "$head5") ("(blob) (3):\n") (" < Add foo5\n") ("\n") ("EOF\n") ("\ttest_i18ncmp actual expected\n") ) } ) (C {(test_expect_success)} {(SQ <"typechanged submodule(submodule->blob), --files">)} { (DQ ("\n") ("\tgit submodule summary --files >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head5") ("(blob)->") ($ VSub_Name "$head4") ("(submodule) (3):\n") (" > Add foo5\n") ("\n") ("EOF\n") ("\ttest_i18ncmp actual expected\n") ) } ) (AndOr children: [(C {(rm)} {(-rf)} {(sm1)}) (C {(git)} {(checkout-index)} {(sm1)})] op_id: Op_DAmp ) (C {(test_expect_success)} {(SQ <"typechanged submodule(submodule->blob)">)} { (DQ ("\n") ("\tgit submodule summary >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head4") ("(submodule)->") ($ VSub_Name "$head5") ("(blob):\n") ("\n") ("EOF\n") ("\ttest_i18ncmp actual expected\n") ) } ) (AndOr children: [ (C {(rm)} {(-f)} {(sm1)}) (AndOr children: [ (C {(test_create_repo)} {(sm1)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:head6) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(add_file)} {(sm1)} {(foo6)} {(foo7)})] ) left_token: <Left_CommandSub "$("> spids: [677 685] ) } spids: [676] ) ] spids: [676] ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) (C {(test_expect_success)} {(SQ <"nonexistent commit">)} { (DQ ("\n") ("\tgit submodule summary >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head4") (...) ($ VSub_Name "$head6") (":\n") (" Warn: sm1 doesn't contain commit ") ($ VSub_Name "$head4_full") ("\n") ("\n") ("EOF\n") ("\ttest_i18ncmp actual expected\n") ) } ) (C {(commit_file)}) (C {(test_expect_success)} {(SQ <"typechanged submodule(blob->submodule)">)} { (DQ ("\n") ("\tgit submodule summary >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head5") ("(blob)->") ($ VSub_Name "$head6") ("(submodule) (2):\n") (" > Add foo7\n") ("\n") ("EOF\n") ("\ttest_i18ncmp expected actual\n") ) } ) (AndOr children:[(C {(commit_file)} {(sm1)})(C {(rm)} {(-rf)} {(sm1)})] op_id:Op_DAmp) (C {(test_expect_success)} {(SQ <"deleted submodule">)} { (DQ ("\n") ("\tgit submodule summary >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head6") ("...0000000:\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual\n") ) } ) (AndOr children: [ (C {(test_create_repo)} {(sm2)}) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:head7) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(add_file)} {(sm2)} {(foo8)} {(foo9)})] ) left_token: <Left_CommandSub "$("> spids: [773 781] ) } spids: [772] ) ] spids: [772] ) (C {(git)} {(add)} {(sm2)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) (C {(test_expect_success)} {(SQ <"multiple submodules">)} { (DQ ("\n") ("\tgit submodule summary >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head6") ("...0000000:\n") ("\n") ("* sm2 0000000...") ($ VSub_Name "$head7") (" (2):\n") (" > Add foo9\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual\n") ) } ) (C {(test_expect_success)} {(SQ <"path filter">)} { (DQ ("\n") ("\tgit submodule summary sm2 >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm2 0000000...") ($ VSub_Name "$head7") (" (2):\n") (" > Add foo9\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual\n") ) } ) (C {(commit_file)} {(sm2)}) (C {(test_expect_success)} {(SQ <"given commit">)} { (DQ ("\n") ("\tgit submodule summary HEAD^ >actual &&\n") ("\tcat >expected <<-EOF &&\n") ("* sm1 ") ($ VSub_Name "$head6") ("...0000000:\n") ("\n") ("* sm2 0000000...") ($ VSub_Name "$head7") (" (2):\n") (" > Add foo9\n") ("\n") ("EOF\n") ("\ttest_cmp expected actual\n") ) } ) (C {(test_expect_success)} {(SQ <--for-status>)} { (DQ ("\n") ("\tgit submodule summary --for-status HEAD^ >actual &&\n") ("\ttest_i18ncmp actual - <<EOF\n") ("* sm1 ") ($ VSub_Name "$head6") ("...0000000:\n") ("\n") ("* sm2 0000000...") ($ VSub_Name "$head7") (" (2):\n") (" > Add foo9\n") ("\n") ("EOF\n") ) } ) (C {(test_expect_success)} {(SQ <"fail when using --files together with --cached">)} {(DQ ("\n") ("\ttest_must_fail git submodule summary --files --cached\n"))} ) (C {(test_expect_success)} {(SQ <"should not fail in an empty repo">)} { (DQ ("\n") ("\tgit init xyzzy &&\n") ("\tcd xyzzy &&\n") ("\tgit submodule summary >output 2>&1 &&\n") ("\ttest_cmp output /dev/null\n") ) } ) (C {(test_done)}) ] )