status: make "how to stage" messages optional
These messages are nice for new users, but experienced git users know how to manipulate the index, and these messages waste a lot of screen real estate. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Sep 9, 2009 at 07:43 UTC
edf563fbaa2ab50734db4a61e9092f25fbb5a417
4 files changed
+15
Documentation/config.txt
+4
@@ -122,6 +122,10 @@ advice.*::
122
pushNonFastForward::
123
Advice shown when linkgit:git-push[1] refuses
124
non-fast-forward refs. Default: true.
125
+ statusHints::
126
+ Directions on how to stage/unstage/add shown in the
127
+ output of linkgit:git-status[1] and the template shown
128
+ when writing commit messages. Default: true.
129
--
130
131
core.fileMode::
advice.c
+2
@@ -1,12 +1,14 @@
1
#include "cache.h"
2
3
int advice_push_nonfastforward = 1;
4
+int advice_status_hints = 1;
5
6
static struct {
7
const char *name;
8
int *preference;
9
} advice_config[] = {
10
{ "pushnonfastforward", &advice_push_nonfastforward },
11
+ { "statushints", &advice_status_hints },
12
};
13
14
int git_default_advice_config(const char *var, const char *value)
advice.h
+1
@@ -2,6 +2,7 @@
2
#define ADVICE_H
3
4
extern int advice_push_nonfastforward;
5
+extern int advice_status_hints;
6
7
int git_default_advice_config(const char *var, const char *value);
8
wt-status.c
+8
@@ -48,6 +48,8 @@ static void wt_status_print_unmerged_header(struct wt_status *s)
48
{
49
const char *c = color(WT_STATUS_HEADER, s);
50
color_fprintf_ln(s->fp, c, "# Unmerged paths:");
51
+ if (!advice_status_hints)
52
+ return;
53
if (!s->is_initial)
54
color_fprintf_ln(s->fp, c, "# (use \"git reset %s <file>...\" to unstage)", s->reference);
55
else
@@ -60,6 +62,8 @@ static void wt_status_print_cached_header(struct wt_status *s)
62
{
63
const char *c = color(WT_STATUS_HEADER, s);
64
color_fprintf_ln(s->fp, c, "# Changes to be committed:");
65
+ if (!advice_status_hints)
66
+ return;
67
if (!s->is_initial) {
68
color_fprintf_ln(s->fp, c, "# (use \"git reset %s <file>...\" to unstage)", s->reference);
69
} else {
@@ -73,6 +77,8 @@ static void wt_status_print_dirty_header(struct wt_status *s,
77
{
78
const char *c = color(WT_STATUS_HEADER, s);
79
color_fprintf_ln(s->fp, c, "# Changed but not updated:");
80
+ if (!advice_status_hints)
81
+ return;
82
if (!has_deleted)
83
color_fprintf_ln(s->fp, c, "# (use \"git add <file>...\" to update what will be committed)");
84
else
@@ -85,6 +91,8 @@ static void wt_status_print_untracked_header(struct wt_status *s)
91
{
92
const char *c = color(WT_STATUS_HEADER, s);
93
color_fprintf_ln(s->fp, c, "# Untracked files:");
94
+ if (!advice_status_hints)
95
+ return;
96
color_fprintf_ln(s->fp, c, "# (use \"git add <file>...\" to include in what will be committed)");
97
color_fprintf_ln(s->fp, c, "#");
98
}