All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/6] Change output "error: " to "Error: " etc
@ 2009-02-19  7:36 John Tapsell
  2009-02-19  8:14 ` Thomas Rast
  2009-02-19  8:17 ` Jeff King
  0 siblings, 2 replies; 35+ messages in thread
From: John Tapsell @ 2009-02-19  7:36 UTC (permalink / raw)
  To: Git Mailing List

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(-)

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

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH 5/6] Change output "error: " to "Error: " etc
  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
  1 sibling, 0 replies; 35+ messages in thread
From: Thomas Rast @ 2009-02-19  8:14 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 1968 bytes --]

John Tapsell wrote:
> 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

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 5/6] Change output "error: " to "Error: " etc
  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
  1 sibling, 1 reply; 35+ messages in thread
From: Jeff King @ 2009-02-19  8:17 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git Mailing List

On Thu, Feb 19, 2009 at 07:36:49AM +0000, John Tapsell wrote:

> 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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH] http-push: using error() and warning() as appropriate
  2009-02-19  8:17 ` Jeff King
@ 2009-02-19 12:07   ` Miklos Vajna
  2009-02-19 12:21     ` Jeff King
  0 siblings, 1 reply; 35+ messages in thread
From: Miklos Vajna @ 2009-02-19 12:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

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(-)

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

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH] http-push: using error() and warning() as appropriate
  2009-02-19 12:07   ` [PATCH] http-push: using error() and warning() as appropriate Miklos Vajna
@ 2009-02-19 12:21     ` Jeff King
  2009-02-19 12:52       ` [PATCH 0/8] fprintf(stderr, "warning: ") -> warning() patches Miklos Vajna
  0 siblings, 1 reply; 35+ messages in thread
From: Jeff King @ 2009-02-19 12:21 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Junio C Hamano, John Tapsell, Git Mailing List

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)

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 0/8] fprintf(stderr, "warning: ") -> warning() patches
  2009-02-19 12:21     ` Jeff King
@ 2009-02-19 12:52       ` Miklos Vajna
  2009-02-19 12:53         ` [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ") Miklos Vajna
                           ` (7 more replies)
  0 siblings, 8 replies; 35+ messages in thread
From: Miklos Vajna @ 2009-02-19 12:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

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(-)

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")
  2009-02-19 12:52       ` [PATCH 0/8] fprintf(stderr, "warning: ") -> warning() patches Miklos Vajna
@ 2009-02-19 12:53         ` Miklos Vajna
  2009-02-20  3:02           ` Jeff King
  2009-02-19 12:53         ` [PATCH 2/8] builtin-checkout: " Miklos Vajna
                           ` (6 subsequent siblings)
  7 siblings, 1 reply; 35+ messages in thread
From: Miklos Vajna @ 2009-02-19 12:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-apply.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

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

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 2/8] builtin-checkout: use warning() instead of fprintf(stderr, "warning: ")
  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-19 12:53         ` Miklos Vajna
  2009-02-19 12:53         ` [PATCH 3/8] builtin-fetch-pack: " Miklos Vajna
                           ` (5 subsequent siblings)
  7 siblings, 0 replies; 35+ messages in thread
From: Miklos Vajna @ 2009-02-19 12:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-checkout.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

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

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 3/8] builtin-fetch-pack: use warning() instead of fprintf(stderr, "warning: ")
  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-19 12:53         ` [PATCH 2/8] builtin-checkout: " Miklos Vajna
@ 2009-02-19 12:53         ` Miklos Vajna
  2009-02-19 12:54         ` [PATCH 4/8] builtin-init-db: " Miklos Vajna
                           ` (4 subsequent siblings)
  7 siblings, 0 replies; 35+ messages in thread
From: Miklos Vajna @ 2009-02-19 12:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

---
 builtin-fetch-pack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 4/8] builtin-init-db: use warning() instead of fprintf(stderr, "warning: ")
  2009-02-19 12:52       ` [PATCH 0/8] fprintf(stderr, "warning: ") -> warning() patches Miklos Vajna
                           ` (2 preceding siblings ...)
  2009-02-19 12:53         ` [PATCH 3/8] builtin-fetch-pack: " Miklos Vajna
@ 2009-02-19 12:54         ` Miklos Vajna
  2009-02-19 12:54         ` [PATCH 5/8] builtin-rm: " Miklos Vajna
                           ` (3 subsequent siblings)
  7 siblings, 0 replies; 35+ messages in thread
