Signed-off-by: Brandon Williams <[email protected]>
---
convert.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/convert.c b/convert.c
index 574003023..ff3e72657 100644
--- a/convert.c
+++ b/convert.c
@@ -219,13 +219,13 @@ static void check_safe_crlf(const char *path, enum
crlf_action crlf_action,
}
}
-static int has_cr_in_index(const char *path)
+static int has_cr_in_index(const struct index_state *istate, const char *path)
{
unsigned long sz;
void *data;
int has_cr;
- data = read_blob_data_from_cache(path, &sz);
+ data = read_blob_data_from_index(istate, path, &sz);
if (!data)
return 0;
has_cr = memchr(data, '\r', sz) != NULL;
@@ -255,7 +255,8 @@ static int will_convert_lf_to_crlf(size_t len, struct
text_stat *stats,
}
-static int crlf_to_git(const char *path, const char *src, size_t len,
+static int crlf_to_git(const struct index_state *istate,
+ const char *path, const char *src, size_t len,
struct strbuf *buf,
enum crlf_action crlf_action, enum safe_crlf checksafe)
{
@@ -287,7 +288,8 @@ static int crlf_to_git(const char *path, const char *src,
size_t len,
* unless we want to renormalize in a merge or
* cherry-pick.
*/
- if ((checksafe != SAFE_CRLF_RENORMALIZE) &&
has_cr_in_index(path))
+ if ((checksafe != SAFE_CRLF_RENORMALIZE) &&
+ has_cr_in_index(istate, path))
convert_crlf_into_lf = 0;
}
if ((checksafe == SAFE_CRLF_WARN ||
@@ -1099,7 +1101,7 @@ int convert_to_git(const char *path, const char *src,
size_t len,
src = dst->buf;
len = dst->len;
}
- ret |= crlf_to_git(path, src, len, dst, ca.crlf_action, checksafe);
+ ret |= crlf_to_git(&the_index, path, src, len, dst, ca.crlf_action,
checksafe);
if (ret && dst) {
src = dst->buf;
len = dst->len;
@@ -1119,7 +1121,7 @@ void convert_to_git_filter_fd(const char *path, int fd,
struct strbuf *dst,
if (!apply_filter(path, NULL, 0, fd, dst, ca.drv, CAP_CLEAN))
die("%s: clean filter '%s' failed", path, ca.drv->name);
- crlf_to_git(path, dst->buf, dst->len, dst, ca.crlf_action, checksafe);
+ crlf_to_git(&the_index, path, dst->buf, dst->len, dst, ca.crlf_action,
checksafe);
ident_to_git(path, dst->buf, dst->len, dst, ca.ident);
}
--
2.13.1.508.gb3defc5cc-goog