]> git.ipfire.org Git - thirdparty/git.git/blobdiff - convert.c
ci: fix GCC install in the Travis CI GCC OSX job
[thirdparty/git.git] / convert.c
index 8646ee46a3574eca12d624984f65deea15e2a76d..25ac525d5fa5ea5ac68f8a7a998fe2359b515530 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -8,6 +8,7 @@
 #include "pkt-line.h"
 #include "sub-process.h"
 #include "utf8.h"
+#include "ll-merge.h"
 
 /*
  * convert.c - convert a file when checking it out and checking it in.
@@ -731,7 +732,7 @@ static int apply_single_file_filter(const char *path, const char *src, size_t le
        if (start_async(&async))
                return 0;       /* error was already reported */
 
-       if (strbuf_read(&nbuf, async.out, len) < 0) {
+       if (strbuf_read(&nbuf, async.out, 0) < 0) {
                err = error(_("read from external filter '%s' failed"), cmd);
        }
        if (close(async.out)) {
@@ -1293,10 +1294,11 @@ struct conv_attrs {
        const char *working_tree_encoding; /* Supported encoding or default encoding if NULL */
 };
 
+static struct attr_check *check;
+
 static void convert_attrs(const struct index_state *istate,
                          struct conv_attrs *ca, const char *path)
 {
-       static struct attr_check *check;
        struct attr_check_item *ccheck = NULL;
 
        if (!check) {
@@ -1339,6 +1341,23 @@ static void convert_attrs(const struct index_state *istate,
                ca->crlf_action = CRLF_AUTO_INPUT;
 }
 
+void reset_parsed_attributes(void)
+{
+       struct convert_driver *drv, *next;
+
+       attr_check_free(check);
+       check = NULL;
+       reset_merge_attributes();
+
+       for (drv = user_convert; drv; drv = next) {
+               next = drv->next;
+               free((void *)drv->name);
+               free(drv);
+       }
+       user_convert = NULL;
+       user_convert_tail = NULL;
+}
+
 int would_convert_to_git_filter_fd(const struct index_state *istate, const char *path)
 {
        struct conv_attrs ca;