* [PATCH] git-fetch: print informative messages to stdout, not stderr
@ 2007-10-26 8:53 Gerrit Pape
2007-10-26 21:01 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Gerrit Pape @ 2007-10-26 8:53 UTC (permalink / raw)
To: git, Junio C Hamano
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@smarden.org>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] git-fetch: print informative messages to stdout, not stderr
2007-10-26 8:53 [PATCH] git-fetch: print informative messages to stdout, not stderr Gerrit Pape
@ 2007-10-26 21:01 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2007-10-26 21:01 UTC (permalink / raw)
To: Gerrit Pape; +Cc: git
Gerrit Pape <pape@smarden.org> writes:
> 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.
I do not have strong preference but the reason this goes to
stderr is because it is considered part of the progress
reporting. It is not designed for consumption by scripted
callers, and its formatting is subject to change freely, which
is what allows the recent "terse fetch" discussion.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-26 21:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-26 8:53 [PATCH] git-fetch: print informative messages to stdout, not stderr Gerrit Pape
2007-10-26 21:01 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).