cat-file --batch: flush stdout also when objects are missing
authorLea Wiemann <lewiemann@gmail.com>
Tue, 3 Jun 2008 18:34:17 +0000 (20:34 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 3 Jun 2008 19:40:12 +0000 (12:40 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-cat-file.c
index 200345e7fbd54d86fb1e4db228244b7a7a221562..f8b3160668e1eeff3ef9a893459c64992aa53b5b 100644 (file)
@@ -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;
        }