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 <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael J Gruber committed
Apr 22, 2010 at 22:30 UTC
980bde389491e65df3a6f26f755064013b65740c
2 files changed
+16
-7
t/t7508-status.sh
+1
-1
@@ -151,7 +151,7 @@ cat >expect <<EOF
151
# Changed but not updated:
152
# modified: dir1/modified
153
#
154
-# Untracked files not listed (use -u option to show untracked files)
154
+# Untracked files not listed
155
EOF
156
git config advice.statusHints false
157
test_expect_success 'status -uno (advice.statusHints false)' '
wt-status.c
+15
-6
@@ -625,7 +625,9 @@ void wt_status_print(struct wt_status *s)
625
if (s->show_untracked_files)
626
wt_status_print_untracked(s);
627
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)" : "");
631
632
if (s->verbose)
633
wt_status_print_verbose(s);
@@ -635,15 +637,22 @@ void wt_status_print(struct wt_status *s)
637
else if (s->nowarn)
638
; /* nothing */
639
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\")" : "");
643
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)" : "");
647
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)" : "");
650
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)" : "");
653
else
646
- printf("nothing to commit (working directory clean)\n");
654
+ printf("nothing to commit%s\n", advice_status_hints
655
+ ? " (working directory clean)" : "");
656
}
657
}
658