Skip to content

Commit edf563f

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7519443 commit edf563f

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

Documentation/config.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ advice.*::
122122
pushNonFastForward::
123123
Advice shown when linkgit:git-push[1] refuses
124124
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.
125129
--
126130

127131
core.fileMode::

advice.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#include "cache.h"
22

33
int advice_push_nonfastforward = 1;
4+
int advice_status_hints = 1;
45

56
static struct {
67
const char *name;
78
int *preference;
89
} advice_config[] = {
910
{ "pushnonfastforward", &advice_push_nonfastforward },
11+
{ "statushints", &advice_status_hints },
1012
};
1113

1214
int git_default_advice_config(const char *var, const char *value)

advice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define ADVICE_H
33

44
extern int advice_push_nonfastforward;
5+
extern int advice_status_hints;
56

67
int git_default_advice_config(const char *var, const char *value);
78

wt-status.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ static void wt_status_print_unmerged_header(struct wt_status *s)
4848
{
4949
const char *c = color(WT_STATUS_HEADER, s);
5050
color_fprintf_ln(s->fp, c, "# Unmerged paths:");
51+
if (!advice_status_hints)
52+
return;
5153
if (!s->is_initial)
5254
color_fprintf_ln(s->fp, c, "# (use \"git reset %s <file>...\" to unstage)", s->reference);
5355
else
@@ -60,6 +62,8 @@ static void wt_status_print_cached_header(struct wt_status *s)
6062
{
6163
const char *c = color(WT_STATUS_HEADER, s);
6264
color_fprintf_ln(s->fp, c, "# Changes to be committed:");
65+
if (!advice_status_hints)
66+
return;
6367
if (!s->is_initial) {
6468
color_fprintf_ln(s->fp, c, "# (use \"git reset %s <file>...\" to unstage)", s->reference);
6569
} else {
@@ -73,6 +77,8 @@ static void wt_status_print_dirty_header(struct wt_status *s,
7377
{
7478
const char *c = color(WT_STATUS_HEADER, s);
7579
color_fprintf_ln(s->fp, c, "# Changed but not updated:");
80+
if (!advice_status_hints)
81+
return;
7682
if (!has_deleted)
7783
color_fprintf_ln(s->fp, c, "# (use \"git add <file>...\" to update what will be committed)");
7884
else
@@ -85,6 +91,8 @@ static void wt_status_print_untracked_header(struct wt_status *s)
8591
{
8692
const char *c = color(WT_STATUS_HEADER, s);
8793
color_fprintf_ln(s->fp, c, "# Untracked files:");
94+
if (!advice_status_hints)
95+
return;
8896
color_fprintf_ln(s->fp, c, "# (use \"git add <file>...\" to include in what will be committed)");
8997
color_fprintf_ln(s->fp, c, "#");
9098
}

0 commit comments

Comments
 (0)