Skip to content

Commit 980bde3

Browse files
Michael J Grubergitster
authored andcommitted
wt-status: take advice.statusHints seriously
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 18f3b5a commit 980bde3

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

t/t7508-status.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ cat >expect <<EOF
151151
# Changed but not updated:
152152
# modified: dir1/modified
153153
#
154-
# Untracked files not listed (use -u option to show untracked files)
154+
# Untracked files not listed
155155
EOF
156156
git config advice.statusHints false
157157
test_expect_success 'status -uno (advice.statusHints false)' '

wt-status.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,9 @@ void wt_status_print(struct wt_status *s)
625625
if (s->show_untracked_files)
626626
wt_status_print_untracked(s);
627627
else if (s->commitable)
628-
fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
628+
fprintf(s->fp, "# Untracked files not listed%s\n",
629+
advice_status_hints
630+
? " (use -u option to show untracked files)" : "");
629631

630632
if (s->verbose)
631633
wt_status_print_verbose(s);
@@ -635,15 +637,22 @@ void wt_status_print(struct wt_status *s)
635637
else if (s->nowarn)
636638
; /* nothing */
637639
else if (s->workdir_dirty)
638-
printf("no changes added to commit (use \"git add\" and/or \"git commit -a\")\n");
640+
printf("no changes added to commit%s\n",
641+
advice_status_hints
642+
? " (use \"git add\" and/or \"git commit -a\")" : "");
639643
else if (s->untracked.nr)
640-
printf("nothing added to commit but untracked files present (use \"git add\" to track)\n");
644+
printf("nothing added to commit but untracked files present%s\n",
645+
advice_status_hints
646+
? " (use \"git add\" to track)" : "");
641647
else if (s->is_initial)
642-
printf("nothing to commit (create/copy files and use \"git add\" to track)\n");
648+
printf("nothing to commit%s\n", advice_status_hints
649+
? " (create/copy files and use \"git add\" to track)" : "");
643650
else if (!s->show_untracked_files)
644-
printf("nothing to commit (use -u to show untracked files)\n");
651+
printf("nothing to commit%s\n", advice_status_hints
652+
? " (use -u to show untracked files)" : "");
645653
else
646-
printf("nothing to commit (working directory clean)\n");
654+
printf("nothing to commit%s\n", advice_status_hints
655+
? " (working directory clean)" : "");
647656
}
648657
}
649658

0 commit comments

Comments
 (0)