(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 <'Test for submodule diff on non-checked out submodule\n'> <'\n'> <'This test tries to verify that add_submodule_odb works when the submodule was\n'> <'initialized previously but the checkout has since been removed.\n'> ) } spids: [13] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_encoding='> name:test_encoding) op: assign_op.Equal rhs: {(DQ <ISO8859-1>)} spids: [30] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'added='> name:added) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<printf>} { (DQ <hinzugef> <Id.Lit_BadBackslash '\\'> <303> <Id.Lit_BadBackslash '\\'> <274gt>) } ) right: <Id.Eof_RParen _> ) } spids: [42] ) ] redirects: [] ) (command.ShFunction name: add_file body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<cd>} {(DQ ($ Id.VSub_Number 1))}) (C {<shift>}) (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))} ) ] more_env: [] do_fork: T ) (C {<git>} {<add>} {(DQ ($ Id.VSub_DollarName name))}) (C {<test_tick>}) (command.Pipeline children: [ (C {<echo>} { (DQ <'Add '> ($ Id.VSub_DollarName name) <' ('> ($ Id.VSub_DollarName added) <' '> ($ Id.VSub_DollarName name) <')'> ) } ) (C {<iconv>} {<-f>} {<utf-8>} {<-t>} {($ Id.VSub_DollarName test_encoding)} ) (C {<git>} {<-c>} { (DQ <'i18n.commitEncoding='> ($ Id.VSub_DollarName test_encoding) ) } {<commit>} {<-F>} {<->} ) ] negated: F stderr_indices: [] ) ] ) ] ) redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) ] ) (C {<git>} {<rev-parse>} {<--short>} {<--verify>} {<HEAD>}) ] ) redirects: [] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: commit_file body: (BraceGroup left: <Id.Lit_LBrace '{'> 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'>} ) ] more_env: [] do_fork: T ) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {(SQ <'setup - submodules'>)} { (SQ <'\n'> <'\ttest_create_repo sm2 &&\n'> <'\tadd_file . foo &&\n'> <'\tadd_file sm2 foo1 foo2 &&\n'> <'\tsmhead1=$(git -C sm2 rev-parse --short --verify HEAD)\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup - git submodule add'>)} { (SQ <'\n'> <'\tgit submodule add ./sm2 sm1 &&\n'> <'\tcommit_file sm1 .gitmodules &&\n'> <'\tgit diff-tree -p --no-commit-id --submodule=log HEAD -- sm1 >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 0000000...$smhead1 (new submodule)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'submodule directory removed'>)} { (SQ <'\n'> <'\trm -rf sm1 &&\n'> <'\tgit diff-tree -p --no-commit-id --submodule=log HEAD -- sm1 >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 0000000...$smhead1 (new submodule)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup - submodule multiple commits'>)} { (SQ <'\n'> <'\tgit submodule update --checkout sm1 &&\n'> <'\tsmhead2=$(add_file sm1 foo3 foo4) &&\n'> <'\tcommit_file sm1 &&\n'> <'\tgit diff-tree -p --no-commit-id --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $smhead1..$smhead2:\n'> <'\t > Add foo4 ($added foo4)\n'> <'\t > Add foo3 ($added foo3)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'submodule removed multiple commits'>)} { (SQ <'\n'> <'\trm -rf sm1 &&\n'> <'\tgit diff-tree -p --no-commit-id --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $smhead1..$smhead2:\n'> <'\t > Add foo4 ($added foo4)\n'> <'\t > Add foo3 ($added foo3)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'submodule not initialized in new clone'>)} { (SQ <'\n'> <'\tgit clone . sm3 &&\n'> <'\tgit -C sm3 diff-tree -p --no-commit-id --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm1 $smhead1...$smhead2 (not initialized)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup submodule moved'>)} { (SQ <'\n'> <'\tgit submodule update --checkout sm1 &&\n'> <'\tgit mv sm1 sm4 &&\n'> <'\tcommit_file sm4 &&\n'> <'\tgit diff-tree -p --no-commit-id --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm4 0000000...$smhead2 (new submodule)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'submodule moved then removed'>)} { (SQ <'\n'> <'\tsmhead3=$(add_file sm4 foo6 foo7) &&\n'> <'\tcommit_file sm4 &&\n'> <'\trm -rf sm4 &&\n'> <'\tgit diff-tree -p --no-commit-id --submodule=log HEAD >actual &&\n'> <'\tcat >expected <<-EOF &&\n'> <'\tSubmodule sm4 $smhead2..$smhead3:\n'> <'\t > Add foo7 ($added foo7)\n'> <'\t > Add foo6 ($added foo6)\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_done>}) ] )