streaming_write_entry(): use streaming API in write_entry()
[git.git] / convert.c
index efc7e07d475c66f7835dc6cbbd3bc358f01c41c3..d3c0041820b8734c56e17b01b51a695142ec2055 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -813,3 +813,26 @@ int renormalize_buffer(const char *path, const char *src, size_t len, struct str
        }
        return ret | convert_to_git(path, src, len, dst, 0);
 }
+
+/*
+ * You would be crazy to set CRLF, smuge/clean or ident to
+ * a large binary blob you would want us not to slurp into
+ * the memory!
+ */
+int can_bypass_conversion(const char *path)
+{
+       struct conv_attrs ca;
+       enum crlf_action crlf_action;
+
+       convert_attrs(&ca, path);
+
+       if (ca.ident ||
+           (ca.drv && (ca.drv->smudge || ca.drv->clean)))
+               return 0;
+
+       crlf_action = input_crlf_action(ca.crlf_action, ca.eol_attr);
+       if ((crlf_action == CRLF_BINARY) ||
+           (crlf_action == CRLF_GUESS && auto_crlf == AUTO_CRLF_FALSE))
+               return 1;
+       return 0;
+}