(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_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] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: add_file body: (BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sm) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [34] ) ] ) (C {<shift>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:owd) op: assign_op.Equal rhs: {(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<pwd>}))} spids: [41] ) ] ) (C {<cd>} {(DQ ($ Id.VSub_DollarName '$sm'))}) (command.ForEach iter_names: [name] iterable: (for_iter.Args) body: (command.DoGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$name'))}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_DollarName '$name'))} ) ] do_fork: T ) (C {<git>} {<add>} {(DQ ($ Id.VSub_DollarName '$name'))}) (C {<test_tick>}) (C {<git>} {<commit>} {<-m>} {(DQ <'Add '> ($ Id.VSub_DollarName '$name'))}) ] ) ] ) redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})] ) (command.Pipeline children: [(C {<git>} {<rev-parse>} {<--verify>} {<HEAD>}) (C {<cut>} {<-c1-7>})] negated: F ) (C {<cd>} {(DQ ($ Id.VSub_DollarName '$owd'))}) ] ) ) (command.ShFunction name: commit_file body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<test_tick>}) (command.Simple words: [ {<git>} {<commit>} {(DQ ($ Id.VSub_At '$@'))} {<-m>} {(DQ <'Commit '> ($ Id.VSub_Star '$*'))} ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) ] ) ] ) ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<test_create_repo>} {<sm1>}) (command.Simple words: [{<add_file>} {<.>} {<foo>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})] do_fork: T ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:head1) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<add_file>} {<sm1>} {<foo1>} {<foo2>}) ) } 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...'> ($ Id.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...'> ($ Id.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...'> ($ Id.VSub_DollarName '$head1') <' (2):\n'> <' > Add foo2\n'> <'\n'> <'EOF\n'> <'\ttest_cmp expected actual\n'> ) } ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<commit_file>} {<sm1>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:head2) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<add_file>} {<sm1>} {<foo3>}) ) } spids: [287] ) ] ) ] ) (C {<test_expect_success>} {(SQ <'modified submodule(forward)'>)} { (DQ <'\n'> <'\tgit submodule summary >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'* sm1 '> ($ Id.VSub_DollarName '$head1') <...> ($ Id.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 '> ($ Id.VSub_DollarName '$head1') <...> ($ Id.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 '> ($ Id.VSub_DollarName '$head1') <...> ($ Id.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: [Id.Op_DAmp] children: [ (C {<commit_file>} {<sm1>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:head3) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {<cd>} {<sm1>}) (command.Simple words: [{<git>} {<reset>} {<--hard>} {<HEAD> <Id.Lit_TildeLike '~2'>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] do_fork: T ) (command.Pipeline children: [ (C {<git>} {<rev-parse>} {<--verify>} {<HEAD>}) (C {<cut>} {<-c1-7>}) ] negated: F ) ] ) ) } spids: [377] ) ] ) ] ) (C {<test_expect_success>} {(SQ <'modified submodule(backward)'>)} { (DQ <'\n'> <'\tgit submodule summary >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'* sm1 '> ($ Id.VSub_DollarName '$head2') <...> ($ Id.VSub_DollarName '$head3') <' (2):\n'> <' < Add foo3\n'> <' < Add foo2\n'> <'\n'> <'EOF\n'> <'\ttest_cmp expected actual\n'> ) } ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:head4) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<add_file>} {<sm1>} {<foo4>} {<foo5>}) ) } spids: [443] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:head4_full) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Simple words: [{<git>} {<rev-parse>} {<--verify>} {<HEAD>}] more_env: [(env_pair name:GIT_DIR val:{<'sm1/.git'>} spids:[458])] do_fork: T ) ) } spids: [456] ) ] ) ] ) (C {<test_expect_success>} {(SQ <'modified submodule(backward and forward)'>)} { (DQ <'\n'> <'\tgit submodule summary >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'* sm1 '> ($ Id.VSub_DollarName '$head2') <...> ($ Id.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 '> ($ Id.VSub_DollarName '$head2') <...> ($ Id.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: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<commit_file>} {<sm1>}) (C {<mv>} {<sm1>} {<sm1-bak>}) (command.Simple words: [{<echo>} {<sm1>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<sm1>})] do_fork: T ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:head5) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [(C {<git>} {<hash-object>} {<sm1>}) (C {<cut>} {<-c1-7>})] negated: F ) ) } spids: [542] ) ] ) (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 '> ($ Id.VSub_DollarName '$head4') <'(submodule)->'> ($ Id.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 '> ($ Id.VSub_DollarName '$head5') <'(blob)->'> ($ Id.VSub_DollarName '$head4') <'(submodule) (3):\n'> <' > Add foo5\n'> <'\n'> <'EOF\n'> <'\ttest_i18ncmp actual expected\n'> ) } ) (command.AndOr ops: [Id.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 '> ($ Id.VSub_DollarName '$head4') <'(submodule)->'> ($ Id.VSub_DollarName '$head5') <'(blob):\n'> <'\n'> <'EOF\n'> <'\ttest_i18ncmp actual expected\n'> ) } ) (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {<rm>} {<-f>} {<sm1>}) (C {<test_create_repo>} {<sm1>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:head6) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<add_file>} {<sm1>} {<foo6>} {<foo7>}) ) } spids: [675] ) ] ) ] ) (C {<test_expect_success>} {(SQ <'nonexistent commit'>)} { (DQ <'\n'> <'\tgit submodule summary >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'* sm1 '> ($ Id.VSub_DollarName '$head4') <...> ($ Id.VSub_DollarName '$head6') <':\n'> <' Warn: sm1 doesn\'t contain commit '> ($ Id.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 '> ($ Id.VSub_DollarName '$head5') <'(blob)->'> ($ Id.VSub_DollarName '$head6') <'(submodule) (2):\n'> <' > Add foo7\n'> <'\n'> <'EOF\n'> <'\ttest_i18ncmp expected actual\n'> ) } ) (command.AndOr ops: [Id.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 '> ($ Id.VSub_DollarName '$head6') <'...0000000:\n'> <'\n'> <'EOF\n'> <'\ttest_cmp expected actual\n'> ) } ) (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (C {<test_create_repo>} {<sm2>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:head7) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<add_file>} {<sm2>} {<foo8>} {<foo9>}) ) } spids: [771] ) ] ) (C {<git>} {<add>} {<sm2>}) ] ) (C {<test_expect_success>} {(SQ <'multiple submodules'>)} { (DQ <'\n'> <'\tgit submodule summary >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'* sm1 '> ($ Id.VSub_DollarName '$head6') <'...0000000:\n'> <'\n'> <'* sm2 0000000...'> ($ Id.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...'> ($ Id.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 '> ($ Id.VSub_DollarName '$head6') <'...0000000:\n'> <'\n'> <'* sm2 0000000...'> ($ Id.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 '> ($ Id.VSub_DollarName '$head6') <'...0000000:\n'> <'\n'> <'* sm2 0000000...'> ($ Id.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>}) ] )