(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.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'> ) } ) ] ) (C {(.)} {(./test-lib.sh)}) (command.FuncDef name: add_file body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:sm) op:Equal rhs:{($ VSub_Number '$1')})] ) (C {(shift)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:owd) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> ) } ) ] ) (C {(cd)} {(DQ ($ VSub_DollarName '$sm'))}) (command.ForEach iter_name: name do_arg_iter: T body: (command.DoGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp] children: [ (command.SimpleCommand words: [{(echo)} {(DQ ($ VSub_DollarName '$name'))}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ ($ VSub_DollarName '$name'))} ) ] ) (C {(git)} {(add)} {(DQ ($ VSub_DollarName '$name'))}) (C {(test_tick)}) (C {(git)} {(commit)} {(-m)} {(DQ ('Add ') ($ VSub_DollarName '$name'))}) ] ) ] ) redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) (command.Pipeline children: [(C {(git)} {(rev-parse)} {(--verify)} {(HEAD)}) (C {(cut)} {(-c1-7)})] negated: F ) (C {(cd)} {(DQ ($ VSub_DollarName '$owd'))}) ] ) ) (command.FuncDef name: commit_file body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(test_tick)}) (command.SimpleCommand words: [ {(git)} {(commit)} {(DQ ($ VSub_At '$@'))} {(-m)} {(DQ ('Commit ') ($ VSub_Star '$*'))} ] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] ) ] ) ) (command.AndOr ops: [Op_DAmp] children: [ (C {(test_create_repo)} {(sm1)}) (command.SimpleCommand words: [{(add_file)} {(.)} {(foo)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:head1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(add_file)} {(sm1)} {(foo1)} {(foo2)})] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (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_DollarName '$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_DollarName '$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_DollarName '$head1') (' (2):\n') (' > Add foo2\n') ('\n') ('EOF\n') ('\ttest_cmp expected actual\n') ) } ) (command.AndOr ops: [Op_DAmp] children: [ (C {(commit_file)} {(sm1)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:head2) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(add_file)} {(sm1)} {(foo3)})]) left_token: <Left_CommandSub '$('> ) } ) ] ) ] ) (C {(test_expect_success)} {(SQ <'modified submodule(forward)'>)} { (DQ ('\n') ('\tgit submodule summary >actual &&\n') ('\tcat >expected <<-EOF &&\n') ('* sm1 ') ($ VSub_DollarName '$head1') (...) ($ VSub_DollarName '$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_DollarName '$head1') (...) ($ VSub_DollarName '$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_DollarName '$head1') (...) ($ VSub_DollarName '$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') ) } ) (command.AndOr ops: [Op_DAmp] children: [ (C {(commit_file)} {(sm1)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:head3) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (C {(cd)} {(sm1)}) (command.SimpleCommand words: [{(git)} {(reset)} {(--hard)} {(HEAD) (Lit_TildeLike '~2')}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(/dev/null)} ) ] ) (command.Pipeline children: [ (C {(git)} {(rev-parse)} {(--verify)} {(HEAD)}) (C {(cut)} {(-c1-7)}) ] negated: F ) ] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) ] ) (C {(test_expect_success)} {(SQ <'modified submodule(backward)'>)} { (DQ ('\n') ('\tgit submodule summary >actual &&\n') ('\tcat >expected <<-EOF &&\n') ('* sm1 ') ($ VSub_DollarName '$head2') (...) ($ VSub_DollarName '$head3') (' (2):\n') (' < Add foo3\n') (' < Add foo2\n') ('\n') ('EOF\n') ('\ttest_cmp expected actual\n') ) } ) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:head4) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(add_file)} {(sm1)} {(foo4)} {(foo5)})] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:head4_full) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.SimpleCommand words: [{(git)} {(rev-parse)} {(--verify)} {(HEAD)}] more_env: [(env_pair name:GIT_DIR val:{(sm1/.git)})] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) ] ) (C {(test_expect_success)} {(SQ <'modified submodule(backward and forward)'>)} { (DQ ('\n') ('\tgit submodule summary >actual &&\n') ('\tcat >expected <<-EOF &&\n') ('* sm1 ') ($ VSub_DollarName '$head2') (...) ($ VSub_DollarName '$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_DollarName '$head2') (...) ($ VSub_DollarName '$head4') (' (4):\n') (' > Add foo5\n') (' > Add foo4\n') (' < Add foo3\n') ('\n') ('EOF\n') ('\ttest_cmp expected actual\n') ) } ) (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (C {(commit_file)} {(sm1)}) (C {(mv)} {(sm1)} {(sm1-bak)}) (command.SimpleCommand words: [{(echo)} {(sm1)}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(sm1)})] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:head5) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.Pipeline children: [(C {(git)} {(hash-object)} {(sm1)}) (C {(cut)} {(-c1-7)})] negated: F ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (C {(git)} {(add)} {(sm1)}) (C {(rm)} {(-f)} {(sm1)}) (C {(mv)} {(sm1-bak)} {(sm1)}) ] ) (C {(test_expect_success)} {(SQ <'typechanged submodule(submodule->blob), --cached'>)} { (DQ ('\n') ('\tgit submodule summary --cached >actual &&\n') ('\tcat >expected <<-EOF &&\n') ('* sm1 ') ($ VSub_DollarName '$head4') ('(submodule)->') ($ VSub_DollarName '$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_DollarName '$head5') ('(blob)->') ($ VSub_DollarName '$head4') ('(submodule) (3):\n') (' > Add foo5\n') ('\n') ('EOF\n') ('\ttest_i18ncmp actual expected\n') ) } ) (command.AndOr ops: [Op_DAmp] children: [(C {(rm)} {(-rf)} {(sm1)}) (C {(git)} {(checkout-index)} {(sm1)})] ) (C {(test_expect_success)} {(SQ <'typechanged submodule(submodule->blob)'>)} { (DQ ('\n') ('\tgit submodule summary >actual &&\n') ('\tcat >expected <<-EOF &&\n') ('* sm1 ') ($ VSub_DollarName '$head4') ('(submodule)->') ($ VSub_DollarName '$head5') ('(blob):\n') ('\n') ('EOF\n') ('\ttest_i18ncmp actual expected\n') ) } ) (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (C {(rm)} {(-f)} {(sm1)}) (C {(test_create_repo)} {(sm1)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:head6) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(add_file)} {(sm1)} {(foo6)} {(foo7)})] ) left_token: <Left_CommandSub '$('> ) } ) ] ) ] ) (C {(test_expect_success)} {(SQ <'nonexistent commit'>)} { (DQ ('\n') ('\tgit submodule summary >actual &&\n') ('\tcat >expected <<-EOF &&\n') ('* sm1 ') ($ VSub_DollarName '$head4') (...) ($ VSub_DollarName '$head6') (':\n') (" Warn: sm1 doesn't contain commit ") ($ VSub_DollarName '$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_DollarName '$head5') ('(blob)->') ($ VSub_DollarName '$head6') ('(submodule) (2):\n') (' > Add foo7\n') ('\n') ('EOF\n') ('\ttest_i18ncmp expected actual\n') ) } ) (command.AndOr ops: [Op_DAmp] children: [(C {(commit_file)} {(sm1)}) (C {(rm)} {(-rf)} {(sm1)})] ) (C {(test_expect_success)} {(SQ <'deleted submodule'>)} { (DQ ('\n') ('\tgit submodule summary >actual &&\n') ('\tcat >expected <<-EOF &&\n') ('* sm1 ') ($ VSub_DollarName '$head6') ('...0000000:\n') ('\n') ('EOF\n') ('\ttest_cmp expected actual\n') ) } ) (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (C {(test_create_repo)} {(sm2)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:head7) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(add_file)} {(sm2)} {(foo8)} {(foo9)})] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (C {(git)} {(add)} {(sm2)}) ] ) (C {(test_expect_success)} {(SQ <'multiple submodules'>)} { (DQ ('\n') ('\tgit submodule summary >actual &&\n') ('\tcat >expected <<-EOF &&\n') ('* sm1 ') ($ VSub_DollarName '$head6') ('...0000000:\n') ('\n') ('* sm2 0000000...') ($ VSub_DollarName '$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_DollarName '$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_DollarName '$head6') ('...0000000:\n') ('\n') ('* sm2 0000000...') ($ VSub_DollarName '$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_DollarName '$head6') ('...0000000:\n') ('\n') ('* sm2 0000000...') ($ VSub_DollarName '$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)}) ] )