(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description) op: Equal rhs: {(SQ <'git status for submodule'>)} ) ] ) (C {(.)} {(./test-lib.sh)}) (command.FuncDef name: test_create_repo_with_commit body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(test_create_repo)} {(DQ ($ VSub_Number '$1'))}) (command.Subshell command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (C {(cd)} {(DQ ($ VSub_Number '$1'))}) (command.SimpleCommand words: [{(Lit_Other ':')}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(bar)} ) ] ) (C {(git)} {(add)} {(bar)}) (C {(git)} {(commit)} {(-m)} {(DQ (' Add bar'))}) (command.SimpleCommand words: [{(Lit_Other ':')}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(foo)} ) ] ) (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.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(status_expect)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\E'>) (OF)} here_end_span_id: 492 stdin_parts: [('AA .gitmodules\n') ('A sub1\n')] ) ] ) (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.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:sha1_merge_sub1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [(C {(cd)} {(sub1)}) (C {(git)} {(rev-parse)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:sha1_merge_sub2) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [(C {(cd)} {(sub2)}) (C {(git)} {(rev-parse)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:short_sha1_merge_sub1) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [(C {(cd)} {(sub1)}) (C {(git)} {(rev-parse)} {(--short)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:short_sha1_merge_sub2) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.AndOr ops: [Op_DAmp] children: [(C {(cd)} {(sub2)}) (C {(git)} {(rev-parse)} {(--short)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> ) } ) ] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(diff_expect)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(word_part.EscapedLiteralPart token:<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') ] ) ] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(diff_submodule_expect)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(word_part.EscapedLiteralPart token:<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') ] ) ] ) (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)}) ] )