Skip to content

Commit

Permalink
wt-status: take advice.statusHints seriously
Browse files Browse the repository at this point in the history
Currently, status gives a lot of hints even when advice.statusHints is
false. Change this so that all hints depend on the config variable.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael J Gruber authored and Junio C Hamano committed May 6, 2010
1 parent 18f3b5a commit 980bde3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion t/t7508-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ cat >expect <<EOF
# Changed but not updated:
# modified: dir1/modified
#
# Untracked files not listed (use -u option to show untracked files)
# Untracked files not listed
EOF
git config advice.statusHints false
test_expect_success 'status -uno (advice.statusHints false)' '
Expand Down
21 changes: 15 additions & 6 deletions wt-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,9 @@ void wt_status_print(struct wt_status *s)
if (s->show_untracked_files)
wt_status_print_untracked(s);
else if (s->commitable)
fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
fprintf(s->fp, "# Untracked files not listed%s\n",
advice_status_hints
? " (use -u option to show untracked files)" : "");

if (s->verbose)
wt_status_print_verbose(s);
Expand All @@ -635,15 +637,22 @@ void wt_status_print(struct wt_status *s)
else if (s->nowarn)
; /* nothing */
else if (s->workdir_dirty)
printf("no changes added to commit (use \"git add\" and/or \"git commit -a\")\n");
printf("no changes added to commit%s\n",
advice_status_hints
? " (use \"git add\" and/or \"git commit -a\")" : "");
else if (s->untracked.nr)
printf("nothing added to commit but untracked files present (use \"git add\" to track)\n");
printf("nothing added to commit but untracked files present%s\n",
advice_status_hints
? " (use \"git add\" to track)" : "");
else if (s->is_initial)
printf("nothing to commit (create/copy files and use \"git add\" to track)\n");
printf("nothing to commit%s\n", advice_status_hints
? " (create/copy files and use \"git add\" to track)" : "");
else if (!s->show_untracked_files)
printf("nothing to commit (use -u to show untracked files)\n");
printf("nothing to commit%s\n", advice_status_hints
? " (use -u to show untracked files)" : "");
else
printf("nothing to commit (working directory clean)\n");
printf("nothing to commit%s\n", advice_status_hints
? " (working directory clean)" : "");
}
}

Expand Down

0 comments on commit 980bde3

Please sign in to comment.