Merge branch 'hw/commit-advise-while-rejecting'

"git commit" gives output similar to "git status" when there is
nothing to commit, but without honoring the advise.statusHints
configuration variable, which has been corrected.

* hw/commit-advise-while-rejecting:
  commit: honor advice.statusHints when rejecting an empty commit
This commit is contained in:
Junio C Hamano 2020-01-22 15:07:30 -08:00
Родитель 237a83a943 5c4f55f1f6
Коммит 9403e5dcdd
2 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -964,6 +964,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
*/
if (!committable && whence != FROM_MERGE && !allow_empty &&
!(amend && is_a_merge(current_head))) {
s->hints = advice_status_hints;
s->display_comment_prefix = old_display_comment_prefix;
run_status(stdout, index_file, prefix, 0, s);
if (amend)

Просмотреть файл

@ -382,4 +382,13 @@ test_expect_success 'check commit with unstaged rename and copy' '
)
'
test_expect_success 'commit without staging files fails and displays hints' '
echo "initial" >file &&
git add file &&
git commit -m initial &&
echo "changes" >>file &&
test_must_fail git commit -m update >actual &&
test_i18ngrep "no changes added to commit (use \"git add\" and/or \"git commit -a\")" actual
'
test_done