{"thread":{"id":"47602","subject":"[PATCH] Fixed pervasive enumeration warning in convert.h.","startedAt":"2018-01-12T16:37:04Z","lastAt":"2018-01-13T22:49:56Z","messageCount":6,"participants":["randall.s.becker@rogers.com","Junio C Hamano","Randall S. Becker","René Scharfe","tboegi@web.de"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"336517","messageId":"20180112163644.14108-1-randall.s.becker@rogers.com","threadId":"47602","inReplyTo":null,"subject":"[PATCH] Fixed pervasive enumeration warning in convert.h.","fromName":"","fromEmail":"randall.s.becker@rogers.com","sentAt":"2018-01-12T16:36:44Z","receivedAt":"2018-01-12T16:37:04Z","isPatch":true,"sender":{"key":"randall.s.becker@rogers.com","avatar":null},"body":"From: \"Randall S. Becker\" <rsbecker@nexbridge.com>\n\nThe actual enum value should be used rather than 0 and was causing\na warning in an inline proc.\n\nSigned-off-by: Randall S. Becker <rsbecker@nexbridge.com>\n---\n convert.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/convert.h b/convert.h\nindex 4f2da22..a9a6658 100644\n--- a/convert.h\n+++ b/convert.h\n@@ -79,7 +79,7 @@ extern int renormalize_buffer(const struct index_state *istate,\n static inline int would_convert_to_git(const struct index_state *istate,\n \t\t\t\t       const char *path)\n {\n-\treturn convert_to_git(istate, path, NULL, 0, NULL, 0);\n+\treturn convert_to_git(istate, path, NULL, 0, NULL, SAFE_CRLF_FALSE);\n }\n /* Precondition: would_convert_to_git_filter_fd(path) == true */\n extern void convert_to_git_filter_fd(const struct index_state *istate,\n-- \n2.8.5.23.g6fa7ec3\n\n"},{"id":"336525","messageId":"xmqqh8rqx4kz.fsf@gitster.mtv.corp.google.com","threadId":"47602","inReplyTo":"20180112163644.14108-1-randall.s.becker@rogers.com","subject":"Re: [PATCH] Fixed pervasive enumeration warning in convert.h.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-01-12T19:25:00Z","receivedAt":"2018-01-12T19:25:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"randall.s.becker@rogers.com writes:\n\n> From: \"Randall S. Becker\" <rsbecker@nexbridge.com>\n>\n> The actual enum value should be used rather than 0 and was causing\n> a warning in an inline proc.\n>\n> Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>\n> ---\n>  convert.h | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/convert.h b/convert.h\n> index 4f2da22..a9a6658 100644\n> --- a/convert.h\n> +++ b/convert.h\n> @@ -79,7 +79,7 @@ extern int renormalize_buffer(const struct index_state *istate,\n>  static inline int would_convert_to_git(const struct index_state *istate,\n>  \t\t\t\t       const char *path)\n>  {\n> -\treturn convert_to_git(istate, path, NULL, 0, NULL, 0);\n> +\treturn convert_to_git(istate, path, NULL, 0, NULL, SAFE_CRLF_FALSE);\n>  }\n\nI think this is being solved a bit differently with a1fbf854\n(\"convert_to_git(): safe_crlf/checksafe becomes int conv_flags\",\n2018-01-06), and 0 becomes the right value to pass at this caller to\nsay \"I am passing none of the flag bit\".\n\nI am hoping that the series that ends at f3b11d54 (\"convert: add\nsupport for 'checkout-encoding' attribute\", 2018-01-06) will be\nrerolled and hit 'master' early in the next cycle.\n\nThanks.\n"},{"id":"336528","messageId":"004c01d38bde$f0e6bb50$d2b431f0$@nexbridge.com","threadId":"47602","inReplyTo":"xmqqh8rqx4kz.fsf@gitster.mtv.corp.google.com","subject":"RE: [PATCH] Fixed pervasive enumeration warning in convert.h.","fromName":"Randall S. Becker","fromEmail":"rsbecker@nexbridge.com","sentAt":"2018-01-12T19:52:50Z","receivedAt":"2018-01-12T19:53:05Z","isPatch":true,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"> From: Junio C Hamano [mailto:gitster@pobox.com]\nOn January 12, 2018 2:25 PM, Junio C Hamano wrote:\n> > From: \"Randall S. Becker\" <rsbecker@nexbridge.com>\n> >  {\n> > -\treturn convert_to_git(istate, path, NULL, 0, NULL, 0);\n> > +\treturn convert_to_git(istate, path, NULL, 0, NULL,\n> SAFE_CRLF_FALSE);\n> >  }\n> \n> I think this is being solved a bit differently with a1fbf854\n> (\"convert_to_git(): safe_crlf/checksafe becomes int conv_flags\", 2018-01-\n> 06), and 0 becomes the right value to pass at this caller to say \"I am passing\n> none of the flag bit\".\n> \n> I am hoping that the series that ends at f3b11d54 (\"convert: add support for\n> 'checkout-encoding' attribute\", 2018-01-06) will be rerolled and hit 'master'\n> early in the next cycle.\n\nGot it. Will revert this one on my end. On a related too many warnings subject, hashmap.h has a variable unused (void *item). Is that addressed soon? If not, I can deal with it.\n\nCheers,\nRandall\n(also, sorry about the other email address in use. It's the only way I can use send-email, fixing the annoying prior wrapping/tab/space garbage I had).\n\n"},{"id":"336560","messageId":"f139ed79-1e12-d7b6-dd24-ce77000917ec@web.de","threadId":"47602","inReplyTo":"004c01d38bde$f0e6bb50$d2b431f0$@nexbridge.com","subject":"unused variable in hashmap.h [was: Re: [PATCH] Fixed pervasive enumeration warning in convert.h.]","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2018-01-13T17:13:11Z","receivedAt":"2018-01-13T17:13:34Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 12.01.2018 um 20:52 schrieb Randall S. Becker:\n> On a related too many warnings subject, hashmap.h has a variable\n> unused (void *item). Is that addressed soon? If not, I can deal with\n> it.\nHere are the code lines containing the variable in question:\n\n        void *item;\n        while ((item = hashmap_iter_next(&iter)))\n\nIntriguing.  The variable \"item\" is set, but can be removed without\neffect.  GCC 7.2 and Clang 5 don't warn about that.\n\nThe code was introduced by 8b604d1951 (hashmap: add API to disable item\ncounting when threaded) and there is no patch in pu that touches it\nagain, yet.\n\nRené\n"},{"id":"336562","messageId":"002501d38c94$3b9efd00$b2dcf700$@nexbridge.com","threadId":"47602","inReplyTo":"f139ed79-1e12-d7b6-dd24-ce77000917ec@web.de","subject":"RE: unused variable in hashmap.h [was: Re: [PATCH] Fixed pervasive enumeration warning in convert.h.]","fromName":"Randall S. Becker","fromEmail":"rsbecker@nexbridge.com","sentAt":"2018-01-13T17:30:35Z","receivedAt":"2018-01-13T17:30:50Z","isPatch":true,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"> Sent: On January 13, 2018 12:13 PM, René Scharfe wrote:\n> Am 12.01.2018 um 20:52 schrieb Randall S. Becker:\n> > On a related too many warnings subject, hashmap.h has a variable\n> > unused (void *item). Is that addressed soon? If not, I can deal with\n> > it.\n> Here are the code lines containing the variable in question:\n> \n>         void *item;\n>         while ((item = hashmap_iter_next(&iter)))\n> \n> Intriguing.  The variable \"item\" is set, but can be removed without effect.\n> GCC 7.2 and Clang 5 don't warn about that.\n> \n> The code was introduced by 8b604d1951 (hashmap: add API to disable item\n> counting when threaded) and there is no patch in pu that touches it again,\n\nI was thinking about just changing it to the following and submitting the trivial patch:\n\n         while (hashmap_iter_next(&iter))\n\nAvoids the frame allocation of void *item so should make it minimally faster when compiled without optimization. \n\nCheers,\nRandall\n\n"},{"id":"336572","messageId":"20180113224931.27031-1-tboegi@web.de","threadId":"47602","inReplyTo":"xmqqh8rqx4kz.fsf@gitster.mtv.corp.google.com","subject":"[PATCH v1 1/1] convert_to_git(): safe_crlf/checksafe becomes int conv_flags","fromName":"","fromEmail":"tboegi@web.de","sentAt":"2018-01-13T22:49:31Z","receivedAt":"2018-01-13T22:49:56Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"From: Torsten Bögershausen <tboegi@web.de>\n\nWhen calling convert_to_git(), the checksafe parameter defined what\nshould happen if the EOL conversion (CRLF --> LF --> CRLF) does not\nroundtrip cleanly. In addition, it also defined if line endings should\nbe renormalized (CRLF --> LF) or kept as they are.\n\nchecksafe was an safe_crlf enum with these values:\nSAFE_CRLF_FALSE:       do nothing in case of EOL roundtrip errors\nSAFE_CRLF_FAIL:        die in case of EOL roundtrip errors\nSAFE_CRLF_WARN:        print a warning in case of EOL roundtrip errors\nSAFE_CRLF_RENORMALIZE: change CRLF to LF\nSAFE_CRLF_KEEP_CRLF:   keep all line endings as they are\n\nIn some cases the integer value 0 was passed as checksafe parameter\ninstead of the correct enum value SAFE_CRLF_FALSE. That was no problem\nbecause SAFE_CRLF_FALSE is defined as 0.\n\nFALSE/FAIL/WARN are different from RENORMALIZE and KEEP_CRLF. Therefore,\nan enum is not ideal. Let's use a integer bit pattern instead and rename\nthe parameter to conv_flags to make it more generically usable. This\nallows us to extend the bit pattern in a subsequent commit.\n\nReported-By: Randall S. Becker <rsbecker@nexbridge.com>\nHelped-By: Lars Schneider <larsxschneider@gmail.com>\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\nSigned-off-by: Lars Schneider <larsxschneider@gmail.com>\n---\n\n >I think this is being solved a bit differently with a1fbf854\n >(\"convert_to_git(): safe_crlf/checksafe becomes int conv_flags\",\n >2018-01-06), and 0 becomes the right value to pass at this caller to\n >say \"I am passing none of the flag bit\".\n\n >I am hoping that the series that ends at f3b11d54 (\"convert: add\n >support for 'checkout-encoding' attribute\", 2018-01-06) will be\n >rerolled and hit 'master' early in the next cycle.\n\n  Thanks for the report & suggested patch. After reading it, I suggest\n  to break out the enum/int fix into an own \"series\".\n\n\napply.c        |  6 +++---\n combine-diff.c |  2 +-\n config.c       |  7 +++++--\n convert.c      | 38 +++++++++++++++++++-------------------\n convert.h      | 17 +++++++----------\n diff.c         |  8 ++++----\n environment.c  |  2 +-\n sha1_file.c    | 12 ++++++------\n 8 files changed, 46 insertions(+), 46 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex 321a9fa68..f8b67bfee 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -2263,8 +2263,8 @@ static void show_stats(struct apply_state *state, struct patch *patch)\n static int read_old_data(struct stat *st, struct patch *patch,\n \t\t\t const char *path, struct strbuf *buf)\n {\n-\tenum safe_crlf safe_crlf = patch->crlf_in_old ?\n-\t\tSAFE_CRLF_KEEP_CRLF : SAFE_CRLF_RENORMALIZE;\n+\tint conv_flags = patch->crlf_in_old ?\n+\t\tCONV_EOL_KEEP_CRLF : CONV_EOL_RENORMALIZE;\n \tswitch (st->st_mode & S_IFMT) {\n \tcase S_IFLNK:\n \t\tif (strbuf_readlink(buf, path, st->st_size) < 0)\n@@ -2281,7 +2281,7 @@ static int read_old_data(struct stat *st, struct patch *patch,\n \t\t * should never look at the index when explicit crlf option\n \t\t * is given.\n \t\t */\n-\t\tconvert_to_git(NULL, path, buf->buf, buf->len, buf, safe_crlf);\n+\t\tconvert_to_git(NULL, path, buf->buf, buf->len, buf, conv_flags);\n \t\treturn 0;\n \tdefault:\n \t\treturn -1;\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 2505de119..19f30c335 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -1053,7 +1053,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,\n \t\t\tif (is_file) {\n \t\t\t\tstruct strbuf buf = STRBUF_INIT;\n \n-\t\t\t\tif (convert_to_git(&the_index, elem->path, result, len, &buf, safe_crlf)) {\n+\t\t\t\tif (convert_to_git(&the_index, elem->path, result, len, &buf, global_conv_flags_eol)) {\n \t\t\t\t\tfree(result);\n \t\t\t\t\tresult = strbuf_detach(&buf, &len);\n \t\t\t\t\tresult_size = len;\ndiff --git a/config.c b/config.c\nindex e617c2018..1f003fbb9 100644\n--- a/config.c\n+++ b/config.c\n@@ -1149,11 +1149,14 @@ static int git_default_core_config(const char *var, const char *value)\n \t}\n \n \tif (!strcmp(var, \"core.safecrlf\")) {\n+\t\tint eol_rndtrp_die;\n \t\tif (value && !strcasecmp(value, \"warn\")) {\n-\t\t\tsafe_crlf = SAFE_CRLF_WARN;\n+\t\t\tglobal_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n \t\t\treturn 0;\n \t\t}\n-\t\tsafe_crlf = git_config_bool(var, value);\n+\t\teol_rndtrp_die = git_config_bool(var, value);\n+\t\tglobal_conv_flags_eol = eol_rndtrp_die ?\n+\t\t\tCONV_EOL_RNDTRP_DIE : CONV_EOL_RNDTRP_WARN;\n \t\treturn 0;\n \t}\n \ndiff --git a/convert.c b/convert.c\nindex 1a41a48e1..b976eb968 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -193,30 +193,30 @@ static enum eol output_eol(enum crlf_action crlf_action)\n \treturn core_eol;\n }\n \n-static void check_safe_crlf(const char *path, enum crlf_action crlf_action,\n+static void check_global_conv_flags_eol(const char *path, enum crlf_action crlf_action,\n \t\t\t    struct text_stat *old_stats, struct text_stat *new_stats,\n-\t\t\t    enum safe_crlf checksafe)\n+\t\t\t    int conv_flags)\n {\n \tif (old_stats->crlf && !new_stats->crlf ) {\n \t\t/*\n \t\t * CRLFs would not be restored by checkout\n \t\t */\n-\t\tif (checksafe == SAFE_CRLF_WARN)\n+\t\tif (conv_flags & CONV_EOL_RNDTRP_DIE)\n+\t\t\tdie(_(\"CRLF would be replaced by LF in %s.\"), path);\n+\t\telse if (conv_flags & CONV_EOL_RNDTRP_WARN)\n \t\t\twarning(_(\"CRLF will be replaced by LF in %s.\\n\"\n \t\t\t\t  \"The file will have its original line\"\n \t\t\t\t  \" endings in your working directory.\"), path);\n-\t\telse /* i.e. SAFE_CRLF_FAIL */\n-\t\t\tdie(_(\"CRLF would be replaced by LF in %s.\"), path);\n \t} else if (old_stats->lonelf && !new_stats->lonelf ) {\n \t\t/*\n \t\t * CRLFs would be added by checkout\n \t\t */\n-\t\tif (checksafe == SAFE_CRLF_WARN)\n+\t\tif (conv_flags & CONV_EOL_RNDTRP_DIE)\n+\t\t\tdie(_(\"LF would be replaced by CRLF in %s\"), path);\n+\t\telse if (conv_flags & CONV_EOL_RNDTRP_WARN)\n \t\t\twarning(_(\"LF will be replaced by CRLF in %s.\\n\"\n \t\t\t\t  \"The file will have its original line\"\n \t\t\t\t  \" endings in your working directory.\"), path);\n-\t\telse /* i.e. SAFE_CRLF_FAIL */\n-\t\t\tdie(_(\"LF would be replaced by CRLF in %s\"), path);\n \t}\n }\n \n@@ -268,7 +268,7 @@ static int will_convert_lf_to_crlf(size_t len, struct text_stat *stats,\n static int crlf_to_git(const struct index_state *istate,\n \t\t       const char *path, const char *src, size_t len,\n \t\t       struct strbuf *buf,\n-\t\t       enum crlf_action crlf_action, enum safe_crlf checksafe)\n+\t\t       enum crlf_action crlf_action, int conv_flags)\n {\n \tstruct text_stat stats;\n \tchar *dst;\n@@ -298,12 +298,12 @@ static int crlf_to_git(const struct index_state *istate,\n \t\t * unless we want to renormalize in a merge or\n \t\t * cherry-pick.\n \t\t */\n-\t\tif ((checksafe != SAFE_CRLF_RENORMALIZE) &&\n+\t\tif ((!(conv_flags & CONV_EOL_RENORMALIZE)) &&\n \t\t    has_crlf_in_index(istate, path))\n \t\t\tconvert_crlf_into_lf = 0;\n \t}\n-\tif ((checksafe == SAFE_CRLF_WARN ||\n-\t    (checksafe == SAFE_CRLF_FAIL)) && len) {\n+\tif (((conv_flags & CONV_EOL_RNDTRP_WARN) ||\n+\t     ((conv_flags & CONV_EOL_RNDTRP_DIE) && len))) {\n \t\tstruct text_stat new_stats;\n \t\tmemcpy(&new_stats, &stats, sizeof(new_stats));\n \t\t/* simulate \"git add\" */\n@@ -316,7 +316,7 @@ static int crlf_to_git(const struct index_state *istate,\n \t\t\tnew_stats.crlf += new_stats.lonelf;\n \t\t\tnew_stats.lonelf = 0;\n \t\t}\n-\t\tcheck_safe_crlf(path, crlf_action, &stats, &new_stats, checksafe);\n+\t\tcheck_global_conv_flags_eol(path, crlf_action, &stats, &new_stats, conv_flags);\n \t}\n \tif (!convert_crlf_into_lf)\n \t\treturn 0;\n@@ -1129,7 +1129,7 @@ const char *get_convert_attr_ascii(const char *path)\n \n int convert_to_git(const struct index_state *istate,\n \t\t   const char *path, const char *src, size_t len,\n-                   struct strbuf *dst, enum safe_crlf checksafe)\n+\t\t   struct strbuf *dst, int conv_flags)\n {\n \tint ret = 0;\n \tstruct conv_attrs ca;\n@@ -1144,8 +1144,8 @@ int convert_to_git(const struct index_state *istate,\n \t\tsrc = dst->buf;\n \t\tlen = dst->len;\n \t}\n-\tif (checksafe != SAFE_CRLF_KEEP_CRLF) {\n-\t\tret |= crlf_to_git(istate, path, src, len, dst, ca.crlf_action, checksafe);\n+\tif (!(conv_flags & CONV_EOL_KEEP_CRLF)) {\n+\t\tret |= crlf_to_git(istate, path, src, len, dst, ca.crlf_action, conv_flags);\n \t\tif (ret && dst) {\n \t\t\tsrc = dst->buf;\n \t\t\tlen = dst->len;\n@@ -1156,7 +1156,7 @@ int convert_to_git(const struct index_state *istate,\n \n void convert_to_git_filter_fd(const struct index_state *istate,\n \t\t\t      const char *path, int fd, struct strbuf *dst,\n-\t\t\t      enum safe_crlf checksafe)\n+\t\t\t      int conv_flags)\n {\n \tstruct conv_attrs ca;\n \tconvert_attrs(&ca, path);\n@@ -1167,7 +1167,7 @@ void convert_to_git_filter_fd(const struct index_state *istate,\n \tif (!apply_filter(path, NULL, 0, fd, dst, ca.drv, CAP_CLEAN, NULL))\n \t\tdie(\"%s: clean filter '%s' failed\", path, ca.drv->name);\n \n-\tcrlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, checksafe);\n+\tcrlf_to_git(istate, path, dst->buf, dst->len, dst, ca.crlf_action, conv_flags);\n \tident_to_git(path, dst->buf, dst->len, dst, ca.ident);\n }\n \n@@ -1226,7 +1226,7 @@ int renormalize_buffer(const struct index_state *istate, const char *path,\n \t\tsrc = dst->buf;\n \t\tlen = dst->len;\n \t}\n-\treturn ret | convert_to_git(istate, path, src, len, dst, SAFE_CRLF_RENORMALIZE);\n+\treturn ret | convert_to_git(istate, path, src, len, dst, CONV_EOL_RENORMALIZE);\n }\n \n /*****************************************************************\ndiff --git a/convert.h b/convert.h\nindex 4f2da225a..65ab3e516 100644\n--- a/convert.h\n+++ b/convert.h\n@@ -8,15 +8,12 @@\n \n struct index_state;\n \n-enum safe_crlf {\n-\tSAFE_CRLF_FALSE = 0,\n-\tSAFE_CRLF_FAIL = 1,\n-\tSAFE_CRLF_WARN = 2,\n-\tSAFE_CRLF_RENORMALIZE = 3,\n-\tSAFE_CRLF_KEEP_CRLF = 4\n-};\n+#define CONV_EOL_RNDTRP_DIE   (1<<0) /* Die if CRLF to LF to CRLF is different */\n+#define CONV_EOL_RNDTRP_WARN  (1<<1) /* Warn if CRLF to LF to CRLF is different */\n+#define CONV_EOL_RENORMALIZE  (1<<2) /* Convert CRLF to LF */\n+#define CONV_EOL_KEEP_CRLF    (1<<3) /* Keep CRLF line endings as is */\n \n-extern enum safe_crlf safe_crlf;\n+extern int global_conv_flags_eol;\n \n enum auto_crlf {\n \tAUTO_CRLF_FALSE = 0,\n@@ -66,7 +63,7 @@ extern const char *get_convert_attr_ascii(const char *path);\n /* returns 1 if *dst was used */\n extern int convert_to_git(const struct index_state *istate,\n \t\t\t  const char *path, const char *src, size_t len,\n-\t\t\t  struct strbuf *dst, enum safe_crlf checksafe);\n+\t\t\t  struct strbuf *dst, int conv_flags);\n extern int convert_to_working_tree(const char *path, const char *src,\n \t\t\t\t   size_t len, struct strbuf *dst);\n extern int async_convert_to_working_tree(const char *path, const char *src,\n@@ -85,7 +82,7 @@ static inline int would_convert_to_git(const struct index_state *istate,\n extern void convert_to_git_filter_fd(const struct index_state *istate,\n \t\t\t\t     const char *path, int fd,\n \t\t\t\t     struct strbuf *dst,\n-\t\t\t\t     enum safe_crlf checksafe);\n+\t\t\t\t     int conv_flags);\n extern int would_convert_to_git_filter_fd(const char *path);\n \n /*****************************************************************\ndiff --git a/diff.c b/diff.c\nindex fb22b19f0..35cca04f2 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -3520,13 +3520,13 @@ int diff_populate_filespec(struct diff_filespec *s, unsigned int flags)\n {\n \tint size_only = flags & CHECK_SIZE_ONLY;\n \tint err = 0;\n+\tint conv_flags = global_conv_flags_eol;\n \t/*\n \t * demote FAIL to WARN to allow inspecting the situation\n \t * instead of refusing.\n \t */\n-\tenum safe_crlf crlf_warn = (safe_crlf == SAFE_CRLF_FAIL\n-\t\t\t\t    ? SAFE_CRLF_WARN\n-\t\t\t\t    : safe_crlf);\n+\tif (conv_flags & CONV_EOL_RNDTRP_DIE)\n+\t\tconv_flags = CONV_EOL_RNDTRP_WARN;\n \n \tif (!DIFF_FILE_VALID(s))\n \t\tdie(\"internal error: asking to populate invalid file.\");\n@@ -3603,7 +3603,7 @@ int diff_populate_filespec(struct diff_filespec *s, unsigned int flags)\n \t\t/*\n \t\t * Convert from working tree format to canonical git format\n \t\t */\n-\t\tif (convert_to_git(&the_index, s->path, s->data, s->size, &buf, crlf_warn)) {\n+\t\tif (convert_to_git(&the_index, s->path, s->data, s->size, &buf, conv_flags)) {\n \t\t\tsize_t size = 0;\n \t\t\tmunmap(s->data, s->size);\n \t\t\ts->should_munmap = 0;\ndiff --git a/environment.c b/environment.c\nindex 63ac38a46..10a32c20a 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -49,7 +49,7 @@ enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;\n int check_replace_refs = 1;\n char *git_replace_ref_base;\n enum eol core_eol = EOL_UNSET;\n-enum safe_crlf safe_crlf = SAFE_CRLF_WARN;\n+int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;\n enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;\n enum rebase_setup_type autorebase = AUTOREBASE_NEVER;\ndiff --git a/sha1_file.c b/sha1_file.c\nindex 3da70ac65..6bc7c6ada 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -133,14 +133,14 @@ static struct cached_object *find_cached_object(const unsigned char *sha1)\n }\n \n \n-static enum safe_crlf get_safe_crlf(unsigned flags)\n+static int get_conv_flags(unsigned flags)\n {\n \tif (flags & HASH_RENORMALIZE)\n-\t\treturn SAFE_CRLF_RENORMALIZE;\n+\t\treturn CONV_EOL_RENORMALIZE;\n \telse if (flags & HASH_WRITE_OBJECT)\n-\t\treturn safe_crlf;\n+\t  return global_conv_flags_eol;\n \telse\n-\t\treturn SAFE_CRLF_FALSE;\n+\t\treturn 0;\n }\n \n \n@@ -1752,7 +1752,7 @@ static int index_mem(struct object_id *oid, void *buf, size_t size,\n \tif ((type == OBJ_BLOB) && path) {\n \t\tstruct strbuf nbuf = STRBUF_INIT;\n \t\tif (convert_to_git(&the_index, path, buf, size, &nbuf,\n-\t\t\t\t   get_safe_crlf(flags))) {\n+\t\t\t\t   get_conv_flags(flags))) {\n \t\t\tbuf = strbuf_detach(&nbuf, &size);\n \t\t\tre_allocated = 1;\n \t\t}\n@@ -1786,7 +1786,7 @@ static int index_stream_convert_blob(struct object_id *oid, int fd,\n \tassert(would_convert_to_git_filter_fd(path));\n \n \tconvert_to_git_filter_fd(&the_index, path, fd, &sbuf,\n-\t\t\t\t get_safe_crlf(flags));\n+\t\t\t\t get_conv_flags(flags));\n \n \tif (write_object)\n \t\tret = write_sha1_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),\n-- \n2.16.0.rc0.2.g00e34bdac6.dirty\n\n"}]}