git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Mar 24, 2009, 01:09 UTC
Message-ID
<f6b2ede9af2bd40ce89f0251b32861098af46aad.1237856682.git.vmiklos@frugalware.org>
In-Reply-To
<607f1ab07464931305b62599805f898e2bf2ca98.1237856682.git.vmiklos@frugalware.org>
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
Previous: Miklos VajnaNext: Erik Faye-Lund
Message 10 of 16 in “fprintf(stderr, "warning: ") -> warning() patches”
  1. 0/9 fprintf(stderr, "warning: ") -> warning() patchesMiklos Vajna, Mar 24, 2009
  2. 1/9 http-push: using error() and warning() as appropriateMiklos Vajna, Mar 24, 2009
  3. 2/9 builtin-apply: use warning() instead of fprintf(stderr, "warning: ")Miklos Vajna, Mar 24, 2009
  4. 3/9 builtin-checkout: use warning() instead of fprintf(stderr, "warning: ")Miklos Vajna, Mar 24, 2009
  5. 4/9 builtin-fetch-pack: use warning() instead of fprintf(stderr, "warning: ")Miklos Vajna, Mar 24, 2009
  6. 5/9 builtin-init-db: use warning() instead of fprintf(stderr, "warning: ")Miklos Vajna, Mar 24, 2009
  7. 6/9 builtin-rm: use warning() instead of fprintf(stderr, "warning: ")Miklos Vajna, Mar 24, 2009
  8. 7/9 builtin-show-branch: use warning() instead of fprintf(stderr, "warning: ")Miklos Vajna, Mar 24, 2009
  9. 8/9 builtin-show-ref: use warning() instead of fprintf(stderr, "warning: ")Miklos Vajna, Mar 24, 2009
  10. 9/9 refs: use warning() instead of fprintf(stderr, "warning: ")Miklos Vajna, Mar 24, 2009
  11. Erik Faye-LundMar 24, 2009
  12. Miklos VajnaMar 24, 2009
  13. Erik Faye-LundMar 24, 2009
  14. Erik Faye-LundMar 24, 2009
  15. Jeff KingMar 24, 2009
  16. Junio C HamanoMar 24, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.