(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description spids:[21]) 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: [21] ) ] spids: [21] ) (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 spids:[42]) op: Equal rhs: {($ VSub_Number '$1')} spids: [42] ) ] spids: [42] ) (C {(shift)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:owd spids:[49]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> spids: [50 52] ) } spids: [49] ) ] spids: [49] ) (C {(cd)} {(DQ ($ VSub_Name '$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_Name '$name'))}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ ($ VSub_Name '$name'))} ) ] ) (C {(git)} {(add)} {(DQ ($ VSub_Name '$name'))}) (C {(test_tick)}) (C {(git)} {(commit)} {(-m)} {(DQ ('Add ') ($ VSub_Name '$name'))}) ] ) ] spids: [67 113] ) redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] spids: [16777215 16777215] ) (command.Pipeline children: [(C {(git)} {(rev-parse)} {(--verify)} {(HEAD)}) (C {(cut)} {(-c1-7)})] negated: F ) (C {(cd)} {(DQ ($ VSub_Name '$owd'))}) ] spids: [39] ) spids: [34 38] ) (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)})] ) ] ) ] spids: [147] ) spids: [142 146] ) (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 spids:[192]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(add_file)} {(sm1)} {(foo1)} {(foo2)})] ) left_token: <Left_CommandSub '$('> spids: [193 201] ) } spids: [192] ) ] spids: [192] ) (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') ) } ) (command.AndOr ops: [Op_DAmp] children: [ (C {(commit_file)} {(sm1)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:head2 spids:[295]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(add_file)} {(sm1)} {(foo3)})]) left_token: <Left_CommandSub '$('> spids: [296 302] ) } spids: [295] ) ] spids: [295] ) ] ) (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') ) } ) (command.AndOr ops: [Op_DAmp] children: [ (C {(commit_file)} {(sm1)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:head3 spids:[385]) 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 '$('> spids: [386 425] ) } spids: [385] ) ] spids: [385] ) ] ) (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') ) } ) (command.AndOr ops: [Op_DAmp] children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:head4 spids:[451]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(add_file)} {(sm1)} {(foo4)} {(foo5)})] ) left_token: <Left_CommandSub '$('> spids: [452 460] ) } spids: [451] ) ] spids: [451] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:head4_full spids:[464]) 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)} spids:[466])] ) ] ) left_token: <Left_CommandSub '$('> spids: [465 476] ) } spids: [464] ) ] spids: [464] ) ] ) (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') ) } ) (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 spids:[550]) 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 '$('> spids: [551 563] ) } spids: [550] ) ] spids: [550] ) (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_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') ) } ) (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_Name '$head4') ('(submodule)->') ($ VSub_Name '$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 spids:[683]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(add_file)} {(sm1)} {(foo6)} {(foo7)})] ) left_token: <Left_CommandSub '$('> spids: [684 692] ) } spids: [683] ) ] spids: [683] ) ] ) (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') ) } ) (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_Name '$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 spids:[779]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [(C {(add_file)} {(sm2)} {(foo8)} {(foo9)})] ) left_token: <Left_CommandSub '$('> spids: [780 788] ) } spids: [779] ) ] spids: [779] ) (C {(git)} {(add)} {(sm2)}) ] ) (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)}) ] )