From: Miklos Vajna @ 2009-02-19 12:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

---
 builtin-init-db.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

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

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 5/8] builtin-rm: use warning() instead of fprintf(stderr, "warning: ")
  2009-02-19 12:52       ` [PATCH 0/8] fprintf(stderr, "warning: ") -> warning() patches Miklos Vajna
                           ` (3 preceding siblings ...)
  2009-02-19 12:54         ` [PATCH 4/8] builtin-init-db: " Miklos Vajna
@ 2009-02-19 12:54         ` Miklos Vajna
  2009-02-19 12:54         ` [PATCH 6/8] builtin-show-branch: " Miklos Vajna
                           ` (2 subsequent siblings)
  7 siblings, 0 replies; 35+ messages in thread
From: Miklos Vajna @ 2009-02-19 12:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-rm.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

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

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 6/8] builtin-show-branch: use warning() instead of fprintf(stderr, "warning: ")
  2009-02-19 12:52       ` [PATCH 0/8] fprintf(stderr, "warning: ") -> warning() patches Miklos Vajna
                           ` (4 preceding siblings ...)
  2009-02-19 12:54         ` [PATCH 5/8] builtin-rm: " Miklos Vajna
@ 2009-02-19 12:54         ` 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
  7 siblings, 0 replies; 35+ messages in thread
From: Miklos Vajna @ 2009-02-19 12:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-show-branch.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

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

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 7/8] builtin-show-ref: use warning() instead of fprintf(stderr, "warning: ")
  2009-02-19 12:52       ` [PATCH 0/8] fprintf(stderr, "warning: ") -> warning() patches Miklos Vajna
                           ` (5 preceding siblings ...)
  2009-02-19 12:54         ` [PATCH 6/8] builtin-show-branch: " Miklos Vajna
@ 2009-02-19 12:55         ` Miklos Vajna
  2009-02-19 12:55         ` [PATCH 8/8] refs: " Miklos Vajna
  7 siblings, 0 replies; 35+ messages in thread
From: Miklos Vajna @ 2009-02-19 12:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-show-ref.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 8/8] refs: use warning() instead of fprintf(stderr, "warning: ")
  2009-02-19 12:52       ` [PATCH 0/8] fprintf(stderr, "warning: ") -> warning() patches Miklos Vajna
                           ` (6 preceding siblings ...)
  2009-02-19 12:55         ` [PATCH 7/8] builtin-show-ref: " Miklos Vajna
@ 2009-02-19 12:55         ` Miklos Vajna
  7 siblings, 0 replies; 35+ messages in thread
From: Miklos Vajna @ 2009-02-19 12:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 refs.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

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

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")
  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-02-20  9:41             ` [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ") Miklos Vajna
  0 siblings, 2 replies; 35+ messages in thread
From: Jeff King @ 2009-02-20  3:02 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Junio C Hamano, John Tapsell, Git Mailing List

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.

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

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")
  2009-02-20  3:02           ` Jeff King
@ 2009-02-20  6:11             ` Junio C Hamano
  2009-03-22 11:36               ` Miklos Vajna
  2009-02-20  9:41             ` [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ") Miklos Vajna
  1 sibling, 1 reply; 35+ messages in thread
From: Junio C Hamano @ 2009-02-20  6:11 UTC (permalink / raw)
  To: Jeff King; +Cc: Miklos Vajna, John Tapsell, Git Mailing List

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).

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")
  2009-02-20  3:02           ` Jeff King
  2009-02-20  6:11             ` Junio C Hamano
@ 2009-02-20  9:41             ` Miklos Vajna
  1 sibling, 0 replies; 35+ messages in thread
From: Miklos Vajna @ 2009-02-20  9:41 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, John Tapsell, Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 730 bytes --]

On Thu, Feb 19, 2009 at 10:02:45PM -0500, Jeff King <peff@peff.net> wrote:
> 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.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")
  2009-02-20  6:11             ` Junio C Hamano
@ 2009-03-22 11:36               ` Miklos Vajna
  2009-03-22 21:58                 ` Junio C Hamano
  0 siblings, 1 reply; 35+ messages in thread
From: Miklos Vajna @ 2009-03-22 11:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 680 bytes --]

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?

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/8] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")
  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
  0 siblings, 1 reply; 35+ messages in thread
