(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description spids:[4]) op: Equal rhs: {(SQ <'git status for submodule'>)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (FuncDef name: test_create_repo_with_commit body: (BraceGroup children: [ (AndOr ops: [Op_DAmp] children: [ (C {(test_create_repo)} {(DQ ($ VSub_Number '$1'))}) (Subshell child: (AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (C {(cd)} {(DQ ($ VSub_Number '$1'))}) (SimpleCommand words: [{(Lit_Other ':')}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(bar)})] ) (C {(git)} {(add)} {(bar)}) (C {(git)} {(commit)} {(-m)} {(DQ (' Add bar'))}) (SimpleCommand words: [{(Lit_Other ':')}] redirects: [(Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(foo)})] ) (C {(git)} {(add)} {(foo)}) (C {(git)} {(commit)} {(-m)} {(DQ (' Add foo'))}) ] ) spids: [32 102] ) ] ) ] spids: [20] ) spids: [15 19] ) (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'> ) } ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(status_expect)}) (HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(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'> ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sha1_merge_sub1 spids:[523]) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr ops: [Op_DAmp] children: [(C {(cd)} {(sub1)}) (C {(git)} {(rev-parse)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> spids: [524 536] ) } spids: [523] ) ] spids: [523] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sha1_merge_sub2 spids:[538]) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr ops: [Op_DAmp] children: [(C {(cd)} {(sub2)}) (C {(git)} {(rev-parse)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> spids: [539 551] ) } spids: [538] ) ] spids: [538] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:short_sha1_merge_sub1 spids:[553]) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr ops: [Op_DAmp] children: [(C {(cd)} {(sub1)}) (C {(git)} {(rev-parse)} {(--short)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> spids: [554 568] ) } spids: [553] ) ] spids: [553] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:short_sha1_merge_sub2 spids:[570]) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (AndOr ops: [Op_DAmp] children: [(C {(cd)} {(sub2)}) (C {(git)} {(rev-parse)} {(--short)} {(HEAD)})] ) ] ) left_token: <Left_CommandSub '$('> spids: [571 585] ) } spids: [570] ) ] spids: [570] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(diff_expect)}) (HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(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') ] ) ] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(diff_submodule_expect)}) (HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(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)}) ] )