From 37d07f8f9841a29cb53a1eda6acd3804c957f0e3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 12 Dec 2007 19:09:16 -0800 Subject: git-commit: squelch needless message during an empty merge When recording a merge that conflicted and ends up in no changes after manual resolution, commit callchain looked like this: cmd_commit() -> prepare_log_message() -> run_status() -> wt_status_print() This invocation of run_status() is asked to find out if there is a committable change, but it unconditionally gave instructions such as "use git-add" at the same time. When in merge, we do allow an empty change to be recorded, so after showing this message the code still went ahead and made a commit. This introduces "nowarn" parameter to run_status() to avoid these useless messages. If we are not allowed to create an empty commit, we already call run_status() again in the original codepath, and the message will be shown from that call anyway. Signed-off-by: Junio C Hamano --- wt-status.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'wt-status.c') diff --git a/wt-status.c b/wt-status.c index 51c1879691..c0c247243b 100644 --- a/wt-status.c +++ b/wt-status.c @@ -381,6 +381,8 @@ void wt_status_print(struct wt_status *s) if (!s->commitable) { if (s->amend) fprintf(s->fp, "# No changes\n"); + else if (s->nowarn) + ; /* nothing */ else if (s->workdir_dirty) printf("no changes added to commit (use \"git add\" and/or \"git commit -a\")\n"); else if (s->workdir_untracked) -- cgit v1.2.3