[PATCH] git-fetch: print informative messages to stdout, not stderr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



git-fetch writes informations about storing tags and the like to stderr,
which should only be used for errors.  This patch changes it to use
stdout instead.

This was noticed by Joey Hess and asked for through
 http://bugs.debian.org/447395

Signed-off-by: Gerrit Pape <pape@xxxxxxxxxxx>
---
 builtin-fetch.c |   32 ++++++++++++--------------------
 1 files changed, 12 insertions(+), 20 deletions(-)

diff --git a/builtin-fetch.c b/builtin-fetch.c
index b9d2b0c..2dbfcb6 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -125,7 +125,7 @@ static struct ref *get_ref_map(struct transport *transport,
 
 static void show_new(enum object_type type, unsigned char *sha1_new)
 {
-	fprintf(stderr, "  %s: %s\n", typename(type),
+	printf("  %s: %s\n", typename(type),
 		find_unique_abbrev(sha1_new, DEFAULT_ABBREV));
 }
 
@@ -165,7 +165,7 @@ static int update_local_ref(struct ref *ref,
 	if (!*ref->name) {
 		/* Not storing */
 		if (verbose) {
-			fprintf(stderr, "* fetched %s\n", note);
+			printf("* fetched %s\n", note);
 			show_new(type, ref->new_sha1);
 		}
 		return 0;
@@ -173,8 +173,7 @@ static int update_local_ref(struct ref *ref,
 
 	if (!hashcmp(ref->old_sha1, ref->new_sha1)) {
 		if (verbose) {
-			fprintf(stderr, "* %s: same as %s\n",
-				ref->name, note);
+			printf("* %s: same as %s\n", ref->name, note);
 			show_new(type, ref->new_sha1);
 		}
 		return 0;
@@ -196,8 +195,7 @@ static int update_local_ref(struct ref *ref,
 
 	if (!is_null_sha1(ref->old_sha1) &&
 	    !prefixcmp(ref->name, "refs/tags/")) {
-		fprintf(stderr, "* %s: updating with %s\n",
-			ref->name, note);
+		printf("* %s: updating with %s\n", ref->name, note);
 		show_new(type, ref->new_sha1);
 		return s_update_ref("updating tag", ref, 0);
 	}
@@ -210,8 +208,7 @@ static int update_local_ref(struct ref *ref,
 			msg = "storing tag";
 		else
 			msg = "storing head";
-		fprintf(stderr, "* %s: storing %s\n",
-			ref->name, note);
+		printf("* %s: storing %s\n", ref->name, note);
 		show_new(type, ref->new_sha1);
 		return s_update_ref(msg, ref, 0);
 	}
@@ -220,23 +217,19 @@ static int update_local_ref(struct ref *ref,
 	strcpy(newh, find_unique_abbrev(ref->new_sha1, DEFAULT_ABBREV));
 
 	if (in_merge_bases(current, &updated, 1)) {
-		fprintf(stderr, "* %s: fast forward to %s\n",
-			ref->name, note);
-		fprintf(stderr, "  old..new: %s..%s\n", oldh, newh);
+		printf("* %s: fast forward to %s\n", ref->name, note);
+		printf("  old..new: %s..%s\n", oldh, newh);
 		return s_update_ref("fast forward", ref, 1);
 	}
 	if (!force && !ref->force) {
-		fprintf(stderr,
-			"* %s: not updating to non-fast forward %s\n",
+		printf("* %s: not updating to non-fast forward %s\n",
 			ref->name, note);
-		fprintf(stderr,
-			"  old...new: %s...%s\n", oldh, newh);
+		printf("  old...new: %s...%s\n", oldh, newh);
 		return 1;
 	}
-	fprintf(stderr,
-		"* %s: forcing update to non-fast forward %s\n",
+	printf("* %s: forcing update to non-fast forward %s\n",
 		ref->name, note);
-	fprintf(stderr, "  old...new: %s...%s\n", oldh, newh);
+	printf("  old...new: %s...%s\n", oldh, newh);
 	return s_update_ref("forced-update", ref, 1);
 }
 
@@ -368,8 +361,7 @@ static struct ref *find_non_local_tags(struct transport *transport,
 		if (!path_list_has_path(&existing_refs, ref_name) &&
 		    !path_list_has_path(&new_refs, ref_name) &&
 		    lookup_object(ref->old_sha1)) {
-			fprintf(stderr, "Auto-following %s\n",
-				ref_name);
+			printf("Auto-following %s\n", ref_name);
 
 			path_list_insert(ref_name, &new_refs);
 
-- 
1.5.3.4

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux