threads / patch / 17893

patch, 6 partsChange output "error: " to "Error: " etc

Subject: [PATCH 5/6] Change output "error: " to "Error: " etc

## tl;dr

19 messages between Feb 19, 2009 and Mar 22, 2009. Diffs are folded; open one to read it.

replies: 18people: 5as markdown or json

John Tapsell· Feb 19, 2009, 07:36 UTC · lore

All the error messages starting "Error: " begin with a captial E, except in one place. This commit fixes this, making the output look more consistent. At the moment a failed push, say, looks like:

Error: cannot lock existing info/refs
error: failed to push some refs to 'some repository'
Signed-off-by: John Tapsell <johnflux@gmail.com>
---
 usage.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
Show changes to usage.c +4 −4
diff --git a/usage.c b/usage.c
index 24f5fc0..acc4ee1 100644
--- a/usage.c
+++ b/usage.c
@@ -14,24 +14,24 @@ static void report(const char *prefix, const char *err, va_list params)
 
 static NORETURN void usage_builtin(const char *err)
 {
-	fprintf(stderr, "usage: %s\n", err);
+	fprintf(stderr, "Usage: %s\n", err);
 	exit(129);
 }
 
 static NORETURN void die_builtin(const char *err, va_list params)
 {
-	report("fatal: ", err, params);
+	report("Fatal: ", err, params);
 	exit(128);
 }
 
 static void error_builtin(const char *err, va_list params)
 {
-	report("error: ", err, params);
+	report("Error: ", err, params);
 }
 
 static void warn_builtin(const char *warn, va_list params)
 {
-	report("warning: ", warn, params);
+	report("Warning: ", warn, params);
 }
 
 /* If we are in a dlopen()ed .so write to a global variable would segfault
-- 
1.6.2.rc1.3.g7d31b.dirty
Thomas Rast· Feb 19, 2009, 08:14 UTC · re: John Tapsell · lore

Re: [PATCH 5/6] Change output "error: " to "Error: " etc

John Tapsell wrote:
Show 6 quoted lines
> All the error messages starting "Error: " begin with a captial E, except
> in one place.  This commit fixes this, making the output look more
> consistent.  At the moment a failed push, say, looks like:
> 
> Error: cannot lock existing info/refs
> error: failed to push some refs to 'some repository'
[...]
> -	report("fatal: ", err, params);
> +	report("Fatal: ", err, params);
A quick grep says this is going to break the tests:
  t/t1400-update-ref.sh:	 test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"'
  t/t1400-update-ref.sh:	 echo test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"'
  t/t1400-update-ref.sh:	 test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"'
  t/t1400-update-ref.sh:	 test "warning: Log .git/logs/'"$m has gap after $gd"'." = "$(cat e)"'
  t/t1400-update-ref.sh:	 test "warning: Log .git/logs/'"$m unexpectedly ended on $ld"'." = "$(cat e)"'
  t/t4012-diff-binary.sh:	 detected=`expr "$detected" : "fatal.*at line \\([0-9]*\\)\$"` &&
  t/t4012-diff-binary.sh:	 detected=`expr "$detected" : "fatal.*at line \\([0-9]*\\)\$"` &&
  t/t4018-diff-funcname.sh:			grep "fatal" > /dev/null )
  t/t4018-diff-funcname.sh:	grep "fatal: Last expression must not be negated:"
  t/t5400-send-pack.sh:	grep "warning: to refuse deleting" child/errs &&
  t/t5510-fetch.sh:	grep "fatal: '\''a\\\\!'\''b'\''" result
  t/t5516-fetch-push.sh:	grep "warning: updating the current branch" stderr
  t/t5516-fetch-push.sh:	! grep "warning: updating the current branch" stderr
  t/t5516-fetch-push.sh:	! grep "warning: updating the current branch" stderr
  t/t6300-for-each-ref.sh:		\"error: more than one quoting style\"*) : happy;;
  t/test-lib.sh:	say_color error "error: $*"

That being said, I'm not sure we can change this at all since it's the plumbing way of reporting errors/warnings.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Jeff King· Feb 19, 2009, 08:17 UTC · re: John Tapsell · lore

Re: [PATCH 5/6] Change output "error: " to "Error: " etc

On Thu, Feb 19, 2009 at 07:36:49AM +0000, John Tapsell wrote:
Show 6 quoted lines
> All the error messages starting "Error: " begin with a captial E, except
> in one place.  This commit fixes this, making the output look more
> consistent.  At the moment a failed push, say, looks like:
> 
> Error: cannot lock existing info/refs
> error: failed to push some refs to 'some repository'

I think this commit message is a little misleading. True, there is only one place where "error:" appears, but it is the place that is called by almost every piece of code. So by far the majority of errors are "error: ".

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.

That will make things consistent, which addresses your complaint. And then there can be a discussion if people want about whether "Error:" or "error:" is better (personally I like lowercase).

-Peff
Miklos Vajna· Feb 19, 2009, 12:07 UTC · re: Jeff King · lore

[PATCH] http-push: using error() and warning() as appropriate

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.
 http-push.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Show changes to http-push.c +3 −3
diff --git a/http-push.c b/http-push.c
index 30d2d34..3a41d36 100644
--- a/http-push.c
+++ b/http-push.c
@@ -759,7 +759,7 @@ static void finish_request(struct transfer_request *request)
 			}
 		} else {
 			if (request->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.");
 
 			git_inflate_end(&request->stream);
 			git_SHA1_Final(request->real_sha1, &request->c);
@@ -1616,7 +1616,7 @@ static int locking_available(void)
 			}
 			XML_ParserFree(parser);
 			if (!lock_flags)
-				error("Error: no DAV locking support on %s",
+				error("no DAV locking support on %s",
 				      remote->url);
 
 		} else {
@@ -2293,7 +2293,7 @@ int main(int argc, char **argv)
 		if (info_ref_lock)
 			remote->can_update_info_refs = 1;
 		else {
-			fprintf(stderr, "Error: cannot lock existing info/refs\n");
+			error("cannot lock existing info/refs");
 			rc = 1;
 			goto cleanup;
 		}
-- 
1.6.1
Jeff King· Feb 19, 2009, 12:21 UTC · re: Miklos Vajna · lore

Re: [PATCH] http-push: using error() and warning() as appropriate

On Thu, Feb 19, 2009 at 01:07:08PM +0100, Miklos Vajna wrote:
Show 14 quoted lines
> 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
---
Show changes to 2 files +2 −4

builtin-mv.c, http-walker.c

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)
Miklos Vajna· Feb 19, 2009, 12:52 UTC · re: Jeff King · lore

[PATCH 0/8] fprintf(stderr, "warning: ") -> warning() patches

On Thu, Feb 19, 2009 at 07:21:05AM -0500, Jeff King <peff@peff.net> wrote:
>   - there are several places that manually print "warning: " via
>     fprintf. I suppose those can be cleaned up to use warning(), too.

Here are 8 patches to do so. This does not contain the http-push patch I send already in this thread, nor your patch.

Miklos Vajna (8):
  builtin-apply: use warning() instead of fprintf(stderr, "warning: ")
  builtin-checkout: use warning() instead of fprintf(stderr, "warning:
    ")
  builtin-fetch-pack: use warning() instead of fprintf(stderr,
    "warning: ")
  builtin-init-db: use warning() instead of fprintf(stderr, "warning:
    ")
  builtin-rm: use warning() instead of fprintf(stderr, "warning: ")
  builtin-show-branch: use warning() instead of fprintf(stderr,
    "warning: ")
  builtin-show-ref: use warning() instead of fprintf(stderr, "warning:
    ")
  refs: use warning() instead of fprintf(stderr, "warning: ")
 builtin-apply.c       |   15 +++++++--------
 builtin-checkout.c    |    4 ++--
 builtin-fetch-pack.c  |    2 +-
 builtin-init-db.c     |    7 +++----
 builtin-rm.c          |    3 +--
 builtin-show-branch.c |    3 +--
 builtin-show-ref.c    |    2 +-
 refs.c                |    8 +++-----
 8 files changed, 19 insertions(+), 25 deletions(-)
Miklos Vajna· Feb 19, 2009, 12:53 UTC · re: Miklos Vajna · lore

[PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-apply.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
Show changes to builtin-apply.c +7 −8
diff --git a/builtin-apply.c b/builtin-apply.c
index f312798..f668825 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2451,7 +2451,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
 	if ((st_mode ^ patch->old_mode) & S_IFMT)
 		return error("%s: wrong type", old_name);
 	if (st_mode != patch->old_mode)
-		fprintf(stderr, "warning: %s has type %o, expected %o\n",
+		warning("%s has type %o, expected %o",
 			old_name, st_mode, patch->old_mode);
 	if (!patch->new_mode && !patch->is_delete)
 		patch->new_mode = st_mode;
@@ -2932,8 +2932,7 @@ static int write_out_one_reject(struct patch *patch)
 	cnt = strlen(patch->new_name);
 	if (ARRAY_SIZE(namebuf) <= cnt + 5) {
 		cnt = ARRAY_SIZE(namebuf) - 5;
-		fprintf(stderr,
-			"warning: truncating .rej filename to %.*s.rej",
+		warning("truncating .rej filename to %.*s.rej",
 			cnt - 1, patch->new_name);
 	}
 	memcpy(namebuf, patch->new_name, cnt);
@@ -3315,8 +3314,8 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
 		    squelch_whitespace_errors < whitespace_error) {
 			int squelched =
 				whitespace_error - squelch_whitespace_errors;
-			fprintf(stderr, "warning: squelched %d "
-				"whitespace error%s\n",
+			warning("squelched %d "
+				"whitespace error%s",
 				squelched,
 				squelched == 1 ? "" : "s");
 		}
@@ -3326,12 +3325,12 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
 			    whitespace_error == 1 ? "" : "s",
 			    whitespace_error == 1 ? "s" : "");
 		if (applied_after_fixing_ws && apply)
-			fprintf(stderr, "warning: %d line%s applied after"
-				" fixing whitespace errors.\n",
+			warning("%d line%s applied after"
+				" fixing whitespace errors.",
 				applied_after_fixing_ws,
 				applied_after_fixing_ws == 1 ? "" : "s");
 		else if (whitespace_error)
-			fprintf(stderr, "warning: %d line%s add%s whitespace errors.\n",
+			warning("%d line%s add%s whitespace errors.",
 				whitespace_error,
 				whitespace_error == 1 ? "" : "s",
 				whitespace_error == 1 ? "s" : "");
-- 
1.6.1
Jeff King· Feb 20, 2009, 03:02 UTC · re: Miklos Vajna · lore

Re: [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")

On Thu, Feb 19, 2009 at 01:53:10PM +0100, Miklos Vajna wrote:
Show 9 quoted lines
> @@ -2932,8 +2932,7 @@ static int write_out_one_reject(struct patch *patch)
>  	cnt = strlen(patch->new_name);
>  	if (ARRAY_SIZE(namebuf) <= cnt + 5) {
>  		cnt = ARRAY_SIZE(namebuf) - 5;
> -		fprintf(stderr,
> -			"warning: truncating .rej filename to %.*s.rej",
> +		warning("truncating .rej filename to %.*s.rej",
>  			cnt - 1, patch->new_name);
>  	}

Hmm. This hunk is actually changing behavior, as the original didn't have a newline. It looks like a bug in the original, though.

Other than that, these all look pretty straightforward. Probably the shell scripts should be switched to match, too. But it would be nice to hear from Junio first that this cleanup is even desired (so you don't waste time).

-Peff
Junio C Hamano· Feb 20, 2009, 06:11 UTC · re: Jeff King · lore

Re: [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")

Jeff King <peff@peff.net> writes:
> Other than that, these all look pretty straightforward. Probably the
> shell scripts should be switched to match, too. But it would be nice to
> hear from Junio first that this cleanup is even desired (so you don't
> waste time).

I think it is a good thing to do. If the pre-release-freeze is a good time to do so it is a different matter. A good way to judge would be how much of these overlap with "git diff master next" (smaller the better, obviously).

Miklos Vajna· Mar 22, 2009, 11:36 UTC · re: Junio C Hamano · lore

Re: [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")

On Thu, Feb 19, 2009 at 10:11:24PM -0800, Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > Other than that, these all look pretty straightforward. Probably the
> > shell scripts should be switched to match, too. But it would be nice to
> > hear from Junio first that this cleanup is even desired (so you don't
> > waste time).
> 
> I think it is a good thing to do.  If the pre-release-freeze is a good
> time to do so it is a different matter.  A good way to judge would be 
> how much of these overlap with "git diff master next" (smaller the better,
> obviously).
Should I rebase the series against current master and resend?
Junio C Hamano· Mar 22, 2009, 21:58 UTC · re: Miklos Vajna · lore

Re: [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")

Miklos Vajna <vmiklos@frugalware.org> writes:
Show 14 quoted lines
> On Thu, Feb 19, 2009 at 10:11:24PM -0800, Junio C Hamano <gitster@pobox.com> wrote:
>> Jeff King <peff@peff.net> writes:
>> 
>> > Other than that, these all look pretty straightforward. Probably the
>> > shell scripts should be switched to match, too. But it would be nice to
>> > hear from Junio first that this cleanup is even desired (so you don't
>> > waste time).
>> 
>> I think it is a good thing to do.  If the pre-release-freeze is a good
>> time to do so it is a different matter.  A good way to judge would be 
>> how much of these overlap with "git diff master next" (smaller the better,
>> obviously).
>
> Should I rebase the series against current master and resend?
Yes, please, if the overlap with "diff master next" is small enough.
Miklos Vajna· Feb 20, 2009, 09:41 UTC · re: Jeff King · lore

Re: [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")

On Thu, Feb 19, 2009 at 10:02:45PM -0500, Jeff King <peff@peff.net> wrote:
Show 14 quoted lines
> On Thu, Feb 19, 2009 at 01:53:10PM +0100, Miklos Vajna wrote:
> 
> > @@ -2932,8 +2932,7 @@ static int write_out_one_reject(struct patch *patch)
> >  	cnt = strlen(patch->new_name);
> >  	if (ARRAY_SIZE(namebuf) <= cnt + 5) {
> >  		cnt = ARRAY_SIZE(namebuf) - 5;
> > -		fprintf(stderr,
> > -			"warning: truncating .rej filename to %.*s.rej",
> > +		warning("truncating .rej filename to %.*s.rej",
> >  			cnt - 1, patch->new_name);
> >  	}
> 
> Hmm. This hunk is actually changing behavior, as the original didn't
> have a newline. It looks like a bug in the original, though.
I think so. The change in 5/8 (git-rm) is a similar one.
Miklos Vajna· Feb 19, 2009, 12:53 UTC · re: Miklos Vajna · lore

[PATCH 2/8] builtin-checkout: use warning() instead of fprintf(stderr, "warning: ")

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-checkout.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Show changes to builtin-checkout.c +2 −2
diff --git a/builtin-checkout.c b/builtin-checkout.c
index 20b34ce..0ddd34b 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -556,8 +556,8 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
 
 	if (!old.commit && !opts->force) {
 		if (!opts->quiet) {
-			fprintf(stderr, "warning: You appear to be on a branch yet to be born.\n");
-			fprintf(stderr, "warning: Forcing checkout of %s.\n", new->name);
+			warning("You appear to be on a branch yet to be born.");
+			warning("Forcing checkout of %s.", new->name);
 		}
 		opts->force = 1;
 	}
-- 
1.6.1
Miklos Vajna· Feb 19, 2009, 12:53 UTC · re: Miklos Vajna · lore

[PATCH 3/8] builtin-fetch-pack: use warning() instead of fprintf(stderr, "warning: ")

---
 builtin-fetch-pack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to builtin-fetch-pack.c +1 −1
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 67fb80e..85de2ba 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -606,7 +606,7 @@ static struct ref *do_fetch_pack(int fd[2],
 			/* When cloning, it is not unusual to have
 			 * no common commit.
 			 */
