From: Junio C Hamano <junkio@cox.net>
To: Michael Loeffler <zvpunry@zvpunry.de>
Cc: git@vger.kernel.org, "Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: [PATCH 1/2] Suggest use of "git add file1 file2" when there is nothing to commit.
Date: Fri, 05 Jan 2007 21:57:19 -0800 [thread overview]
Message-ID: <7vodpcae9s.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7virfldryw.fsf@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Fri, 05 Jan 2007 14:33:11 -0800")
Junio C Hamano <junkio@cox.net> writes:
> Michael Loeffler <zvpunry@zvpunry.de> writes:
>
>> Am Freitag, den 15.12.2006, 21:53 -0500 schrieb Shawn O. Pearce:
>> ...
>>> + printf("%s (%s)\n",
>>> + s->amend ? "# No changes" : "nothing to commit",
>>> + use_add_msg);
>>> }
>> I don't like the new 'nothing to commit (use "git add ... message")'
>> message. I use git status very often to see if there is something to
>> commit, but now there is always this annoying "use git add ..." message.
>
> I tend to not like _ANY_ change at all, but I've learned to wait
> and see if I get used to it when I see something that annoys me
> initially, to see if the annoyance is because what it does is
> truly wrong or it is because what it does is merely different
> from what I am used to.
>
> So I've been trying it out myself as one of the guinea pigs on
> this one as well.
>
> So far, my judgement is that this is of the better kind; it is
> easy to get used to, and once you get used to it, it is easily
> ignorable.
How about doing this?
-- >8 --
git-status: squelch "use 'git add file...'" message when unneeded
Add a field in wt_status to record if there are any uncached
changes, and use it to decide when there is no point to add the
"use 'git add'" message.
---
diff --git a/wt-status.c b/wt-status.c
index db42738..1037c94 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -15,7 +15,7 @@ static char wt_status_colors[][COLOR_MAXLEN] = {
"\033[31m", /* WT_STATUS_CHANGED: red */
"\033[31m", /* WT_STATUS_UNTRACKED: red */
};
-static const char* use_add_msg = "use \"git add file1 file2\" to include for commit";
+static const char* use_add_msg = "use \"git add file...\" to include for commit";
static int parse_status_slot(const char *var, int offset)
{
@@ -162,13 +162,17 @@ static void wt_status_print_changed_cb(struct diff_queue_struct *q,
struct diff_options *options,
void *data)
{
+ struct wt_status *s = (struct wt_status *)data;
int i;
- if (q->nr)
- wt_status_print_header("Changed but not added", use_add_msg);
+
+ s->modified = q->nr;
+ if (!q->nr)
+ return;
+
+ wt_status_print_header("Changed but not added", use_add_msg);
for (i = 0; i < q->nr; i++)
wt_status_print_filepair(WT_STATUS_CHANGED, q->queue[i]);
- if (q->nr)
- wt_status_print_trailer();
+ wt_status_print_trailer();
}
void wt_status_print_initial(struct wt_status *s)
@@ -291,10 +295,14 @@ void wt_status_print(struct wt_status *s)
if (s->verbose && !s->is_initial)
wt_status_print_verbose(s);
- if (!s->commitable)
- printf("%s (%s)\n",
- s->amend ? "# No changes" : "nothing to commit",
- use_add_msg);
+ if (!s->commitable) {
+ const char *msg =
+ s->amend ? "# No changes" : "nothing to commit";
+ if (s->modified)
+ printf("%s (%s)\n", msg, use_add_msg);
+ else
+ printf("%s\n", msg);
+ }
}
int git_status_config(const char *k, const char *v)
diff --git a/wt-status.h b/wt-status.h
index 0a5a5b7..72df1b3 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -13,6 +13,7 @@ struct wt_status {
char *branch;
const char *reference;
int commitable;
+ int modified;
int verbose;
int amend;
int untracked;
next prev parent reply other threads:[~2007-01-06 5:57 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-16 2:53 [PATCH 1/2] Suggest use of "git add file1 file2" when there is nothing to commit Shawn O. Pearce
2007-01-05 20:44 ` Michael Loeffler
2007-01-05 22:33 ` Junio C Hamano
2007-01-06 5:57 ` Junio C Hamano [this message]
2007-01-06 13:33 ` Juergen Ruehle
2007-01-06 18:17 ` Junio C Hamano
2007-01-06 23:00 ` Juergen Ruehle
2007-01-08 5:48 ` Junio C Hamano
2007-01-08 10:42 ` Juergen Ruehle
2007-01-08 20:13 ` Junio C Hamano
2007-01-10 7:08 ` [PATCH] Provide better feedback for the untracked only case in status output Juergen Ruehle
2007-01-10 7:17 ` Juergen Ruehle
2007-01-10 7:29 ` Juergen Ruehle
2007-01-10 7:39 ` Junio C Hamano
2007-01-10 18:33 ` Juergen Ruehle
2007-01-10 20:07 ` [PATCH] Quick hack to avoid double qp encoding Juergen Ruehle
2007-01-10 20:37 ` Juergen Ruehle
2007-01-10 21:29 ` Junio C Hamano
2007-01-10 18:16 ` [PATCH] Provide better feedback for the untracked only case in status output Michael Loeffler
2007-01-10 20:14 ` Juergen Ruehle
2007-01-10 22:25 ` Juergen Ruehle
2007-01-10 22:29 ` Jeff King
2007-01-11 7:17 ` Juergen Ruehle
2007-01-06 14:02 ` [PATCH 1/2] Suggest use of "git add file1 file2" when there is nothing to commit Juergen Ruehle
2007-01-08 19:18 ` Michael Loeffler
2007-01-09 5:42 ` Juergen Ruehle
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vodpcae9s.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.org \
--cc=zvpunry@zvpunry.de \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).