{"thread":{"id":"10471","subject":"[PATCH] git-fetch: print informative messages to stdout, not stderr","startedAt":"2007-10-26T08:53:55Z","lastAt":"2007-10-26T21:01:15Z","messageCount":2,"participants":["Gerrit Pape","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"57267","messageId":"20071026085355.24930.qmail@2c06371a7c3ae6.315fe32.mid.smarden.org","threadId":"10471","inReplyTo":null,"subject":"[PATCH] git-fetch: print informative messages to stdout, not stderr","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2007-10-26T08:53:55Z","receivedAt":"2007-10-26T08:53:55Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"git-fetch writes informations about storing tags and the like to stderr,\nwhich should only be used for errors.  This patch changes it to use\nstdout instead.\n\nThis was noticed by Joey Hess and asked for through\n http://bugs.debian.org/447395\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\n---\n builtin-fetch.c |   32 ++++++++++++--------------------\n 1 files changed, 12 insertions(+), 20 deletions(-)\n\ndiff --git a/builtin-fetch.c b/builtin-fetch.c\nindex b9d2b0c..2dbfcb6 100644\n--- a/builtin-fetch.c\n+++ b/builtin-fetch.c\n@@ -125,7 +125,7 @@ static struct ref *get_ref_map(struct transport *transport,\n \n static void show_new(enum object_type type, unsigned char *sha1_new)\n {\n-\tfprintf(stderr, \"  %s: %s\\n\", typename(type),\n+\tprintf(\"  %s: %s\\n\", typename(type),\n \t\tfind_unique_abbrev(sha1_new, DEFAULT_ABBREV));\n }\n \n@@ -165,7 +165,7 @@ static int update_local_ref(struct ref *ref,\n \tif (!*ref->name) {\n \t\t/* Not storing */\n \t\tif (verbose) {\n-\t\t\tfprintf(stderr, \"* fetched %s\\n\", note);\n+\t\t\tprintf(\"* fetched %s\\n\", note);\n \t\t\tshow_new(type, ref->new_sha1);\n \t\t}\n \t\treturn 0;\n@@ -173,8 +173,7 @@ static int update_local_ref(struct ref *ref,\n \n \tif (!hashcmp(ref->old_sha1, ref->new_sha1)) {\n \t\tif (verbose) {\n-\t\t\tfprintf(stderr, \"* %s: same as %s\\n\",\n-\t\t\t\tref->name, note);\n+\t\t\tprintf(\"* %s: same as %s\\n\", ref->name, note);\n \t\t\tshow_new(type, ref->new_sha1);\n \t\t}\n \t\treturn 0;\n@@ -196,8 +195,7 @@ static int update_local_ref(struct ref *ref,\n \n \tif (!is_null_sha1(ref->old_sha1) &&\n \t    !prefixcmp(ref->name, \"refs/tags/\")) {\n-\t\tfprintf(stderr, \"* %s: updating with %s\\n\",\n-\t\t\tref->name, note);\n+\t\tprintf(\"* %s: updating with %s\\n\", ref->name, note);\n \t\tshow_new(type, ref->new_sha1);\n \t\treturn s_update_ref(\"updating tag\", ref, 0);\n \t}\n@@ -210,8 +208,7 @@ static int update_local_ref(struct ref *ref,\n \t\t\tmsg = \"storing tag\";\n \t\telse\n \t\t\tmsg = \"storing head\";\n-\t\tfprintf(stderr, \"* %s: storing %s\\n\",\n-\t\t\tref->name, note);\n+\t\tprintf(\"* %s: storing %s\\n\", ref->name, note);\n \t\tshow_new(type, ref->new_sha1);\n \t\treturn s_update_ref(msg, ref, 0);\n \t}\n@@ -220,23 +217,19 @@ static int update_local_ref(struct ref *ref,\n \tstrcpy(newh, find_unique_abbrev(ref->new_sha1, DEFAULT_ABBREV));\n \n \tif (in_merge_bases(current, &updated, 1)) {\n-\t\tfprintf(stderr, \"* %s: fast forward to %s\\n\",\n-\t\t\tref->name, note);\n-\t\tfprintf(stderr, \"  old..new: %s..%s\\n\", oldh, newh);\n+\t\tprintf(\"* %s: fast forward to %s\\n\", ref->name, note);\n+\t\tprintf(\"  old..new: %s..%s\\n\", oldh, newh);\n \t\treturn s_update_ref(\"fast forward\", ref, 1);\n \t}\n \tif (!force && !ref->force) {\n-\t\tfprintf(stderr,\n-\t\t\t\"* %s: not updating to non-fast forward %s\\n\",\n+\t\tprintf(\"* %s: not updating to non-fast forward %s\\n\",\n \t\t\tref->name, note);\n-\t\tfprintf(stderr,\n-\t\t\t\"  old...new: %s...%s\\n\", oldh, newh);\n+\t\tprintf(\"  old...new: %s...%s\\n\", oldh, newh);\n \t\treturn 1;\n \t}\n-\tfprintf(stderr,\n-\t\t\"* %s: forcing update to non-fast forward %s\\n\",\n+\tprintf(\"* %s: forcing update to non-fast forward %s\\n\",\n \t\tref->name, note);\n-\tfprintf(stderr, \"  old...new: %s...%s\\n\", oldh, newh);\n+\tprintf(\"  old...new: %s...%s\\n\", oldh, newh);\n \treturn s_update_ref(\"forced-update\", ref, 1);\n }\n \n@@ -368,8 +361,7 @@ static struct ref *find_non_local_tags(struct transport *transport,\n \t\tif (!path_list_has_path(&existing_refs, ref_name) &&\n \t\t    !path_list_has_path(&new_refs, ref_name) &&\n \t\t    lookup_object(ref->old_sha1)) {\n-\t\t\tfprintf(stderr, \"Auto-following %s\\n\",\n-\t\t\t\tref_name);\n+\t\t\tprintf(\"Auto-following %s\\n\", ref_name);\n \n \t\t\tpath_list_insert(ref_name, &new_refs);\n \n-- \n1.5.3.4\n"},{"id":"57308","messageId":"7vr6jhwpyc.fsf@gitster.siamese.dyndns.org","threadId":"10471","inReplyTo":"20071026085355.24930.qmail@2c06371a7c3ae6.315fe32.mid.smarden.org","subject":"Re: [PATCH] git-fetch: print informative messages to stdout, not stderr","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-10-26T21:01:15Z","receivedAt":"2007-10-26T21:01:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Gerrit Pape <pape@smarden.org> writes:\n\n> git-fetch writes informations about storing tags and the like to stderr,\n> which should only be used for errors.  This patch changes it to use\n> stdout instead.\n\nI do not have strong preference but the reason this goes to\nstderr is because it is considered part of the progress\nreporting.  It is not designed for consumption by scripted\ncallers, and its formatting is subject to change freely, which\nis what allows the recent \"terse fetch\" discussion.\n"}]}