-			fprintf(stderr, "warning: no common commits\n");
+			warning("no common commits");
 
 	if (get_pack(fd, pack_lockfile))
 		die("git fetch-pack: fetch failed.");
-- 
1.6.1
Miklos Vajna· Feb 19, 2009, 12:54 UTC · re: Miklos Vajna · lore

[PATCH 4/8] builtin-init-db: use warning() instead of fprintf(stderr, "warning: ")

---
 builtin-init-db.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
Show changes to builtin-init-db.c +3 −4
diff --git a/builtin-init-db.c b/builtin-init-db.c
index ee3911f..fc63d0f 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -130,8 +130,7 @@ static void copy_templates(const char *template_dir)
 	}
 	dir = opendir(template_path);
 	if (!dir) {
-		fprintf(stderr, "warning: templates not found %s\n",
-			template_dir);
+		warning("templates not found %s", template_dir);
 		return;
 	}
 
@@ -144,8 +143,8 @@ static void copy_templates(const char *template_dir)
 
 	if (repository_format_version &&
 	    repository_format_version != GIT_REPO_VERSION) {
-		fprintf(stderr, "warning: not copying templates of "
-			"a wrong format version %d from '%s'\n",
+		warning("not copying templates of "
+			"a wrong format version %d from '%s'",
 			repository_format_version,
 			template_dir);
 		closedir(dir);
-- 
1.6.1
Miklos Vajna· Feb 19, 2009, 12:54 UTC · re: Miklos Vajna · lore

[PATCH 5/8] builtin-rm: use warning() instead of fprintf(stderr, "warning: ")

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-rm.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
Show changes to builtin-rm.c +1 −2
diff --git a/builtin-rm.c b/builtin-rm.c
index c11f455..269d608 100644
--- a/builtin-rm.c
+++ b/builtin-rm.c
@@ -59,8 +59,7 @@ static int check_local_mod(unsigned char *head, int index_only)
 
 		if (lstat(ce->name, &st) < 0) {
 			if (errno != ENOENT)
-				fprintf(stderr, "warning: '%s': %s",
-					ce->name, strerror(errno));
+				warning("'%s': %s", ce->name, strerror(errno));
 			/* It already vanished from the working tree */
 			continue;
 		}
-- 
1.6.1
Miklos Vajna· Feb 19, 2009, 12:54 UTC · re: Miklos Vajna · lore

[PATCH 6/8] builtin-show-branch: use warning() instead of fprintf(stderr, "warning: ")

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-show-branch.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
Show changes to builtin-show-branch.c +1 −2
diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 306b850..828e6f8 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -365,8 +365,7 @@ static int append_ref(const char *refname, const unsigned char *sha1,
 				return 0;
 	}
 	if (MAX_REVS <= ref_name_cnt) {
-		fprintf(stderr, "warning: ignoring %s; "
-			"cannot handle more than %d refs\n",
+		warning("ignoring %s; cannot handle more than %d refs",
 			refname, MAX_REVS);
 		return 0;
 	}
-- 
1.6.1
Miklos Vajna· Feb 19, 2009, 12:55 UTC · re: Miklos Vajna · lore

[PATCH 7/8] builtin-show-ref: use warning() instead of fprintf(stderr, "warning: ")

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-show-ref.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to builtin-show-ref.c +1 −1
diff --git a/builtin-show-ref.c b/builtin-show-ref.c
index 572b114..dc76c50 100644
--- a/builtin-show-ref.c
+++ b/builtin-show-ref.c
@@ -140,7 +140,7 @@ static int exclude_existing(const char *match)
 				continue;
 		}
 		if (check_ref_format(ref)) {
-			fprintf(stderr, "warning: ref '%s' ignored\n", ref);
+			warning("ref '%s' ignored", ref);
 			continue;
 		}
 		if (!string_list_has_string(&existing_refs, ref)) {
-- 
1.6.1
Miklos Vajna· Feb 19, 2009, 12:55 UTC · re: Miklos Vajna · lore

[PATCH 8/8] refs: use warning() instead of fprintf(stderr, "warning: ")

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 refs.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
Show changes to refs.c +3 −5
diff --git a/refs.c b/refs.c
index 6eb5f53..fd96824 100644
--- a/refs.c
+++ b/refs.c
@@ -995,7 +995,7 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
 
 	err = unlink(git_path("logs/%s", lock->ref_name));
 	if (err && errno != ENOENT)
-		fprintf(stderr, "warning: unlink(%s) failed: %s",
+		warning("unlink(%s) failed: %s",
 			git_path("logs/%s", lock->ref_name), strerror(errno));
 	invalidate_cached_refs();
 	unlock_ref(lock);
@@ -1437,8 +1437,7 @@ int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *
 				if (get_sha1_hex(rec + 41, sha1))
 					die("Log %s is corrupt.", logfile);
 				if (hashcmp(logged_sha1, sha1)) {
-					fprintf(stderr,
-						"warning: Log %s has gap after %s.\n",
+					warning("Log %s has gap after %s.",
 						logfile, show_date(date, tz, DATE_RFC2822));
 				}
 			}
@@ -1450,8 +1449,7 @@ int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *
 				if (get_sha1_hex(rec + 41, logged_sha1))
 					die("Log %s is corrupt.", logfile);
 				if (hashcmp(logged_sha1, sha1)) {
-					fprintf(stderr,
-						"warning: Log %s unexpectedly ended on %s.\n",
+					warning("Log %s unexpectedly ended on %s.",
 						logfile, show_date(date, tz, DATE_RFC2822));
 				}
 			}
-- 
1.6.1

← back to recent threads