aboutsummaryrefslogtreecommitdiff
path: root/convert.c
diff options
context:
space:
mode:
Diffstat (limited to 'convert.c')
-rw-r--r--convert.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/convert.c b/convert.c
index efc7e07d4..d3c004182 100644
--- 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;
+}