convert: convert convert_to_git_filter_fd to take an index
Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams committed
Jun 12, 2017 at 15:13 UTC
d6c41c20e688a1b284b92d92320ba56f639688de
3 files changed
+6
-4
convert.c
+3
-2
@@ -1108,7 +1108,8 @@ int convert_to_git(const char *path, const char *src, size_t len,
1108
return ret | ident_to_git(path, src, len, dst, ca.ident);
1109
}
1110
1111
-void convert_to_git_filter_fd(const char *path, int fd, struct strbuf *dst,
1111
+void convert_to_git_filter_fd(const struct index_state *istate,
1112
+ const char *path, int fd, struct strbuf *dst,
1113
enum safe_crlf checksafe)
1114
{
1115
struct conv_attrs ca;
@@ -1120,7 +1121,7 @@ void convert_to_git_filter_fd(const char *path, int fd, struct strbuf *dst,
1121
if (!apply_filter(path, NULL, 0, fd, dst, ca.drv, CAP_CLEAN))
1122
die("%s: clean filter '%s' failed", path, ca.drv->name);
1123
1123
- crlf_to_git(&the_index, path, dst->buf, dst->len, dst, ca.crlf_action, checksafe);
1124
+ crlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, checksafe);
1125
ident_to_git(path, dst->buf, dst->len, dst, ca.ident);
1126
}
1127
convert.h
+2
-1
@@ -52,7 +52,8 @@ static inline int would_convert_to_git(const char *path)
52
return convert_to_git(path, NULL, 0, NULL, 0);
53
}
54
/* Precondition: would_convert_to_git_filter_fd(path) == true */
55
-extern void convert_to_git_filter_fd(const char *path, int fd,
55
+extern void convert_to_git_filter_fd(const struct index_state *istate,
56
+ const char *path, int fd,
57
struct strbuf *dst,
58
enum safe_crlf checksafe);
59
extern int would_convert_to_git_filter_fd(const char *path);
sha1_file.c
+1
-1
@@ -3580,7 +3580,7 @@ static int index_stream_convert_blob(unsigned char *sha1, int fd,
3580
assert(path);
3581
assert(would_convert_to_git_filter_fd(path));
3582
3583
- convert_to_git_filter_fd(path, fd, &sbuf,
3583
+ convert_to_git_filter_fd(&the_index, path, fd, &sbuf,
3584
write_object ? safe_crlf : SAFE_CRLF_FALSE);
3585
3586
if (write_object)