From: Junio C Hamano @ 2009-03-22 21:58 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Jeff King, John Tapsell, Git Mailing List

Miklos Vajna <vmiklos@frugalware.org> writes:

> 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.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 0/9] fprintf(stderr, "warning: ") -> warning() patches
  2009-03-22 21:58                 ` Junio C Hamano
@ 2009-03-24  1:09                   ` Miklos Vajna
  2009-03-24  1:09                     ` [PATCH 1/9] http-push: using error() and warning() as appropriate Miklos Vajna
  2009-03-24  7:35                     ` [PATCH 0/9] fprintf(stderr, "warning: ") -> warning() patches Jeff King
  0 siblings, 2 replies; 35+ messages in thread
From: Miklos Vajna @ 2009-03-24  1:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

On Sun, Mar 22, 2009 at 02:58:46PM -0700, Junio C Hamano <gitster@pobox.com> wrote:
> > Should I rebase the series against current master and resend?
>
> Yes, please, if the overlap with "diff master next" is small enough.

Okay, here it is, applies on top of master. All, except the http-push
one, applies cleanly on top of next as well here.

Miklos Vajna (9):
  http-push: using error() and warning() as appropriate
  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 +-
 http-push.c           |    6 +++---
 refs.c                |    8 +++-----
 9 files changed, 22 insertions(+), 28 deletions(-)

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 1/9] http-push: using error() and warning() as appropriate
  2009-03-24  1:09                   ` [PATCH 0/9] fprintf(stderr, "warning: ") -> warning() patches Miklos Vajna
@ 2009-03-24  1:09                     ` Miklos Vajna
  2009-03-24  1:09                       ` [PATCH 2/9] builtin-apply: use warning() instead of fprintf(stderr, "warning: ") Miklos Vajna
  2009-03-24  7:35                     ` [PATCH 0/9] fprintf(stderr, "warning: ") -> warning() patches Jeff King
  1 sibling, 1 reply; 35+ messages in thread
From: Miklos Vajna @ 2009-03-24  1:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Change three occurences of using inconsistent error/warning reporting by
using the relevant error() / warning() calls to be consitent with the
rest of the code.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 http-push.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/http-push.c b/http-push.c
index 48e5f38..e6bd01a 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 {
@@ -2225,7 +2225,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.2

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 2/9] builtin-apply: use warning() instead of fprintf(stderr, "warning: ")
  2009-03-24  1:09                     ` [PATCH 1/9] http-push: using error() and warning() as appropriate Miklos Vajna
@ 2009-03-24  1:09                       ` Miklos Vajna
  2009-03-24  1:09                         ` [PATCH 3/9] builtin-checkout: " Miklos Vajna
  2009-03-24  1:25                         ` [PATCH 2/9] builtin-apply: " Erik Faye-Lund
  0 siblings, 2 replies; 35+ messages in thread
From: Miklos Vajna @ 2009-03-24  1:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-apply.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index b52aa20..1926cd8 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.2

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 3/9] builtin-checkout: use warning() instead of fprintf(stderr, "warning: ")
  2009-03-24  1:09                       ` [PATCH 2/9] builtin-apply: use warning() instead of fprintf(stderr, "warning: ") Miklos Vajna
@ 2009-03-24  1:09                         ` Miklos Vajna
  2009-03-24  1:09                           ` [PATCH 4/9] builtin-fetch-pack: " Miklos Vajna
  2009-03-24  1:25                         ` [PATCH 2/9] builtin-apply: " Erik Faye-Lund
  1 sibling, 1 reply; 35+ messages in thread
