From: Junio C Hamano Date: Fri, 30 Jun 2017 20:45:22 +0000 (-0700) Subject: Merge branch 'ks/status-initial-commit' X-Git-Tag: v2.14.0-rc0~45 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7e46f19a105f3798b03ac3887f45034fbfdff676 Merge branch 'ks/status-initial-commit' "git status" has long shown essentially the same message as "git commit"; the message it gives while preparing for the root commit, i.e. "Initial commit", was hard to understand for some new users. Now it says "No commits yet" to stress more on the current status (rather than the commit the user is preparing for, which is more in line with the focus of "git commit"). * ks/status-initial-commit: status: contextually notify user about an initial commit --- 7e46f19a105f3798b03ac3887f45034fbfdff676 diff --cc t/t7508-status.sh index f7fe22a195,db709048c2..43d19a9b22 --- a/t/t7508-status.sh +++ b/t/t7508-status.sh @@@ -1608,36 -1499,34 +1608,66 @@@ test_expect_success 'git commit -m wil git config -f .gitmodules --remove-section submodule.subname ' +test_expect_success 'show stash info with "--show-stash"' ' + git reset --hard && + git stash clear && + echo 1 >file && + git add file && + git stash && + git status >expected_default && + git status --show-stash >expected_with_stash && + test_i18ngrep "^Your stash currently has 1 entry$" expected_with_stash +' + +test_expect_success 'no stash info with "--show-stash --no-show-stash"' ' + git status --show-stash --no-show-stash >expected_without_stash && + test_cmp expected_default expected_without_stash +' + +test_expect_success '"status.showStash=false" weaker than "--show-stash"' ' + git -c status.showStash=false status --show-stash >actual && + test_cmp expected_with_stash actual +' + +test_expect_success '"status.showStash=true" weaker than "--no-show-stash"' ' + git -c status.showStash=true status --no-show-stash >actual && + test_cmp expected_without_stash actual +' + +test_expect_success 'no additionnal info if no stash entries' ' + git stash clear && + git -c status.showStash=true status >actual && + test_cmp expected_without_stash actual +' + + test_expect_success '"No commits yet" should be noted in status output' ' + git checkout --orphan empty-branch-1 && + git status >output && + test_i18ngrep "No commits yet" output + ' + + test_expect_success '"No commits yet" should not be noted in status output' ' + git checkout --orphan empty-branch-2 && + test_commit test-commit-1 && + git status >output && + test_i18ngrep ! "No commits yet" output + ' + + test_expect_success '"Initial commit" should be noted in commit template' ' + git checkout --orphan empty-branch-3 && + touch to_be_committed_1 && + git add to_be_committed_1 && + git commit --dry-run >output && + test_i18ngrep "Initial commit" output + ' + + test_expect_success '"Initial commit" should not be noted in commit template' ' + git checkout --orphan empty-branch-4 && + test_commit test-commit-2 && + touch to_be_committed_2 && + git add to_be_committed_2 && + git commit --dry-run >output && + test_i18ngrep ! "Initial commit" output + ' + test_done diff --cc wt-status.h index d8ae2e590d,2389f08390..64f4d33ea1 --- a/wt-status.h +++ b/wt-status.h @@@ -76,8 -76,8 +76,9 @@@ struct wt_status char color_palette[WT_STATUS_MAXSLOT][COLOR_MAXLEN]; unsigned colopts; int null_termination; + int commit_template; int show_branch; + int show_stash; int hints; enum wt_status_format status_format;