convert: convert convert_to_git_filter_fd to take an index
authorBrandon Williams <bmwill@google.com>
Mon, 12 Jun 2017 22:13:54 +0000 (15:13 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Jun 2017 18:40:51 +0000 (11:40 -0700)
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
convert.c
convert.h
sha1_file.c
index 0cafb06f56baa893a969e4075655e3750e2bf5ee..c09242cec0b1327c307b1b5a28f43f78c8e7886d 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -1108,7 +1108,8 @@ int convert_to_git(const char *path, const char *src, size_t len,
        return ret | ident_to_git(path, src, len, dst, ca.ident);
 }
 
-void convert_to_git_filter_fd(const char *path, int fd, struct strbuf *dst,
+void convert_to_git_filter_fd(const struct index_state *istate,
+                             const char *path, int fd, struct strbuf *dst,
                              enum safe_crlf checksafe)
 {
        struct conv_attrs ca;
@@ -1120,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(&the_index, path, dst->buf, dst->len, dst, ca.crlf_action, checksafe);
+       crlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, checksafe);
        ident_to_git(path, dst->buf, dst->len, dst, ca.ident);
 }
 
index 667b7dfe075d37dbb127fdfbab2f57a70d60e7d4..3a813a79762e086260e00c1d6febe2b94f542032 100644 (file)
--- a/convert.h
+++ b/convert.h
@@ -52,7 +52,8 @@ static inline int would_convert_to_git(const char *path)
        return convert_to_git(path, NULL, 0, NULL, 0);
 }
 /* Precondition: would_convert_to_git_filter_fd(path) == true */
-extern void convert_to_git_filter_fd(const char *path, int fd,
+extern void convert_to_git_filter_fd(const struct index_state *istate,
+                                    const char *path, int fd,
                                     struct strbuf *dst,
                                     enum safe_crlf checksafe);
 extern int would_convert_to_git_filter_fd(const char *path);
index 59a4ed2ed32336b41ab8f3b1d4aca30f045aa084..ab09241d208a6cdab74aa014a0987824adcb0d41 100644 (file)
@@ -3580,7 +3580,7 @@ static int index_stream_convert_blob(unsigned char *sha1, int fd,
        assert(path);
        assert(would_convert_to_git_filter_fd(path));
 
-       convert_to_git_filter_fd(path, fd, &sbuf,
+       convert_to_git_filter_fd(&the_index, path, fd, &sbuf,
                                 write_object ? safe_crlf : SAFE_CRLF_FALSE);
 
        if (write_object)