Merge branch 'js/color-on-windows-comment' into maint
[gitweb.git] / builtin / cat-file.c
index 144ae18127de2cdbc8d4ce3f11d471b6c8e21621..618103fdeeb7f7b35911ebd12d0d811cc4a5297a 100644 (file)
@@ -416,7 +416,7 @@ static int batch_objects(struct batch_options *opt)
        save_warning = warn_on_object_refname_ambiguity;
        warn_on_object_refname_ambiguity = 0;
 
-       while (strbuf_getline(&buf, stdin, '\n') != EOF) {
+       while (strbuf_getline(&buf, stdin) != EOF) {
                if (data.split_on_whitespace) {
                        /*
                         * Split at first whitespace, tying off the beginning
@@ -504,6 +504,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
 
        git_config(git_cat_file_config, NULL);
 
+       batch.buffer_output = -1;
        argc = parse_options(argc, argv, prefix, options, cat_file_usage, 0);
 
        if (opt) {
@@ -527,6 +528,9 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
                usage_with_options(cat_file_usage, options);
        }
 
+       if (batch.buffer_output < 0)
+               batch.buffer_output = batch.all_objects;
+
        if (batch.enabled)
                return batch_objects(&batch);