Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
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 efc7e07d47..d3c0041820 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;
+}