From: Jeff King <peff@peff.net>
To: Nanako Shiraishi <nanako3@lavabit.com>
Cc: Junio C Hamano <gitster@pobox.com>,
Matthieu Moy <Matthieu.Moy@imag.fr>,
Teemu Likonen <tlikonen@iki.fi>,
git@vger.kernel.org
Subject: [PATCH 4/4] status: make "how to stage" messages optional
Date: Sun, 6 Sep 2009 02:50:44 -0400 [thread overview]
Message-ID: <20090906065044.GD28941@coredump.intra.peff.net> (raw)
In-Reply-To: <20090906064454.GA1643@coredump.intra.peff.net>
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>
---
This also actually cuts out the blank line after the instructions, so:
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: file
#
becomes:
# Changed but not updated:
# modified: file
#
Arguably the blank should be left in.
Documentation/config.txt | 4 ++++
messages.c | 1 +
messages.h | 1 +
wt-status.c | 8 ++++++++
4 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index ec308a6..cadbfc9 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1215,6 +1215,10 @@ message.*::
pushNonFastForward::
Help message shown when linkgit:git-push[1] refuses
non-fast-forward refs. Default: true.
+ statusAdvice::
+ Directions on how to stage/unstage/add shown in the
+ output of linkgit:git-status[1] and the template shown
+ when writing commit messages. Default: true.
--
pack.window::
diff --git a/messages.c b/messages.c
index 00fc196..d2785b2 100644
--- a/messages.c
+++ b/messages.c
@@ -3,6 +3,7 @@
struct message_preference messages[] = {
{ "pushnonfastforward", 1 },
+ { "statusadvice", 1 },
};
int git_default_message_config(const char *var, const char *value)
diff --git a/messages.h b/messages.h
index f175747..8edd08e 100644
--- a/messages.h
+++ b/messages.h
@@ -2,6 +2,7 @@
#define MESSAGE_H
#define MESSAGE_PUSH_NONFASTFORWARD 0
+#define MESSAGE_STATUS_ADVICE 1
struct message_preference {
const char *name;
diff --git a/wt-status.c b/wt-status.c
index 85f3fcb..716d8cc 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -48,6 +48,8 @@ static void wt_status_print_unmerged_header(struct wt_status *s)
{
const char *c = color(WT_STATUS_HEADER, s);
color_fprintf_ln(s->fp, c, "# Unmerged paths:");
+ if (!messages[MESSAGE_STATUS_ADVICE].preference)
+ return;
if (!s->is_initial)
color_fprintf_ln(s->fp, c, "# (use \"git reset %s <file>...\" to unstage)", s->reference);
else
@@ -60,6 +62,8 @@ static void wt_status_print_cached_header(struct wt_status *s)
{
const char *c = color(WT_STATUS_HEADER, s);
color_fprintf_ln(s->fp, c, "# Changes to be committed:");
+ if (!messages[MESSAGE_STATUS_ADVICE].preference)
+ return;
if (!s->is_initial) {
color_fprintf_ln(s->fp, c, "# (use \"git reset %s <file>...\" to unstage)", s->reference);
} else {
@@ -73,6 +77,8 @@ static void wt_status_print_dirty_header(struct wt_status *s,
{
const char *c = color(WT_STATUS_HEADER, s);
color_fprintf_ln(s->fp, c, "# Changed but not updated:");
+ if (!messages[MESSAGE_STATUS_ADVICE].preference)
+ return;
if (!has_deleted)
color_fprintf_ln(s->fp, c, "# (use \"git add <file>...\" to update what will be committed)");
else
@@ -85,6 +91,8 @@ static void wt_status_print_untracked_header(struct wt_status *s)
{
const char *c = color(WT_STATUS_HEADER, s);
color_fprintf_ln(s->fp, c, "# Untracked files:");
+ if (!messages[MESSAGE_STATUS_ADVICE].preference)
+ return;
color_fprintf_ln(s->fp, c, "# (use \"git add <file>...\" to include in what will be committed)");
color_fprintf_ln(s->fp, c, "#");
}
--
1.6.4.2.266.g981efc.dirty
next prev parent reply other threads:[~2009-09-06 6:50 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-06 17:32 [PATCH] push: point to 'git pull' and 'git push --force' in case of non-fast forward Matthieu Moy
2009-08-06 20:04 ` Michael J Gruber
2009-08-07 19:21 ` Matthieu Moy
2009-08-07 19:46 ` Michael J Gruber
2009-08-06 20:15 ` Junio C Hamano
2009-08-06 21:16 ` [PATCH] " Nicolas Sebrecht
2009-08-06 21:32 ` Junio C Hamano
2009-08-07 19:37 ` [PATCH] " Matthieu Moy
2009-08-07 20:05 ` Junio C Hamano
2009-08-07 20:22 ` Matthieu Moy
2009-08-08 7:51 ` [PATCH v2] " Matthieu Moy
2009-08-08 8:35 ` Teemu Likonen
2009-08-08 15:22 ` Matthieu Moy
2009-08-08 16:25 ` Junio C Hamano
2009-08-08 22:23 ` [PATCH v2] " Nicolas Sebrecht
2009-08-09 18:35 ` [PATCH v2] " Matthieu Moy
2009-08-09 20:22 ` Junio C Hamano
2009-08-10 8:43 ` Matthieu Moy
2009-08-10 8:49 ` Junio C Hamano
2009-08-10 8:56 ` Matthieu Moy
2009-08-11 3:03 ` Nanako Shiraishi
2009-09-06 6:44 ` [RFC/PATCH 0/4] make helpful messages optional Jeff King
2009-09-06 6:46 ` [PATCH 1/4] push: fix english in non-fast-forward message Jeff King
2009-09-06 6:47 ` [PATCH 2/4] push: re-flow " Jeff King
2009-09-06 6:48 ` [PATCH 3/4] push: make non-fast-forward help message configurable Jeff King
2009-09-06 7:09 ` Junio C Hamano
2009-09-06 7:23 ` Jeff King
2009-09-06 7:30 ` Junio C Hamano
2009-09-06 7:32 ` Jeff King
2009-09-06 7:52 ` Junio C Hamano
2009-09-06 11:30 ` Sverre Rabbelier
2009-09-07 0:44 ` Nanako Shiraishi
2009-09-07 7:35 ` Johannes Sixt
2009-09-07 7:40 ` Mike Hommey
2009-09-07 8:24 ` Jeff King
2009-09-07 8:34 ` Matthieu Moy
2009-09-07 8:54 ` Jeff King
2009-09-07 11:20 ` Matthieu Moy
2009-09-08 18:51 ` Uri Okrent
2009-09-09 11:22 ` Jeff King
2009-09-09 11:26 ` [PATCH 0/2] configurable advice messages Jeff King
2009-09-09 11:38 ` [PATCH 1/2] push: make non-fast-forward help message configurable Jeff King
2009-09-09 19:06 ` Junio C Hamano
2009-09-09 20:39 ` Jeff King
2009-09-09 21:47 ` Junio C Hamano
2009-09-09 11:43 ` [PATCH 2/2] status: make "how to stage" messages optional Jeff King
2009-09-06 6:50 ` Jeff King [this message]
2009-09-06 11:53 ` [RFC/PATCH 0/4] make helpful " Matthieu Moy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090906065044.GD28941@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=Matthieu.Moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nanako3@lavabit.com \
--cc=tlikonen@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).