From: Miklos Vajna @ 2009-03-24  1:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-checkout.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin-checkout.c b/builtin-checkout.c
index 9fdfc58..fc55bbe 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -558,8 +558,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.2

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 4/9] builtin-fetch-pack: use warning() instead of fprintf(stderr, "warning: ")
  2009-03-24  1:09                         ` [PATCH 3/9] builtin-checkout: " Miklos Vajna
@ 2009-03-24  1:09                           ` Miklos Vajna
  2009-03-24  1:09                             ` [PATCH 5/9] builtin-init-db: " Miklos Vajna
  0 siblings, 1 reply; 35+ messages in thread
From: Miklos Vajna @ 2009-03-24  1:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

---
 builtin-fetch-pack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index d571253..5d134be 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -605,7 +605,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.2

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 5/9] builtin-init-db: use warning() instead of fprintf(stderr, "warning: ")
  2009-03-24  1:09                           ` [PATCH 4/9] builtin-fetch-pack: " Miklos Vajna
@ 2009-03-24  1:09                             ` Miklos Vajna
  2009-03-24  1:09                               ` [PATCH 6/9] builtin-rm: " Miklos Vajna
  0 siblings, 1 reply; 35+ messages in thread
From: Miklos Vajna @ 2009-03-24  1:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

---
 builtin-init-db.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

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.2

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 6/9] builtin-rm: use warning() instead of fprintf(stderr, "warning: ")
  2009-03-24  1:09                             ` [PATCH 5/9] builtin-init-db: " Miklos Vajna
@ 2009-03-24  1:09                               ` Miklos Vajna
  2009-03-24  1:09                                 ` [PATCH 7/9] builtin-show-branch: " Miklos Vajna
  0 siblings, 1 reply; 35+ messages in thread
From: Miklos Vajna @ 2009-03-24  1:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-rm.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

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.2

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 7/9] builtin-show-branch: use warning() instead of fprintf(stderr, "warning: ")
  2009-03-24  1:09                               ` [PATCH 6/9] builtin-rm: " Miklos Vajna
@ 2009-03-24  1:09                                 ` Miklos Vajna
  2009-03-24  1:09                                   ` [PATCH 8/9] builtin-show-ref: " Miklos Vajna
  0 siblings, 1 reply; 35+ messages in thread
From: Miklos Vajna @ 2009-03-24  1:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-show-branch.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

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.2

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 8/9] builtin-show-ref: use warning() instead of fprintf(stderr, "warning: ")
  2009-03-24  1:09                                 ` [PATCH 7/9] builtin-show-branch: " Miklos Vajna
@ 2009-03-24  1:09                                   ` Miklos Vajna
  2009-03-24  1:09                                     ` [PATCH 9/9] refs: " Miklos Vajna
  0 siblings, 1 reply; 35+ messages in thread
From: Miklos Vajna @ 2009-03-24  1:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 builtin-show-ref.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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.2

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 9/9] refs: use warning() instead of fprintf(stderr, "warning: ")
  2009-03-24  1:09                                   ` [PATCH 8/9] builtin-show-ref: " Miklos Vajna
@ 2009-03-24  1:09                                     ` Miklos Vajna
  2009-03-24  1:17                                       ` Erik Faye-Lund
  0 siblings, 1 reply; 35+ messages in thread
From: Miklos Vajna @ 2009-03-24  1:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, John Tapsell, Git Mailing List

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 refs.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/refs.c b/refs.c
index 8d3c502..aeef257 100644
--- a/refs.c
+++ b/refs.c
@@ -996,7 +996,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);
@@ -1438,8 +1438,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));
 				}
 			}
@@ -1451,8 +1450,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.2

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH 9/9] refs: use warning() instead of fprintf(stderr,  "warning: ")
  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
  0 siblings, 1 reply; 35+ messages in thread
From: Erik Faye-Lund @ 2009-03-24  1:17 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Junio C Hamano, Jeff King, John Tapsell, Git Mailing List

> @@ -996,7 +996,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",

Doesn't this add a newline? The original string doesn't have a '\n' at
the end of the format-field, but AFAIK warning() terminates with one.
I'm not saying it's a problem, I'm just pointing it out.

