Junio C Hamano <junkio@xxxxxxx> writes: > Michael Loeffler <zvpunry@xxxxxxxxxx> 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; - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html