git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cat-file --batch: flush stdout also when objects are missing
@ 2008-06-03 18:34 Lea Wiemann
  2008-06-03 19:40 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Lea Wiemann @ 2008-06-03 18:34 UTC (permalink / raw)
  To: git; +Cc: Lea Wiemann

cat-file --batch/--batch-check only flushes stdout when the object
exists, but not when it doesn't ("<object> missing").  This makes
bidirectional pipes hang.

Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
---
 builtin-cat-file.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/builtin-cat-file.c b/builtin-cat-file.c
index 200345e..f8b3160 100644
--- a/builtin-cat-file.c
+++ b/builtin-cat-file.c
@@ -159,6 +159,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
 
 	if (get_sha1(obj_name, sha1)) {
 		printf("%s missing\n", obj_name);
+		fflush(stdout);
 		return 0;
 	}
 
-- 
1.5.6.rc0.92.g27fd.dirty

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

* Re: [PATCH] cat-file --batch: flush stdout also when objects are missing
  2008-06-03 18:34 [PATCH] cat-file --batch: flush stdout also when objects are missing Lea Wiemann
@ 2008-06-03 19:40 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2008-06-03 19:40 UTC (permalink / raw)
  To: Lea Wiemann; +Cc: git, Adam Roben

Lea Wiemann <lewiemann@gmail.com> writes:

> cat-file --batch/--batch-check only flushes stdout when the object
> exists, but not when it doesn't ("<object> missing").  This makes
> bidirectional pipes hang.
>
> Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
> ---
>  builtin-cat-file.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/builtin-cat-file.c b/builtin-cat-file.c
> index 200345e..f8b3160 100644
> --- a/builtin-cat-file.c
> +++ b/builtin-cat-file.c
> @@ -159,6 +159,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
>  
>  	if (get_sha1(obj_name, sha1)) {
>  		printf("%s missing\n", obj_name);
> +		fflush(stdout);
>  		return 0;
>  	}
>  
> -- 
> 1.5.6.rc0.92.g27fd.dirty

Ah, good catch.

Thanks.

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

end of thread, other threads:[~2008-06-03 19:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-03 18:34 [PATCH] cat-file --batch: flush stdout also when objects are missing Lea Wiemann
2008-06-03 19:40 ` 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).