(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'git status for submodule'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: test_create_repo_with_commit body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<test_create_repo>} {(DQ ($ Id.VSub_Number '$1'))}) (command.Subshell child: (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (C {<cd>} {(DQ ($ Id.VSub_Number '$1'))}) (command.Simple words: [{<Id.Lit_Colon ':'>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<bar>} ) ] do_fork: T ) (C {<git>} {<add>} {<bar>}) (C {<git>} {<commit>} {<-m>} {(DQ <' Add bar'>)}) (command.Simple words: [{<Id.Lit_Colon ':'>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<foo>} ) ] do_fork: T ) (C {<git>} {<add>} {<foo>}) (C {<git>} {<commit>} {<-m>} {(DQ <' Add foo'>)}) ] ) ) ] ) ] ) ) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'\n'> <'\ttest_create_repo_with_commit sub &&\n'> <'\techo output > .gitignore &&\n'> <'\tgit add sub .gitignore &&\n'> <'\tgit commit -m "Add submodule sub"\n'> ) } ) (C {<test_expect_success>} {(SQ <'status clean'>)} {(SQ <'\n'> <'\tgit status >output &&\n'> <'\ttest_i18ngrep "nothing to commit" output\n'>)} ) (C {<test_expect_success>} {(SQ <'commit --dry-run -a clean'>)} { (SQ <'\n'> <'\ttest_must_fail git commit --dry-run -a >output &&\n'> <'\ttest_i18ngrep "nothing to commit" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with modified file in submodule'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard) &&\n'> <'\techo "changed" >sub/foo &&\n'> <'\tgit status >output &&\n'> <'\ttest_i18ngrep "modified: sub (modified content)" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with modified file in submodule (porcelain)'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard) &&\n'> <'\techo "changed" >sub/foo &&\n'> <'\tgit status --porcelain >output &&\n'> <'\tdiff output - <<-\\EOF\n'> <'\t M sub\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with added file in submodule'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard && echo >foo && git add foo) &&\n'> <'\tgit status >output &&\n'> <'\ttest_i18ngrep "modified: sub (modified content)" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with added file in submodule (porcelain)'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard && echo >foo && git add foo) &&\n'> <'\tgit status --porcelain >output &&\n'> <'\tdiff output - <<-\\EOF\n'> <'\t M sub\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with untracked file in submodule'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard) &&\n'> <'\techo "content" >sub/new-file &&\n'> <'\tgit status >output &&\n'> <'\ttest_i18ngrep "modified: sub (untracked content)" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'status -uno with untracked file in submodule'>)} { (SQ <'\n'> <'\tgit status -uno >output &&\n'> <'\ttest_i18ngrep "^nothing to commit" output\n'>) } ) (C {<test_expect_success>} {(SQ <'status with untracked file in submodule (porcelain)'>)} { (SQ <'\n'> <'\tgit status --porcelain >output &&\n'> <'\tdiff output - <<-\\EOF\n'> <'\t M sub\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with added and untracked file in submodule'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard && echo >foo && git add foo) &&\n'> <'\techo "content" >sub/new-file &&\n'> <'\tgit status >output &&\n'> <'\ttest_i18ngrep "modified: sub (modified content, untracked content)" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with added and untracked file in submodule (porcelain)'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard && echo >foo && git add foo) &&\n'> <'\techo "content" >sub/new-file &&\n'> <'\tgit status --porcelain >output &&\n'> <'\tdiff output - <<-\\EOF\n'> <'\t M sub\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with modified file in modified submodule'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard) &&\n'> <'\trm sub/new-file &&\n'> <'\t(cd sub && echo "next change" >foo && git commit -m "next change" foo) &&\n'> <'\techo "changed" >sub/foo &&\n'> <'\tgit status >output &&\n'> <'\ttest_i18ngrep "modified: sub (new commits, modified content)" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with modified file in modified submodule (porcelain)'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard) &&\n'> <'\techo "changed" >sub/foo &&\n'> <'\tgit status --porcelain >output &&\n'> <'\tdiff output - <<-\\EOF\n'> <'\t M sub\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with added file in modified submodule'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard && echo >foo && git add foo) &&\n'> <'\tgit status >output &&\n'> <'\ttest_i18ngrep "modified: sub (new commits, modified content)" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with added file in modified submodule (porcelain)'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard && echo >foo && git add foo) &&\n'> <'\tgit status --porcelain >output &&\n'> <'\tdiff output - <<-\\EOF\n'> <'\t M sub\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with untracked file in modified submodule'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard) &&\n'> <'\techo "content" >sub/new-file &&\n'> <'\tgit status >output &&\n'> <'\ttest_i18ngrep "modified: sub (new commits, untracked content)" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with untracked file in modified submodule (porcelain)'>)} { (SQ <'\n'> <'\tgit status --porcelain >output &&\n'> <'\tdiff output - <<-\\EOF\n'> <'\t M sub\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with added and untracked file in modified submodule'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard && echo >foo && git add foo) &&\n'> <'\techo "content" >sub/new-file &&\n'> <'\tgit status >output &&\n'> < '\ttest_i18ngrep "modified: sub (new commits, modified content, untracked content)" output\n' > ) } ) (C {<test_expect_success>} {(SQ <'status with added and untracked file in modified submodule (porcelain)'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard && echo >foo && git add foo) &&\n'> <'\techo "content" >sub/new-file &&\n'> <'\tgit status --porcelain >output &&\n'> <'\tdiff output - <<-\\EOF\n'> <'\t M sub\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup .git file for sub'>)} { (SQ <'\n'> <'\t(cd sub &&\n'> <'\t rm -f new-file\n'> <'\t REAL="$(pwd)/../.real" &&\n'> <'\t mv .git "$REAL"\n'> <'\t echo "gitdir: $REAL" >.git) &&\n'> <'\t echo .real >>.gitignore &&\n'> <'\t git commit -m "added .real to .gitignore" .gitignore\n'> ) } ) (C {<test_expect_success>} {(SQ <'status with added file in modified submodule with .git file'>)} { (SQ <'\n'> <'\t(cd sub && git reset --hard && echo >foo && git add foo) &&\n'> <'\tgit status >output &&\n'> <'\ttest_i18ngrep "modified: sub (new commits, modified content)" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'rm submodule contents'>)} {(SQ <'\n'> <'\trm -rf sub/* sub/.git\n'>)} ) (C {<test_expect_success>} {(SQ <'status clean (empty submodule dir)'>)} {(SQ <'\n'> <'\tgit status >output &&\n'> <'\ttest_i18ngrep "nothing to commit" output\n'>)} ) (C {<test_expect_success>} {(SQ <'status -a clean (empty submodule dir)'>)} { (SQ <'\n'> <'\ttest_must_fail git commit --dry-run -a >output &&\n'> <'\ttest_i18ngrep "nothing to commit" output\n'> ) } ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<status_expect>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 492 stdin_parts: [<'AA .gitmodules\n'> <'A sub1\n'>] ) ) ] do_fork: T ) (C {<test_expect_success>} {(SQ <'status with merge conflict in .gitmodules'>)} { (SQ <'\n'> <'\tgit clone . super &&\n'> <'\ttest_create_repo_with_commit sub1 &&\n'> <'\ttest_tick &&\n'> <'\ttest_create_repo_with_commit sub2 &&\n'> <'\t(\n'> <'\t\tcd super &&\n'> <'\t\tprev=$(git rev-parse HEAD) &&\n'> <'\t\tgit checkout -b add_sub1 &&\n'> <'\t\tgit submodule add ../sub1 &&\n'> <'\t\tgit commit -m "add sub1" &&\n'> <'\t\tgit checkout -b add_sub2 $prev &&\n'> <'\t\tgit submodule add ../sub2 &&\n'> <'\t\tgit commit -m "add sub2" &&\n'> <'\t\tgit checkout -b merge_conflict_gitmodules &&\n'> <'\t\ttest_must_fail git merge add_sub1 &&\n'> <'\t\tgit status -s >../status_actual 2>&1\n'> <'\t) &&\n'> <'\ttest_cmp status_actual status_expect\n'> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sha1_merge_sub1) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.AndOr ops: [Id.Op_DAmp] children: [(C {<cd>} {<sub1>}) (C {<git>} {<rev-parse>} {<HEAD>})] ) ) } spids: [523] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:sha1_merge_sub2) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.AndOr ops: [Id.Op_DAmp] children: [(C {<cd>} {<sub2>}) (C {<git>} {<rev-parse>} {<HEAD>})] ) ) } spids: [538] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:short_sha1_merge_sub1) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.AndOr ops: [Id.Op_DAmp] children: [(C {<cd>} {<sub1>}) (C {<git>} {<rev-parse>} {<--short>} {<HEAD>})] ) ) } spids: [553] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:short_sha1_merge_sub2) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.AndOr ops: [Id.Op_DAmp] children: [(C {<cd>} {<sub2>}) (C {<git>} {<rev-parse>} {<--short>} {<HEAD>})] ) ) } spids: [570] ) ] ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<diff_expect>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 610 stdin_parts: [ <'diff --cc .gitmodules\n'> <'index badaa4c,44f999a..0000000\n'> <'--- a/.gitmodules\n'> <'+++ b/.gitmodules\n'> <'@@@ -1,3 -1,3 +1,9 @@@\n'> <'++<<<<<<< HEAD\n'> <' +[submodule "sub2"]\n'> <' +\tpath = sub2\n'> <' +\turl = ../sub2\n'> <'++=======\n'> <'+ [submodule "sub1"]\n'> <'+ \tpath = sub1\n'> <'+ \turl = ../sub1\n'> <'++>>>>>>> add_sub1\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<cat>}] redirects: [ (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<diff_submodule_expect>}) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>} here_end_span_id: 635 stdin_parts: [ <'diff --cc .gitmodules\n'> <'index badaa4c,44f999a..0000000\n'> <'--- a/.gitmodules\n'> <'+++ b/.gitmodules\n'> <'@@@ -1,3 -1,3 +1,9 @@@\n'> <'++<<<<<<< HEAD\n'> <' +[submodule "sub2"]\n'> <' +\tpath = sub2\n'> <' +\turl = ../sub2\n'> <'++=======\n'> <'+ [submodule "sub1"]\n'> <'+ \tpath = sub1\n'> <'+ \turl = ../sub1\n'> <'++>>>>>>> add_sub1\n'> ] ) ) ] do_fork: T ) (C {<test_expect_success>} {(SQ <'diff with merge conflict in .gitmodules'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd super &&\n'> <'\t\tgit diff >../diff_actual 2>&1\n'> <'\t) &&\n'> <'\ttest_cmp diff_actual diff_expect\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff --submodule with merge conflict in .gitmodules'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd super &&\n'> <'\t\tgit diff --submodule >../diff_submodule_actual 2>&1\n'> <'\t) &&\n'> <'\ttest_cmp diff_submodule_actual diff_submodule_expect\n'> ) } ) (C {<test_done>}) ] )