]> git.neil.brown.name Git - git.git/commitdiff
Merge branch 'ks/status-initial-commit'
authorJunio C Hamano <gitster@pobox.com>
Fri, 30 Jun 2017 20:45:22 +0000 (13:45 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 30 Jun 2017 20:45:22 +0000 (13:45 -0700)
"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

1  2 
builtin/commit.c
t/t7508-status.sh
wt-status.c
wt-status.h

Simple merge
index f7fe22a195e437d5a2aa9c28ea5991b53ae2c7e7,db709048c25a4393bcc0b464770d265bf4f88515..43d19a9b2292033fd0297afb7df162efa2eb5621
@@@ -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.c
Simple merge
diff --cc wt-status.h
index d8ae2e590dafb87b92f5e3a4b183f0ccdeb4c359,2389f08390aa256a69c12d9ab7ccbe6025a045ec..64f4d33ea183c1a6e700f1f6667b83f0e904773e
@@@ -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;