-- 
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 9/9] refs: use warning() instead of fprintf(stderr, "warning: ")
  2009-03-24  1:17                                       ` Erik Faye-Lund
@ 2009-03-24  1:23                                         ` Miklos Vajna
  2009-03-24  1:28                                           ` Erik Faye-Lund
  0 siblings, 1 reply; 35+ messages in thread
From: Miklos Vajna @ 2009-03-24  1:23 UTC (permalink / raw)
  To: Erik Faye-Lund; +Cc: Junio C Hamano, Jeff King, John Tapsell, Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

On Tue, Mar 24, 2009 at 02:17:24AM +0100, Erik Faye-Lund <kusmabite@googlemail.com> wrote:
> > @@ -996,7 +996,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",
> 
> Doesn't this add a newline? The original string doesn't have a '\n' at
> the end of the format-field, but AFAIK warning() terminates with one.
> I'm not saying it's a problem, I'm just pointing it out.

Yes, it adds. As Jeff pointed out earlier in this thread, the lack of
newline was a bug:

http://article.gmane.org/gmane.comp.version-control.git/110783

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 2/9] builtin-apply: use warning() instead of  fprintf(stderr, "warning: ")
  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:25                         ` Erik Faye-Lund
  1 sibling, 0 replies; 35+ messages in thread
From: Erik Faye-Lund @ 2009-03-24  1:25 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Junio C Hamano, Jeff King, John Tapsell, Git Mailing List

On Tue, Mar 24, 2009 at 2:09 AM, Miklos Vajna <vmiklos@frugalware.org> 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",

Again, doesn't this change the output?

-- 
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 9/9] refs: use warning() instead of fprintf(stderr,  "warning: ")
  2009-03-24  1:23                                         ` Miklos Vajna
@ 2009-03-24  1:28                                           ` Erik Faye-Lund
  0 siblings, 0 replies; 35+ messages in thread
From: Erik Faye-Lund @ 2009-03-24  1:28 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Junio C Hamano, Jeff King, John Tapsell, Git Mailing List

OK, sorry for not reading the old discussion before commenting. :)

On Tue, Mar 24, 2009 at 2:23 AM, Miklos Vajna <vmiklos@frugalware.org> wrote:
> On Tue, Mar 24, 2009 at 02:17:24AM +0100, Erik Faye-Lund <kusmabite@googlemail.com> wrote:
>> > @@ -996,7 +996,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",
>>
>> Doesn't this add a newline? The original string doesn't have a '\n' at
>> the end of the format-field, but AFAIK warning() terminates with one.
>> I'm not saying it's a problem, I'm just pointing it out.
>
> Yes, it adds. As Jeff pointed out earlier in this thread, the lack of
> newline was a bug:
>
> http://article.gmane.org/gmane.comp.version-control.git/110783
>



-- 
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 0/9] fprintf(stderr, "warning: ") -> warning() patches
  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  7:35                     ` Jeff King
  2009-03-24  8:01                       ` Junio C Hamano
  1 sibling, 1 reply; 35+ messages in thread
From: Jeff King @ 2009-03-24  7:35 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Junio C Hamano, John Tapsell, Git Mailing List

On Tue, Mar 24, 2009 at 02:09:08AM +0100, Miklos Vajna wrote:

> Okay, here it is, applies on top of master. All, except the http-push
> one, applies cleanly on top of next as well here.

I manually scanned the patches and they all look sane to me.
Thanks.

-Peff

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 0/9] fprintf(stderr, "warning: ") -> warning() patches
  2009-03-24  7:35                     ` [PATCH 0/9] fprintf(stderr, "warning: ") -> warning() patches Jeff King
@ 2009-03-24  8:01                       ` Junio C Hamano
  0 siblings, 0 replies; 35+ messages in thread
From: Junio C Hamano @ 2009-03-24  8:01 UTC (permalink / raw)
  To: Jeff King; +Cc: Miklos Vajna, John Tapsell, Git Mailing List

Jeff King <peff@peff.net> writes:

> On Tue, Mar 24, 2009 at 02:09:08AM +0100, Miklos Vajna wrote:
>
>> Okay, here it is, applies on top of master. All, except the http-push
>> one, applies cleanly on top of next as well here.
>
> I manually scanned the patches and they all look sane to me.
> Thanks.

Thanks; I've done the same and three sets of eyeballs give me a warm fuzzy
feeling ;-)

Applied.

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2009-03-24  8:03 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.