git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Miklos Vajna <vmiklos@frugalware.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	John Tapsell <johnflux@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] http-push: using error() and warning() as appropriate
Date: Thu, 19 Feb 2009 07:21:05 -0500	[thread overview]
Message-ID: <20090219122104.GA4602@sigill.intra.peff.net> (raw)
In-Reply-To: <20090219120708.GM4371@genesis.frugalware.org>

On Thu, Feb 19, 2009 at 01:07:08PM +0100, Miklos Vajna wrote:

> Change three occurrences of using inconsistent error/warning reporting
> by using the relevant error() / warning() calls to be consistent with
> the rest of the code.
> 
> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> ---
> 
> On Thu, Feb 19, 2009 at 03:17:25AM -0500, Jeff King <peff@peff.net> wrote:
> > http-push seems to be the odd man out. It contains one fprintf(stderr,
> > "Error: ...") and one totally bogus error("Error: ..."), which will
> > print "error: Error: ...". Perhaps it would be better to scan through
> > the code and switch to using error() and warning() as appropriate.
> 
> I found these 3 occurrences.

A few more are in the diff below. But there are even more:

  - several "Warning: " lines in *.sh

  - some warnings actually come with "WARNING:" on every line. I don't
    think those should be changed, as they are obviously a more
    strenuous warning.

  - there are several places that manually print "warning: " via
    fprintf. I suppose those can be cleaned up to use warning(), too.

-Peff

---
diff --git a/builtin-mv.c b/builtin-mv.c
index 01270fe..fc6bd82 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -172,9 +172,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				 * check both source and destination
 				 */
 				if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
-					fprintf(stderr, "Warning: %s;"
-							" will overwrite!\n",
-							bad);
+					warning("%s; will overwrite!", bad);
 					bad = NULL;
 				} else
 					bad = "Cannot overwrite";
diff --git a/http-walker.c b/http-walker.c
index 0dbad3c..91abea7 100644
--- a/http-walker.c
+++ b/http-walker.c
@@ -235,7 +235,7 @@ static void finish_object_request(struct object_request *obj_req)
 	close(obj_req->local); obj_req->local = -1;
 
 	if (obj_req->http_code == 416) {
-		fprintf(stderr, "Warning: requested range invalid; we may already have all the data.\n");
+		warning("requested range invalid; we may already have all the data.");
 	} else if (obj_req->curl_result != CURLE_OK) {
 		if (stat(obj_req->tmpfile, &st) == 0)
 			if (st.st_size == 0)

  reply	other threads:[~2009-02-19 12:22 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19  7:36 [PATCH 5/6] Change output "error: " to "Error: " etc John Tapsell
2009-02-19  8:14 ` Thomas Rast
2009-02-19  8:17 ` Jeff King
2009-02-19 12:07   ` [PATCH] http-push: using error() and warning() as appropriate Miklos Vajna
2009-02-19 12:21     ` Jeff King [this message]
2009-02-19 12:52       ` [PATCH 0/8] fprintf(stderr, "warning: ") -> warning() patches Miklos Vajna
2009-02-19 12:53         ` [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ") Miklos Vajna
2009-02-20  3:02           ` Jeff King
2009-02-20  6:11             ` Junio C Hamano
2009-03-22 11:36               ` Miklos Vajna
2009-03-22 21:58                 ` Junio C Hamano
2009-03-24  1:09                   ` [PATCH 0/9] fprintf(stderr, "warning: ") -> warning() patches Miklos Vajna
2009-03-24  1:09                     ` [PATCH 1/9] http-push: using error() and warning() as appropriate Miklos Vajna
2009-03-24  1:09                       ` [PATCH 2/9] builtin-apply: use warning() instead of fprintf(stderr, "warning: ") Miklos Vajna
2009-03-24  1:09                         ` [PATCH 3/9] builtin-checkout: " Miklos Vajna
2009-03-24  1:09                           ` [PATCH 4/9] builtin-fetch-pack: " Miklos Vajna
2009-03-24  1:09                             ` [PATCH 5/9] builtin-init-db: " Miklos Vajna
2009-03-24  1:09                               ` [PATCH 6/9] builtin-rm: " Miklos Vajna
2009-03-24  1:09                                 ` [PATCH 7/9] builtin-show-branch: " Miklos Vajna
2009-03-24  1:09                                   ` [PATCH 8/9] builtin-show-ref: " Miklos Vajna
2009-03-24  1:09                                     ` [PATCH 9/9] refs: " Miklos Vajna
2009-03-24  1:17                                       ` Erik Faye-Lund
2009-03-24  1:23                                         ` Miklos Vajna
2009-03-24  1:28                                           ` Erik Faye-Lund
2009-03-24  1:25                         ` [PATCH 2/9] builtin-apply: " Erik Faye-Lund
2009-03-24  7:35                     ` [PATCH 0/9] fprintf(stderr, "warning: ") -> warning() patches Jeff King
2009-03-24  8:01                       ` Junio C Hamano
2009-02-20  9:41             ` [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ") Miklos Vajna
2009-02-19 12:53         ` [PATCH 2/8] builtin-checkout: " Miklos Vajna
2009-02-19 12:53         ` [PATCH 3/8] builtin-fetch-pack: " Miklos Vajna
2009-02-19 12:54         ` [PATCH 4/8] builtin-init-db: " Miklos Vajna
2009-02-19 12:54         ` [PATCH 5/8] builtin-rm: " Miklos Vajna
2009-02-19 12:54         ` [PATCH 6/8] builtin-show-branch: " Miklos Vajna
2009-02-19 12:55         ` [PATCH 7/8] builtin-show-ref: " Miklos Vajna
2009-02-19 12:55         ` [PATCH 8/8] refs: " Miklos Vajna

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=20090219122104.GA4602@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johnflux@gmail.com \
    --cc=vmiklos@frugalware.org \
    /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).