diff options
Diffstat (limited to 't/t7508-status.sh')
-rwxr-xr-x | t/t7508-status.sh | 357 |
1 files changed, 167 insertions, 190 deletions
diff --git a/t/t7508-status.sh b/t/t7508-status.sh index e1f11293e2..2b72451ba3 100755 --- a/t/t7508-status.sh +++ b/t/t7508-status.sh @@ -37,11 +37,11 @@ test_expect_success 'create upstream branch' ' git checkout -b upstream && test_commit upstream1 && test_commit upstream2 && - # leave the first commit on master as root because several + # leave the first commit on main as root because several # tests depend on this case; for our upstream we only # care about commit counts anyway, so a totally divergent # history is OK - git checkout --orphan master + git checkout --orphan main ' test_expect_success 'setup' ' @@ -88,59 +88,53 @@ EOF test_expect_success 'status --column' ' cat >expect <<\EOF && -# On branch master +# On branch main # Your branch and '\''upstream'\'' have diverged, # and have 1 and 2 different commits each, respectively. # (use "git pull" to merge the remote branch into yours) # # Changes to be committed: -# (use "git reset HEAD <file>..." to unstage) -# +# (use "git restore --staged <file>..." to unstage) # new file: dir2/added # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) -# (use "git checkout -- <file>..." to discard changes in working directory) -# +# (use "git restore <file>..." to discard changes in working directory) # modified: dir1/modified # # Untracked files: # (use "git add <file>..." to include in what will be committed) -# # dir1/untracked dir2/untracked # dir2/modified untracked # EOF COLUMNS=50 git -c status.displayCommentPrefix=true status --column="column dense" >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success 'status --column status.displayCommentPrefix=false' ' strip_comments expect && COLUMNS=49 git -c status.displayCommentPrefix=false status --column="column dense" >output && - test_i18ncmp expect output + test_cmp expect output ' cat >expect <<\EOF -# On branch master +# On branch main # Your branch and 'upstream' have diverged, # and have 1 and 2 different commits each, respectively. # (use "git pull" to merge the remote branch into yours) # # Changes to be committed: -# (use "git reset HEAD <file>..." to unstage) -# +# (use "git restore --staged <file>..." to unstage) # new file: dir2/added # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) -# (use "git checkout -- <file>..." to discard changes in working directory) -# +# (use "git restore <file>..." to discard changes in working directory) # modified: dir1/modified # # Untracked files: # (use "git add <file>..." to include in what will be committed) -# # dir1/untracked # dir2/modified # dir2/untracked @@ -150,19 +144,19 @@ EOF test_expect_success 'status with status.displayCommentPrefix=true' ' git -c status.displayCommentPrefix=true status >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success 'status with status.displayCommentPrefix=false' ' strip_comments expect && git -c status.displayCommentPrefix=false status >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success 'status -v' ' (cat expect && git diff --cached) >expect-with-v && git status -v >output && - test_i18ncmp expect-with-v output + test_cmp expect-with-v output ' test_expect_success 'status -v -v' ' @@ -173,7 +167,7 @@ test_expect_success 'status -v -v' ' echo "Changes not staged for commit:" && git -c diff.mnemonicprefix=true diff) >expect-with-v && git status -v -v >output && - test_i18ncmp expect-with-v output + test_cmp expect-with-v output ' test_expect_success 'setup fake editor' ' @@ -199,7 +193,7 @@ test_expect_success 'commit ignores status.displayCommentPrefix=false in COMMIT_ ' cat >expect <<\EOF -On branch master +On branch main Your branch and 'upstream' have diverged, and have 1 and 2 different commits each, respectively. @@ -220,7 +214,7 @@ EOF test_expect_success 'status (advice.statusHints false)' ' test_config advice.statusHints false && git status >output && - test_i18ncmp expect output + test_cmp expect output ' @@ -272,30 +266,26 @@ test_expect_success 'status with gitignore' ' test_cmp expect output && cat >expect <<\EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 1 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) new file: dir2/added Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Untracked files: (use "git add <file>..." to include in what will be committed) - dir2/modified Ignored files: (use "git add -f <file>..." to include in what will be committed) - .gitignore dir1/untracked dir2/untracked @@ -306,7 +296,7 @@ Ignored files: EOF git status --ignored >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success 'status with gitignore (nothing untracked)' ' @@ -341,25 +331,22 @@ test_expect_success 'status with gitignore (nothing untracked)' ' test_cmp expect output && cat >expect <<\EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 1 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) new file: dir2/added Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Ignored files: (use "git add -f <file>..." to include in what will be committed) - .gitignore dir1/untracked dir2/modified @@ -371,7 +358,7 @@ Ignored files: EOF git status --ignored >output && - test_i18ncmp expect output + test_cmp expect output ' cat >.gitignore <<\EOF @@ -381,7 +368,7 @@ output* EOF cat >expect <<\EOF -## master...upstream [ahead 1, behind 2] +## main...upstream [ahead 1, behind 2] M dir1/modified A dir2/added ?? dir1/untracked @@ -393,7 +380,7 @@ EOF test_expect_success 'status -s -b' ' git status -s -b >output && - test_i18ncmp expect output + test_cmp expect output ' @@ -403,7 +390,7 @@ test_expect_success 'status -s -z -b' ' git status -s -z -b >output && nul_to_q <output >output.q && mv output.q output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success 'setup dir3' ' @@ -414,37 +401,35 @@ test_expect_success 'setup dir3' ' test_expect_success 'status -uno' ' cat >expect <<EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 1 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) new file: dir2/added Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Untracked files not listed (use -u option to show untracked files) EOF git status -uno >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success 'status (status.showUntrackedFiles no)' ' test_config status.showuntrackedfiles no && git status >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success 'status -uno (advice.statusHints false)' ' cat >expect <<EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 1 and 2 different commits each, respectively. @@ -458,7 +443,7 @@ Untracked files not listed EOF test_config advice.statusHints false && git status -uno >output && - test_i18ncmp expect output + test_cmp expect output ' cat >expect << EOF @@ -478,25 +463,22 @@ test_expect_success 'status -s (status.showUntrackedFiles no)' ' test_expect_success 'status -unormal' ' cat >expect <<EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 1 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) new file: dir2/added Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Untracked files: (use "git add <file>..." to include in what will be committed) - dir1/untracked dir2/modified dir2/untracked @@ -505,13 +487,13 @@ Untracked files: EOF git status -unormal >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success 'status (status.showUntrackedFiles normal)' ' test_config status.showuntrackedfiles normal && git status >output && - test_i18ncmp expect output + test_cmp expect output ' cat >expect <<EOF @@ -536,25 +518,22 @@ test_expect_success 'status -s (status.showUntrackedFiles normal)' ' test_expect_success 'status -uall' ' cat >expect <<EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 1 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) new file: dir2/added Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Untracked files: (use "git add <file>..." to include in what will be committed) - dir1/untracked dir2/modified dir2/untracked @@ -564,13 +543,13 @@ Untracked files: EOF git status -uall >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success 'status (status.showUntrackedFiles all)' ' test_config status.showuntrackedfiles all && git status >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success 'teardown dir3' ' @@ -599,25 +578,22 @@ test_expect_success 'status -s (status.showUntrackedFiles all)' ' test_expect_success 'status with relative paths' ' cat >expect <<\EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 1 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) new file: ../dir2/added Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: modified Untracked files: (use "git add <file>..." to include in what will be committed) - untracked ../dir2/modified ../dir2/untracked @@ -625,7 +601,7 @@ Untracked files: EOF (cd dir1 && git status) >output && - test_i18ncmp expect output + test_cmp expect output ' cat >expect <<\EOF @@ -670,25 +646,22 @@ test_expect_success 'setup unique colors' ' test_expect_success TTY 'status with color.ui' ' cat >expect <<\EOF && -On branch <GREEN>master<RESET> +On branch <GREEN>main<RESET> Your branch and '\''upstream'\'' have diverged, and have 1 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) <GREEN>new file: dir2/added<RESET> Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) <RED>modified: dir1/modified<RESET> Untracked files: (use "git add <file>..." to include in what will be committed) - <BLUE>dir1/untracked<RESET> <BLUE>dir2/modified<RESET> <BLUE>dir2/untracked<RESET> @@ -697,13 +670,13 @@ Untracked files: EOF test_config color.ui auto && test_terminal git status | test_decode_color >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success TTY 'status with color.status' ' test_config color.status auto && test_terminal git status | test_decode_color >output && - test_i18ncmp expect output + test_cmp expect output ' cat >expect <<\EOF @@ -733,7 +706,7 @@ test_expect_success TTY 'status -s with color.status' ' ' cat >expect <<\EOF -## <YELLOW>master<RESET>...<CYAN>upstream<RESET> [ahead <YELLOW>1<RESET>, behind <CYAN>2<RESET>] +## <YELLOW>main<RESET>...<CYAN>upstream<RESET> [ahead <YELLOW>1<RESET>, behind <CYAN>2<RESET>] <RED>M<RESET> dir1/modified <GREEN>A<RESET> dir2/added <BLUE>??<RESET> dir1/untracked @@ -745,7 +718,7 @@ EOF test_expect_success TTY 'status -s -b with color.status' ' test_terminal git status -s -b | test_decode_color >output && - test_i18ncmp expect output + test_cmp expect output ' @@ -784,7 +757,7 @@ test_expect_success 'status --porcelain respects -b' ' git status --porcelain -b >output && { - echo "## master...upstream [ahead 1, behind 2]" && + echo "## main...upstream [ahead 1, behind 2]" && cat expect } >tmp && mv tmp expect && @@ -796,25 +769,22 @@ test_expect_success 'status --porcelain respects -b' ' test_expect_success 'status without relative paths' ' cat >expect <<\EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 1 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) new file: dir2/added Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Untracked files: (use "git add <file>..." to include in what will be committed) - dir1/untracked dir2/modified dir2/untracked @@ -823,7 +793,7 @@ Untracked files: EOF test_config status.relativePaths false && (cd dir1 && git status) >output && - test_i18ncmp expect output + test_cmp expect output ' @@ -844,32 +814,57 @@ test_expect_success 'status -s without relative paths' ' ' +cat >expect <<\EOF + M dir1/modified +A dir2/added +A "file with spaces" +?? dir1/untracked +?? dir2/modified +?? dir2/untracked +?? "file with spaces 2" +?? untracked +EOF + +test_expect_success 'status -s without relative paths' ' + test_when_finished "git rm --cached \"file with spaces\"; rm -f file*" && + >"file with spaces" && + >"file with spaces 2" && + >"expect with spaces" && + git add "file with spaces" && + + git status -s >output && + test_cmp expect output && + + git status -s --ignored >output && + grep "^!! \"expect with spaces\"$" output && + grep -v "^!! " output >output-wo-ignored && + test_cmp expect output-wo-ignored +' + test_expect_success 'dry-run of partial commit excluding new file in index' ' cat >expect <<EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 1 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) modified: dir1/modified Untracked files: (use "git add <file>..." to include in what will be committed) - dir1/untracked dir2/ untracked EOF git commit --dry-run dir1/modified >output && - test_i18ncmp expect output + test_cmp expect output ' cat >expect <<EOF -:100644 100644 $EMPTY_BLOB 0000000000000000000000000000000000000000 M dir1/modified +:100644 100644 $EMPTY_BLOB $ZERO_OID M dir1/modified EOF test_expect_success 'status refreshes the index' ' touch dir2/added && @@ -878,6 +873,18 @@ test_expect_success 'status refreshes the index' ' test_cmp expect output ' +test_expect_success 'status shows detached HEAD properly after checking out non-local upstream branch' ' + test_when_finished rm -rf upstream downstream actual && + + test_create_repo upstream && + test_commit -C upstream foo && + + git clone upstream downstream && + git -C downstream checkout @{u} && + git -C downstream status >actual && + test_i18ngrep "HEAD detached at [0-9a-f]\\+" actual +' + test_expect_success 'setup status submodule summary' ' test_create_repo sm && ( cd sm && @@ -890,26 +897,23 @@ test_expect_success 'setup status submodule summary' ' test_expect_success 'status submodule summary is disabled by default' ' cat >expect <<EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 1 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) new file: dir2/added new file: sm Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Untracked files: (use "git add <file>..." to include in what will be committed) - dir1/untracked dir2/modified dir2/untracked @@ -917,13 +921,13 @@ Untracked files: EOF git status >output && - test_i18ncmp expect output + test_cmp expect output ' # we expect the same as the previous test test_expect_success 'status --untracked-files=all does not show submodule' ' git status --untracked-files=all >output && - test_i18ncmp expect output + test_cmp expect output ' cat >expect <<EOF @@ -950,21 +954,19 @@ head=$(cd sm && git rev-parse --short=7 --verify HEAD) test_expect_success 'status submodule summary' ' cat >expect <<EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 1 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) new file: dir2/added new file: sm Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Submodule changes to be committed: @@ -974,7 +976,6 @@ Submodule changes to be committed: Untracked files: (use "git add <file>..." to include in what will be committed) - dir1/untracked dir2/modified dir2/untracked @@ -983,13 +984,13 @@ Untracked files: EOF git config status.submodulesummary 10 && git status >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success 'status submodule summary with status.displayCommentPrefix=false' ' strip_comments expect && git -c status.displayCommentPrefix=false status >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success 'commit with submodule summary ignores status.displayCommentPrefix' ' @@ -1012,20 +1013,18 @@ test_expect_success 'status -s submodule summary' ' test_expect_success 'status submodule summary (clean submodule): commit' ' cat >expect <<EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 2 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Untracked files: (use "git add <file>..." to include in what will be committed) - dir1/untracked dir2/modified dir2/untracked @@ -1036,9 +1035,9 @@ EOF git commit -m "commit submodule" && git config status.submodulesummary 10 && test_must_fail git commit --dry-run >output && - test_i18ncmp expect output && + test_cmp expect output && git status >output && - test_i18ncmp expect output + test_cmp expect output ' cat >expect <<EOF @@ -1062,21 +1061,19 @@ test_expect_success 'status -z implies porcelain' ' test_expect_success 'commit --dry-run submodule summary (--amend)' ' cat >expect <<EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 2 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD^1 <file>..." to unstage) - + (use "git restore --source=HEAD^1 --staged <file>..." to unstage) new file: dir2/added new file: sm Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Submodule changes to be committed: @@ -1086,7 +1083,6 @@ Submodule changes to be committed: Untracked files: (use "git add <file>..." to include in what will be committed) - dir1/untracked dir2/modified dir2/untracked @@ -1095,7 +1091,7 @@ Untracked files: EOF git config status.submodulesummary 10 && git commit --dry-run --amend >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success POSIXPERM,SANITY 'status succeeds in a read-only repository' ' @@ -1117,20 +1113,18 @@ touch .gitmodules test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' ' cat > expect << EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 2 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) modified: sm Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Submodule changes to be committed: @@ -1140,7 +1134,6 @@ Submodule changes to be committed: Untracked files: (use "git add <file>..." to include in what will be committed) - .gitmodules dir1/untracked dir2/modified @@ -1150,17 +1143,17 @@ Untracked files: EOF echo modified sm/untracked && git status --ignore-submodules=untracked >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' ' test_config diff.ignoreSubmodules dirty && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config --add -f .gitmodules submodule.subname.ignore untracked && git config --add -f .gitmodules submodule.subname.path sm && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config -f .gitmodules --remove-section submodule.subname ' @@ -1170,14 +1163,14 @@ test_expect_success '.git/config ignore=untracked suppresses submodules with unt git config --add submodule.subname.ignore untracked && git config --add submodule.subname.path sm && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config --remove-section submodule.subname && git config --remove-section -f .gitmodules submodule.subname ' test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' ' git status --ignore-submodules=dirty >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' ' @@ -1187,7 +1180,7 @@ test_expect_success '.gitmodules ignore=dirty suppresses submodules with untrack git config --add -f .gitmodules submodule.subname.ignore dirty && git config --add -f .gitmodules submodule.subname.path sm && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config -f .gitmodules --remove-section submodule.subname ' @@ -1197,7 +1190,7 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with untrack git config --add submodule.subname.ignore dirty && git config --add submodule.subname.path sm && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname ' @@ -1205,14 +1198,14 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with untrack test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' ' echo modified >sm/foo && git status --ignore-submodules=dirty >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' ' git config --add -f .gitmodules submodule.subname.ignore dirty && git config --add -f .gitmodules submodule.subname.path sm && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config -f .gitmodules --remove-section submodule.subname ' @@ -1222,28 +1215,26 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with modifie git config --add submodule.subname.ignore dirty && git config --add submodule.subname.path sm && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname ' test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" ' cat > expect << EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 2 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) modified: sm Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) + (use "git restore <file>..." to discard changes in working directory) (commit or discard the untracked or modified content in submodules) - modified: dir1/modified modified: sm (modified content) @@ -1254,7 +1245,6 @@ Submodule changes to be committed: Untracked files: (use "git add <file>..." to include in what will be committed) - .gitmodules dir1/untracked dir2/modified @@ -1263,14 +1253,14 @@ Untracked files: EOF git status --ignore-submodules=untracked > output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" ' git config --add -f .gitmodules submodule.subname.ignore untracked && git config --add -f .gitmodules submodule.subname.path sm && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config -f .gitmodules --remove-section submodule.subname ' @@ -1280,7 +1270,7 @@ test_expect_success ".git/config ignore=untracked doesn't suppress submodules wi git config --add submodule.subname.ignore untracked && git config --add submodule.subname.path sm && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname ' @@ -1289,20 +1279,18 @@ head2=$(cd sm && git commit -q -m "2nd commit" foo && git rev-parse --short=7 -- test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" ' cat > expect << EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 2 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) modified: sm Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified modified: sm (new commits) @@ -1318,7 +1306,6 @@ Submodules changed but not updated: Untracked files: (use "git add <file>..." to include in what will be committed) - .gitmodules dir1/untracked dir2/modified @@ -1327,14 +1314,14 @@ Untracked files: EOF git status --ignore-submodules=untracked > output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" ' git config --add -f .gitmodules submodule.subname.ignore untracked && git config --add -f .gitmodules submodule.subname.path sm && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config -f .gitmodules --remove-section submodule.subname ' @@ -1344,20 +1331,20 @@ test_expect_success ".git/config ignore=untracked doesn't suppress submodule sum git config --add submodule.subname.ignore untracked && git config --add submodule.subname.path sm && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname ' test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" ' git status --ignore-submodules=dirty > output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" ' git config --add -f .gitmodules submodule.subname.ignore dirty && git config --add -f .gitmodules submodule.subname.path sm && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config -f .gitmodules --remove-section submodule.subname ' @@ -1367,26 +1354,24 @@ test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary git config --add submodule.subname.ignore dirty && git config --add submodule.subname.path sm && git status >output && - test_i18ncmp expect output && + test_cmp expect output && git config --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname ' cat > expect << EOF -; On branch master +; On branch main ; Your branch and 'upstream' have diverged, ; and have 2 and 2 different commits each, respectively. ; (use "git pull" to merge the remote branch into yours) ; ; Changes to be committed: -; (use "git reset HEAD <file>..." to unstage) -; +; (use "git restore --staged <file>..." to unstage) ; modified: sm ; ; Changes not staged for commit: ; (use "git add <file>..." to update what will be committed) -; (use "git checkout -- <file>..." to discard changes in working directory) -; +; (use "git restore <file>..." to discard changes in working directory) ; modified: dir1/modified ; modified: sm (new commits) ; @@ -1402,7 +1387,6 @@ cat > expect << EOF ; ; Untracked files: ; (use "git add <file>..." to include in what will be committed) -; ; .gitmodules ; dir1/untracked ; dir2/modified @@ -1414,7 +1398,7 @@ EOF test_expect_success "status (core.commentchar with submodule summary)" ' test_config core.commentchar ";" && git -c status.displayCommentPrefix=true status >output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success "status (core.commentchar with two chars with submodule summary)" ' @@ -1424,20 +1408,18 @@ test_expect_success "status (core.commentchar with two chars with submodule summ test_expect_success "--ignore-submodules=all suppresses submodule summary" ' cat > expect << EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 2 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Untracked files: (use "git add <file>..." to include in what will be committed) - .gitmodules dir1/untracked dir2/modified @@ -1447,30 +1429,27 @@ Untracked files: no changes added to commit (use "git add" and/or "git commit -a") EOF git status --ignore-submodules=all > output && - test_i18ncmp expect output + test_cmp expect output ' test_expect_success '.gitmodules ignore=all suppresses unstaged submodule summary' ' cat > expect << EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 2 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) modified: sm Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Untracked files: (use "git add <file>..." to include in what will be committed) - .gitmodules dir1/untracked dir2/modified @@ -1481,7 +1460,7 @@ EOF git config --add -f .gitmodules submodule.subname.ignore all && git config --add -f .gitmodules submodule.subname.path sm && git status > output && - test_i18ncmp expect output && + test_cmp expect output && git config -f .gitmodules --remove-section submodule.subname ' @@ -1491,7 +1470,7 @@ test_expect_success '.git/config ignore=all suppresses unstaged submodule summar git config --add submodule.subname.ignore all && git config --add submodule.subname.path sm && git status > output && - test_i18ncmp expect output && + test_cmp expect output && git config --remove-section submodule.subname && git config -f .gitmodules --remove-section submodule.subname ' @@ -1531,7 +1510,7 @@ test_expect_success '"status.branch=true" same as "-b"' ' test_expect_success '"status.branch=true" different from "--no-branch"' ' git status -s --no-branch >expected_nobranch && git -c status.branch=true status -s >actual && - test_must_fail test_cmp expected_nobranch actual + ! test_cmp expected_nobranch actual ' test_expect_success '"status.branch=true" weaker than "--no-branch"' ' @@ -1575,26 +1554,24 @@ test_expect_success 'git commit --dry-run will show a staged but ignored submodu git reset HEAD^ && git add sm && cat >expect << EOF && -On branch master +On branch main Your branch and '\''upstream'\'' have diverged, and have 2 and 2 different commits each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: - (use "git reset HEAD <file>..." to unstage) - + (use "git restore --staged <file>..." to unstage) modified: sm Changes not staged for commit: (use "git add <file>..." to update what will be committed) - (use "git checkout -- <file>..." to discard changes in working directory) - + (use "git restore <file>..." to discard changes in working directory) modified: dir1/modified Untracked files not listed (use -u option to show untracked files) EOF git commit -uno --dry-run >output && - test_i18ncmp expect output && + test_cmp expect output && git status -s --ignore-submodules=dirty >output && test_i18ngrep "^M. sm" output ' @@ -1633,7 +1610,7 @@ test_expect_success '"status.showStash=true" weaker than "--no-show-stash"' ' test_cmp expected_without_stash actual ' -test_expect_success 'no additionnal info if no stash entries' ' +test_expect_success 'no additional info if no stash entries' ' git stash clear && git -c status.showStash=true status >actual && test_cmp expected_without_stash actual |