{"thread":{"id":"66655","subject":"[PATCH 0/4] environment: move line ending config variables into repo_config_values","startedAt":"2026-10-24T22:00:08Z","lastAt":"2026-11-03T17:01:49Z","messageCount":11,"participants":["Aniket Gupta","Patrick Steinhardt","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"556190","messageId":"20261024220012.486-1-aniketgupta3001@gmail.com","threadId":"66655","inReplyTo":null,"subject":"[PATCH 0/4] environment: move line ending config variables into repo_config_values","fromName":"Aniket Gupta","fromEmail":"aniketgupta3001@gmail.com","sentAt":"2026-10-24T22:00:08Z","receivedAt":"2026-10-24T22:00:08Z","isPatch":true,"sender":{"key":"aniketgupta3001@gmail.com","avatar":null},"body":"Hi,\n\nThis series moves the global variables behind core.autocrlf, core.eol\nand core.safecrlf into 'struct repo_config_values' to continue the\nlibification effort.\n\nThe first patch passes 'repo' to the working tree conversion\nfunctions which need it to read the values. The other three move one\nvariable each just like the earlier conversions.\n\nAn alternative to passing 'repo' would be to store the resolved values\nin 'struct conv_attrs'. I went with passing it since that is what the\nearlier conversions did, but I can change it if you prefer.\n\nAniket Gupta (4):\n  convert: pass 'repo' to the working tree conversion functions\n  environment: move auto_crlf into repo_config_values\n  environment: move core_eol into repo_config_values\n  environment: move global_conv_flags_eol into repo_config_values\n\n combine-diff.c      |   4 +-\n convert.c           | 107 +++++++++++++++++++++++++++++++-------------\n convert.h           |  60 +++++++------------------\n diff.c              |   2 +-\n entry.c             |  16 ++++---\n environment.c       |  43 +++++++++++++-----\n environment.h       |  26 +++++++++++\n object-file.c       |  11 +++--\n parallel-checkout.c |   8 ++--\n 9 files changed, 177 insertions(+), 100 deletions(-)\n\n-- \n2.43.0\n\n\n"},{"id":"556191","messageId":"20261024220012.486-2-aniketgupta3001@gmail.com","threadId":"66655","inReplyTo":"20261024220012.486-1-aniketgupta3001@gmail.com","subject":"[PATCH 1/4] convert: pass 'repo' to the working tree conversion functions","fromName":"Aniket Gupta","fromEmail":"aniketgupta3001@gmail.com","sentAt":"2026-10-24T22:00:09Z","receivedAt":"2026-10-24T22:00:09Z","isPatch":true,"sender":{"key":"aniketgupta3001@gmail.com","avatar":null},"body":"The functions that convert a blob to its working tree format take a\n'struct conv_attrs' but no repository, even though what they do\ndepends on configuration such as 'core.autocrlf' and 'core.eol'. As\nwe migrate these configuration variables into the repository struct,\nthe functions need access to the repository context.\n\nAdd a 'struct repository *' parameter to convert_to_working_tree_ca(),\nasync_convert_to_working_tree_ca() and get_stream_filter_ca(), and\nupdate all callers to pass the appropriate repository instance. The\nparameter is not used yet, so mark it as UNUSED for now.\n\nThe convert_to_working_tree() and async_convert_to_working_tree()\nwrappers were static inline functions in 'convert.h'. They need to\nget the repository from the index, which 'convert.h' does not know\nabout, so move them into 'convert.c'.\n\nSigned-off-by: Aniket Gupta <aniketgupta3001@gmail.com>\n---\n convert.c           | 39 +++++++++++++++++++++++++++++++++++----\n convert.h           | 38 ++++++++++++++++----------------------\n entry.c             | 16 +++++++++++-----\n parallel-checkout.c |  8 +++++---\n 4 files changed, 67 insertions(+), 34 deletions(-)\n\ndiff --git a/convert.c b/convert.c\nindex 036506842c..95bdfafdd0 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -1520,7 +1520,8 @@ static int convert_to_working_tree_ca_internal(const struct conv_attrs *ca,\n \treturn ret | ret_filter;\n }\n \n-int async_convert_to_working_tree_ca(const struct conv_attrs *ca,\n+int async_convert_to_working_tree_ca(struct repository *repo UNUSED,\n+\t\t\t\t     const struct conv_attrs *ca,\n \t\t\t\t     const char *path, const char *src,\n \t\t\t\t     size_t len, struct strbuf *dst,\n \t\t\t\t     const struct checkout_metadata *meta,\n@@ -1530,7 +1531,8 @@ int async_convert_to_working_tree_ca(const struct conv_attrs *ca,\n \t\t\t\t\t\t   meta, dco);\n }\n \n-int convert_to_working_tree_ca(const struct conv_attrs *ca,\n+int convert_to_working_tree_ca(struct repository *repo UNUSED,\n+\t\t\t       const struct conv_attrs *ca,\n \t\t\t       const char *path, const char *src,\n \t\t\t       size_t len, struct strbuf *dst,\n \t\t\t       const struct checkout_metadata *meta)\n@@ -1539,6 +1541,32 @@ int convert_to_working_tree_ca(const struct conv_attrs *ca,\n \t\t\t\t\t\t   meta, NULL);\n }\n \n+int convert_to_working_tree(struct index_state *istate,\n+\t\t\t   const char *path, const char *src,\n+\t\t\t   size_t len, struct strbuf *dst,\n+\t\t\t   const struct checkout_metadata *meta)\n+{\n+\tstruct repository *repo = istate && istate->repo ?\n+\t\t\t\t  istate->repo : the_repository;\n+\tstruct conv_attrs ca;\n+\tconvert_attrs(istate, &ca, path);\n+\treturn convert_to_working_tree_ca(repo, &ca, path, src, len, dst, meta);\n+}\n+\n+int async_convert_to_working_tree(struct index_state *istate,\n+\t\t\t\t  const char *path, const char *src,\n+\t\t\t\t  size_t len, struct strbuf *dst,\n+\t\t\t\t  const struct checkout_metadata *meta,\n+\t\t\t\t  void *dco)\n+{\n+\tstruct repository *repo = istate && istate->repo ?\n+\t\t\t\t  istate->repo : the_repository;\n+\tstruct conv_attrs ca;\n+\tconvert_attrs(istate, &ca, path);\n+\treturn async_convert_to_working_tree_ca(repo, &ca, path, src, len, dst,\n+\t\t\t\t\t\tmeta, dco);\n+}\n+\n int renormalize_buffer(struct index_state *istate, const char *path,\n \t\t       const char *src, size_t len, struct strbuf *dst)\n {\n@@ -1981,7 +2009,8 @@ static struct stream_filter *ident_filter(const struct object_id *oid)\n  * Note that you would be crazy to set CRLF, smudge/clean or ident to a\n  * large binary blob you would want us not to slurp into the memory!\n  */\n-struct stream_filter *get_stream_filter_ca(const struct conv_attrs *ca,\n+struct stream_filter *get_stream_filter_ca(struct repository *repo UNUSED,\n+\t\t\t\t\t   const struct conv_attrs *ca,\n \t\t\t\t\t   const struct object_id *oid)\n {\n \tstruct stream_filter *filter = NULL;\n@@ -2006,7 +2035,9 @@ struct stream_filter *get_stream_filter(struct index_state *istate,\n {\n \tstruct conv_attrs ca;\n \tconvert_attrs(istate, &ca, path);\n-\treturn get_stream_filter_ca(&ca, oid);\n+\treturn get_stream_filter_ca(istate && istate->repo ?\n+\t\t\t\t    istate->repo : the_repository,\n+\t\t\t\t    &ca, oid);\n }\n \n void free_stream_filter(struct stream_filter *filter)\ndiff --git a/convert.h b/convert.h\nindex 0a6e4086b8..137fa1593a 100644\n--- a/convert.h\n+++ b/convert.h\n@@ -8,6 +8,7 @@\n #include \"string-list.h\"\n \n struct index_state;\n+struct repository;\n struct strbuf;\n \n #define CONV_EOL_RNDTRP_DIE   (1<<0) /* Die if CRLF to LF to CRLF is different */\n@@ -103,34 +104,26 @@ const char *get_convert_attr_ascii(struct index_state *istate,\n int convert_to_git(struct index_state *istate,\n \t\t   const char *path, const char *src, size_t len,\n \t\t   struct strbuf *dst, int conv_flags);\n-int convert_to_working_tree_ca(const struct conv_attrs *ca,\n+int convert_to_working_tree_ca(struct repository *repo,\n+\t\t\t       const struct conv_attrs *ca,\n \t\t\t       const char *path, const char *src,\n \t\t\t       size_t len, struct strbuf *dst,\n \t\t\t       const struct checkout_metadata *meta);\n-int async_convert_to_working_tree_ca(const struct conv_attrs *ca,\n+int async_convert_to_working_tree_ca(struct repository *repo,\n+\t\t\t\t     const struct conv_attrs *ca,\n \t\t\t\t     const char *path, const char *src,\n \t\t\t\t     size_t len, struct strbuf *dst,\n \t\t\t\t     const struct checkout_metadata *meta,\n \t\t\t\t     void *dco);\n-static inline int convert_to_working_tree(struct index_state *istate,\n-\t\t\t\t\t  const char *path, const char *src,\n-\t\t\t\t\t  size_t len, struct strbuf *dst,\n-\t\t\t\t\t  const struct checkout_metadata *meta)\n-{\n-\tstruct conv_attrs ca;\n-\tconvert_attrs(istate, &ca, path);\n-\treturn convert_to_working_tree_ca(&ca, path, src, len, dst, meta);\n-}\n-static inline int async_convert_to_working_tree(struct index_state *istate,\n-\t\t\t\t\t\tconst char *path, const char *src,\n-\t\t\t\t\t\tsize_t len, struct strbuf *dst,\n-\t\t\t\t\t\tconst struct checkout_metadata *meta,\n-\t\t\t\t\t\tvoid *dco)\n-{\n-\tstruct conv_attrs ca;\n-\tconvert_attrs(istate, &ca, path);\n-\treturn async_convert_to_working_tree_ca(&ca, path, src, len, dst, meta, dco);\n-}\n+int convert_to_working_tree(struct index_state *istate,\n+\t\t\t   const char *path, const char *src,\n+\t\t\t   size_t len, struct strbuf *dst,\n+\t\t\t   const struct checkout_metadata *meta);\n+int async_convert_to_working_tree(struct index_state *istate,\n+\t\t\t\t  const char *path, const char *src,\n+\t\t\t\t  size_t len, struct strbuf *dst,\n+\t\t\t\t  const struct checkout_metadata *meta,\n+\t\t\t\t  void *dco);\n int async_query_available_blobs(const char *cmd,\n \t\t\t\tstruct string_list *available_paths);\n int renormalize_buffer(struct index_state *istate,\n@@ -183,7 +176,8 @@ struct stream_filter; /* opaque */\n struct stream_filter *get_stream_filter(struct index_state *istate,\n \t\t\t\t\tconst char *path,\n \t\t\t\t\tconst struct object_id *);\n-struct stream_filter *get_stream_filter_ca(const struct conv_attrs *ca,\n+struct stream_filter *get_stream_filter_ca(struct repository *repo,\n+\t\t\t\t\t   const struct conv_attrs *ca,\n \t\t\t\t\t   const struct object_id *oid);\n void free_stream_filter(struct stream_filter *);\n int is_null_stream_filter(struct stream_filter *);\ndiff --git a/entry.c b/entry.c\nindex 1c4f0f4407..7fda86e67f 100644\n--- a/entry.c\n+++ b/entry.c\n@@ -296,11 +296,14 @@ static int write_entry(struct cache_entry *ce, char *path, struct conv_attrs *ca\n \tconst struct submodule *sub;\n \tstruct checkout_metadata meta;\n \tstatic int scratch_nr_checkouts;\n+\tstruct repository *repo = state->istate && state->istate->repo ?\n+\t\t\t\t  state->istate->repo : the_repository;\n \n \tclone_checkout_metadata(&meta, &state->meta, &ce->oid);\n \n \tif (ce_mode_s_ifmt == S_IFREG) {\n-\t\tstruct stream_filter *filter = get_stream_filter_ca(ca, &ce->oid);\n+\t\tstruct stream_filter *filter =\n+\t\t\tget_stream_filter_ca(repo, ca, &ce->oid);\n \t\tif (filter &&\n \t\t    !streaming_write_entry(ce, path, filter,\n \t\t\t\t\t   state, to_tempfile,\n@@ -348,9 +351,11 @@ static int write_entry(struct cache_entry *ce, char *path, struct conv_attrs *ca\n \t\t * Convert from git internal format to working tree format\n \t\t */\n \t\tif (dco && dco->state != CE_NO_DELAY) {\n-\t\t\tret = async_convert_to_working_tree_ca(ca, ce->name,\n+\t\t\tret = async_convert_to_working_tree_ca(repo, ca,\n+\t\t\t\t\t\t\t       ce->name,\n \t\t\t\t\t\t\t       new_blob, size,\n-\t\t\t\t\t\t\t       &buf, &meta, dco);\n+\t\t\t\t\t\t\t       &buf, &meta,\n+\t\t\t\t\t\t\t       dco);\n \t\t\tif (ret) {\n \t\t\t\tstruct string_list_item *item =\n \t\t\t\t\tstring_list_lookup(&dco->paths, ce->name);\n@@ -362,8 +367,9 @@ static int write_entry(struct cache_entry *ce, char *path, struct conv_attrs *ca\n \t\t\t\t}\n \t\t\t}\n \t\t} else {\n-\t\t\tret = convert_to_working_tree_ca(ca, ce->name, new_blob,\n-\t\t\t\t\t\t\t size, &buf, &meta);\n+\t\t\tret = convert_to_working_tree_ca(repo, ca, ce->name,\n+\t\t\t\t\t\t\t new_blob, size, &buf,\n+\t\t\t\t\t\t\t &meta);\n \t\t}\n \n \t\tif (ret) {\ndiff --git a/parallel-checkout.c b/parallel-checkout.c\nindex 0bf4bd6d4a..51a4db4f67 100644\n--- a/parallel-checkout.c\n+++ b/parallel-checkout.c\n@@ -279,7 +279,8 @@ static int write_pc_item_to_fd(struct parallel_checkout_item *pc_item, int fd,\n \t/* Sanity check */\n \tASSERT(is_eligible_for_parallel_checkout(pc_item->ce, &pc_item->ca));\n \n-\tfilter = get_stream_filter_ca(&pc_item->ca, &pc_item->ce->oid);\n+\tfilter = get_stream_filter_ca(the_repository, &pc_item->ca,\n+\t\t\t\t\t&pc_item->ce->oid);\n \tif (filter) {\n \t\tif (odb_stream_blob_to_fd(the_repository->objects, fd,\n \t\t\t\t\t  &pc_item->ce->oid, filter, 1)) {\n@@ -302,8 +303,9 @@ static int write_pc_item_to_fd(struct parallel_checkout_item *pc_item, int fd,\n \t * checkout, so pass NULL. Note: if that changes, the metadata must also\n \t * be passed from the main process to the workers.\n \t */\n-\tret = convert_to_working_tree_ca(&pc_item->ca, pc_item->ce->name,\n-\t\t\t\t\t blob, size, &buf, NULL);\n+\tret = convert_to_working_tree_ca(the_repository, &pc_item->ca,\n+\t\t\t\t\t pc_item->ce->name, blob, size, &buf,\n+\t\t\t\t\t NULL);\n \n \tif (ret) {\n \t\tsize_t newsize;\n-- \n2.43.0\n\n\n"},{"id":"556192","messageId":"20261024220012.486-3-aniketgupta3001@gmail.com","threadId":"66655","inReplyTo":"20261024220012.486-1-aniketgupta3001@gmail.com","subject":"[PATCH 2/4] environment: move auto_crlf into repo_config_values","fromName":"Aniket Gupta","fromEmail":"aniketgupta3001@gmail.com","sentAt":"2026-10-24T22:00:10Z","receivedAt":"2026-10-24T22:00:10Z","isPatch":true,"sender":{"key":"aniketgupta3001@gmail.com","avatar":null},"body":"The global variable 'auto_crlf' holds the value of the 'core.autocrlf'\nconfiguration, which controls whether line endings are converted when\nfiles are added to and checked out of the repository. Move it into\n'struct repo_config_values' to continue the libification effort.\n\nWhile 'enum auto_crlf' ideally belongs in 'convert.h', moving it there\nintroduces a circular dependency chain:\n\n  convert.h -> hash.h -> repository.h -> environment.h.\n\nTherefore, the enum definition is kept in 'environment.h' just below\n'enum object_creation_mode', under the existing NEEDSWORK comment for\nfuture cleanup. Initialize the per-repository value to its default in\n'repo_config_values_init()'.\n\nModify the configuration parsing in environment.c to update the\nper-repository structure directly. To read the value, introduce the\ngetter 'repo_auto_crlf()' and pass the repository down to the helpers\nin 'convert.c' that need it.\n\nSigned-off-by: Aniket Gupta <aniketgupta3001@gmail.com>\n---\n convert.c     | 68 +++++++++++++++++++++++++++++++--------------------\n convert.h     |  8 ------\n environment.c | 13 +++++++---\n environment.h |  9 +++++++\n 4 files changed, 60 insertions(+), 38 deletions(-)\n\ndiff --git a/convert.c b/convert.c\nindex 95bdfafdd0..7c7fdd4b2d 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -158,11 +158,11 @@ const char *get_wt_convert_stats_ascii(const char *path)\n \treturn ret;\n }\n \n-static int text_eol_is_crlf(void)\n+static int text_eol_is_crlf(struct repository *repo)\n {\n-\tif (auto_crlf == AUTO_CRLF_TRUE)\n+\tif (repo_auto_crlf(repo) == AUTO_CRLF_TRUE)\n \t\treturn 1;\n-\telse if (auto_crlf == AUTO_CRLF_INPUT)\n+\telse if (repo_auto_crlf(repo) == AUTO_CRLF_INPUT)\n \t\treturn 0;\n \tif (core_eol == EOL_CRLF)\n \t\treturn 1;\n@@ -171,7 +171,8 @@ static int text_eol_is_crlf(void)\n \treturn 0;\n }\n \n-static enum eol output_eol(enum convert_crlf_action crlf_action)\n+static enum eol output_eol(struct repository *repo,\n+\t\t\t   enum convert_crlf_action crlf_action)\n {\n \tswitch (crlf_action) {\n \tcase CRLF_BINARY:\n@@ -188,7 +189,7 @@ static enum eol output_eol(enum convert_crlf_action crlf_action)\n \tcase CRLF_TEXT:\n \tcase CRLF_AUTO:\n \t\t/* fall through */\n-\t\treturn text_eol_is_crlf() ? EOL_CRLF : EOL_LF;\n+\t\treturn text_eol_is_crlf(repo) ? EOL_CRLF : EOL_LF;\n \t}\n \twarning(_(\"illegal crlf_action %d\"), (int)crlf_action);\n \treturn core_eol;\n@@ -244,10 +245,11 @@ static int has_crlf_in_index(struct index_state *istate, const char *path)\n \treturn has_crlf;\n }\n \n-static int will_convert_lf_to_crlf(struct text_stat *stats,\n+static int will_convert_lf_to_crlf(struct repository *repo,\n+\t\t\t\t   struct text_stat *stats,\n \t\t\t\t   enum convert_crlf_action crlf_action)\n {\n-\tif (output_eol(crlf_action) != EOL_CRLF)\n+\tif (output_eol(repo, crlf_action) != EOL_CRLF)\n \t\treturn 0;\n \t/* No \"naked\" LF? Nothing to convert, regardless. */\n \tif (!stats->lonelf)\n@@ -505,6 +507,8 @@ static int crlf_to_git(struct index_state *istate,\n \t\t       struct strbuf *buf,\n \t\t       enum convert_crlf_action crlf_action, int conv_flags)\n {\n+\tstruct repository *repo = istate && istate->repo ?\n+\t\t\t\t  istate->repo : the_repository;\n \tstruct text_stat stats;\n \tchar *dst;\n \tint convert_crlf_into_lf;\n@@ -547,7 +551,7 @@ static int crlf_to_git(struct index_state *istate,\n \t\t\tnew_stats.crlf = 0;\n \t\t}\n \t\t/* simulate \"git checkout\" */\n-\t\tif (will_convert_lf_to_crlf(&new_stats, crlf_action)) {\n+\t\tif (will_convert_lf_to_crlf(repo, &new_stats, crlf_action)) {\n \t\t\tnew_stats.crlf += new_stats.lonelf;\n \t\t\tnew_stats.lonelf = 0;\n \t\t}\n@@ -589,17 +593,18 @@ static int crlf_to_git(struct index_state *istate,\n \treturn 1;\n }\n \n-static int crlf_to_worktree(const char *src, size_t len, struct strbuf *buf,\n+static int crlf_to_worktree(struct repository *repo,\n+\t\t\t    const char *src, size_t len, struct strbuf *buf,\n \t\t\t    enum convert_crlf_action crlf_action)\n {\n \tchar *to_free = NULL;\n \tstruct text_stat stats;\n \n-\tif (!len || output_eol(crlf_action) != EOL_CRLF)\n+\tif (!len || output_eol(repo, crlf_action) != EOL_CRLF)\n \t\treturn 0;\n \n \tgather_stats(src, len, &stats);\n-\tif (!will_convert_lf_to_crlf(&stats, crlf_action))\n+\tif (!will_convert_lf_to_crlf(repo, &stats, crlf_action))\n \t\treturn 0;\n \n \t/* are we \"faking\" in place editing ? */\n@@ -1321,6 +1326,8 @@ static struct attr_check *check;\n void convert_attrs(struct index_state *istate,\n \t\t   struct conv_attrs *ca, const char *path)\n {\n+\tstruct repository *repo = istate && istate->repo ?\n+\t\t\t\t  istate->repo : the_repository;\n \tstruct attr_check_item *ccheck = NULL;\n \n \tif (!check) {\n@@ -1354,12 +1361,16 @@ void convert_attrs(struct index_state *istate,\n \t/* Save attr and make a decision for action */\n \tca->attr_action = ca->crlf_action;\n \tif (ca->crlf_action == CRLF_TEXT)\n-\t\tca->crlf_action = text_eol_is_crlf() ? CRLF_TEXT_CRLF : CRLF_TEXT_INPUT;\n-\tif (ca->crlf_action == CRLF_UNDEFINED && auto_crlf == AUTO_CRLF_FALSE)\n+\t\tca->crlf_action = text_eol_is_crlf(repo) ?\n+\t\t\t\t  CRLF_TEXT_CRLF : CRLF_TEXT_INPUT;\n+\tif (ca->crlf_action == CRLF_UNDEFINED &&\n+\t    repo_auto_crlf(repo) == AUTO_CRLF_FALSE)\n \t\tca->crlf_action = CRLF_BINARY;\n-\tif (ca->crlf_action == CRLF_UNDEFINED && auto_crlf == AUTO_CRLF_TRUE)\n+\tif (ca->crlf_action == CRLF_UNDEFINED &&\n+\t    repo_auto_crlf(repo) == AUTO_CRLF_TRUE)\n \t\tca->crlf_action = CRLF_AUTO_CRLF;\n-\tif (ca->crlf_action == CRLF_UNDEFINED && auto_crlf == AUTO_CRLF_INPUT)\n+\tif (ca->crlf_action == CRLF_UNDEFINED &&\n+\t    repo_auto_crlf(repo) == AUTO_CRLF_INPUT)\n \t\tca->crlf_action = CRLF_AUTO_INPUT;\n }\n \n@@ -1479,7 +1490,8 @@ void convert_to_git_filter_fd(struct index_state *istate,\n \tident_to_git(dst->buf, dst->len, dst, ca.ident);\n }\n \n-static int convert_to_working_tree_ca_internal(const struct conv_attrs *ca,\n+static int convert_to_working_tree_ca_internal(struct repository *repo,\n+\t\t\t\t\t       const struct conv_attrs *ca,\n \t\t\t\t\t       const char *path, const char *src,\n \t\t\t\t\t       size_t len, struct strbuf *dst,\n \t\t\t\t\t       int normalizing,\n@@ -1499,7 +1511,7 @@ static int convert_to_working_tree_ca_internal(const struct conv_attrs *ca,\n \t * support smudge).  The filters might expect CRLFs.\n \t */\n \tif ((ca->drv && (ca->drv->smudge || ca->drv->process)) || !normalizing) {\n-\t\tret |= crlf_to_worktree(src, len, dst, ca->crlf_action);\n+\t\tret |= crlf_to_worktree(repo, src, len, dst, ca->crlf_action);\n \t\tif (ret) {\n \t\t\tsrc = dst->buf;\n \t\t\tlen = dst->len;\n@@ -1520,25 +1532,25 @@ static int convert_to_working_tree_ca_internal(const struct conv_attrs *ca,\n \treturn ret | ret_filter;\n }\n \n-int async_convert_to_working_tree_ca(struct repository *repo UNUSED,\n+int async_convert_to_working_tree_ca(struct repository *repo,\n \t\t\t\t     const struct conv_attrs *ca,\n \t\t\t\t     const char *path, const char *src,\n \t\t\t\t     size_t len, struct strbuf *dst,\n \t\t\t\t     const struct checkout_metadata *meta,\n \t\t\t\t     void *dco)\n {\n-\treturn convert_to_working_tree_ca_internal(ca, path, src, len, dst, 0,\n-\t\t\t\t\t\t   meta, dco);\n+\treturn convert_to_working_tree_ca_internal(repo, ca, path, src, len,\n+\t\t\t\t\t\t   dst, 0, meta, dco);\n }\n \n-int convert_to_working_tree_ca(struct repository *repo UNUSED,\n+int convert_to_working_tree_ca(struct repository *repo,\n \t\t\t       const struct conv_attrs *ca,\n \t\t\t       const char *path, const char *src,\n \t\t\t       size_t len, struct strbuf *dst,\n \t\t\t       const struct checkout_metadata *meta)\n {\n-\treturn convert_to_working_tree_ca_internal(ca, path, src, len, dst, 0,\n-\t\t\t\t\t\t   meta, NULL);\n+\treturn convert_to_working_tree_ca_internal(repo, ca, path, src, len,\n+\t\t\t\t\t\t   dst, 0, meta, NULL);\n }\n \n int convert_to_working_tree(struct index_state *istate,\n@@ -1570,12 +1582,14 @@ int async_convert_to_working_tree(struct index_state *istate,\n int renormalize_buffer(struct index_state *istate, const char *path,\n \t\t       const char *src, size_t len, struct strbuf *dst)\n {\n+\tstruct repository *repo = istate && istate->repo ?\n+\t\t\t\t  istate->repo : the_repository;\n \tstruct conv_attrs ca;\n \tint ret;\n \n \tconvert_attrs(istate, &ca, path);\n-\tret = convert_to_working_tree_ca_internal(&ca, path, src, len, dst, 1,\n-\t\t\t\t\t\t  NULL, NULL);\n+\tret = convert_to_working_tree_ca_internal(repo, &ca, path, src, len,\n+\t\t\t\t\t\t  dst, 1, NULL, NULL);\n \tif (ret) {\n \t\tsrc = dst->buf;\n \t\tlen = dst->len;\n@@ -2009,7 +2023,7 @@ static struct stream_filter *ident_filter(const struct object_id *oid)\n  * Note that you would be crazy to set CRLF, smudge/clean or ident to a\n  * large binary blob you would want us not to slurp into the memory!\n  */\n-struct stream_filter *get_stream_filter_ca(struct repository *repo UNUSED,\n+struct stream_filter *get_stream_filter_ca(struct repository *repo,\n \t\t\t\t\t   const struct conv_attrs *ca,\n \t\t\t\t\t   const struct object_id *oid)\n {\n@@ -2021,7 +2035,7 @@ struct stream_filter *get_stream_filter_ca(struct repository *repo UNUSED,\n \tif (ca->ident)\n \t\tfilter = ident_filter(oid);\n \n-\tif (output_eol(ca->crlf_action) == EOL_CRLF)\n+\tif (output_eol(repo, ca->crlf_action) == EOL_CRLF)\n \t\tfilter = cascade_filter(filter, lf_to_crlf_filter());\n \telse\n \t\tfilter = cascade_filter(filter, &null_filter_singleton);\ndiff --git a/convert.h b/convert.h\nindex 137fa1593a..dae11d372d 100644\n--- a/convert.h\n+++ b/convert.h\n@@ -19,14 +19,6 @@ struct strbuf;\n \n extern int global_conv_flags_eol;\n \n-enum auto_crlf {\n-\tAUTO_CRLF_FALSE = 0,\n-\tAUTO_CRLF_TRUE = 1,\n-\tAUTO_CRLF_INPUT = -1\n-};\n-\n-extern enum auto_crlf auto_crlf;\n-\n enum eol {\n \tEOL_UNSET,\n \tEOL_CRLF,\ndiff --git a/environment.c b/environment.c\nindex c83cf44839..bbac8ed8c9 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -49,7 +49,6 @@ int fsync_object_files = -1;\n int use_fsync = -1;\n enum fsync_method fsync_method = FSYNC_METHOD_DEFAULT;\n enum fsync_component fsync_components = FSYNC_COMPONENTS_DEFAULT;\n-enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;\n enum eol core_eol = EOL_UNSET;\n int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n char *check_roundtrip_encoding;\n@@ -152,6 +151,13 @@ int repo_has_symlinks(struct repository *repo)\n \t\t: platform_has_symlinks();\n }\n \n+enum auto_crlf repo_auto_crlf(struct repository *repo)\n+{\n+\treturn repo->initialized\n+\t\t? repo_config_values(repo)->auto_crlf\n+\t\t: AUTO_CRLF_FALSE;\n+}\n+\n const char *repo_excludes_file(struct repository *repo)\n {\n \tstruct repo_config_values *cfg = repo_config_values(repo);\n@@ -420,10 +426,10 @@ int git_default_core_config(const char *var, const char *value,\n \n \tif (!strcmp(var, \"core.autocrlf\")) {\n \t\tif (value && !strcasecmp(value, \"input\")) {\n-\t\t\tauto_crlf = AUTO_CRLF_INPUT;\n+\t\t\tcfg->auto_crlf = AUTO_CRLF_INPUT;\n \t\t\treturn 0;\n \t\t}\n-\t\tauto_crlf = git_config_bool(var, value);\n+\t\tcfg->auto_crlf = git_config_bool(var, value);\n \t\treturn 0;\n \t}\n \n@@ -777,6 +783,7 @@ void repo_config_values_init(struct repo_config_values *cfg)\n \tcfg->trust_executable_bit = 1;\n \tcfg->has_symlinks = platform_has_symlinks();\n \tcfg->use_nanosec = 0;\n+\tcfg->auto_crlf = AUTO_CRLF_FALSE;\n \n \t/* section \"sparse\" config values */\n \tcfg->sparse_expect_files_outside_of_patterns = 0;\ndiff --git a/environment.h b/environment.h\nindex 49c86e8879..872da3576b 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -123,6 +123,12 @@ enum object_creation_mode {\n \tOBJECT_CREATION_USES_RENAMES = 1\n };\n \n+enum auto_crlf {\n+\tAUTO_CRLF_FALSE = 0,\n+\tAUTO_CRLF_TRUE = 1,\n+\tAUTO_CRLF_INPUT = -1\n+};\n+\n struct repo_config_values {\n \t/* section \"core\" config values */\n \tchar *attributes_file;\n@@ -149,6 +155,7 @@ struct repo_config_values {\n \tint trust_executable_bit;\n \tint has_symlinks;\n \tint use_nanosec;\n+\tenum auto_crlf auto_crlf;\n \n \t/* section \"sparse\" config values */\n \tint sparse_expect_files_outside_of_patterns;\n@@ -203,6 +210,8 @@ int repo_trust_executable_bit(struct repository *repo);\n \n int repo_has_symlinks(struct repository *repo);\n \n+enum auto_crlf repo_auto_crlf(struct repository *repo);\n+\n const char *repo_excludes_file(struct repository *repo);\n \n void repo_config_values_init(struct repo_config_values *cfg);\n-- \n2.43.0\n\n\n"},{"id":"556193","messageId":"20261024220012.486-4-aniketgupta3001@gmail.com","threadId":"66655","inReplyTo":"20261024220012.486-1-aniketgupta3001@gmail.com","subject":"[PATCH 3/4] environment: move core_eol into repo_config_values","fromName":"Aniket Gupta","fromEmail":"aniketgupta3001@gmail.com","sentAt":"2026-10-24T22:00:11Z","receivedAt":"2026-10-24T22:00:11Z","isPatch":true,"sender":{"key":"aniketgupta3001@gmail.com","avatar":null},"body":"The global variable 'core_eol' holds the value of the 'core.eol'\nconfiguration, which sets the line ending used for files that are\nconverted to the working tree format. Move it into 'struct\nrepo_config_values' to continue the libification effort.\n\nAs with 'enum auto_crlf', moving 'enum eol' to 'convert.h' would\nintroduce a circular dependency chain:\n\n  convert.h -> hash.h -> repository.h -> environment.h.\n\nTherefore, keep the enum definition in 'environment.h' next to the\nother ones, under the existing NEEDSWORK comment. Initialize the\nper-repository value to its default in 'repo_config_values_init()'.\n\nModify the configuration parsing in environment.c to update the\nper-repository structure directly, and introduce the getter\n'repo_core_eol()' to read the value in 'convert.c'.\n\nSigned-off-by: Aniket Gupta <aniketgupta3001@gmail.com>\n---\n convert.c     |  6 +++---\n convert.h     | 12 ------------\n environment.c | 17 ++++++++++++-----\n environment.h | 14 ++++++++++++++\n 4 files changed, 29 insertions(+), 20 deletions(-)\n\ndiff --git a/convert.c b/convert.c\nindex 7c7fdd4b2d..1d4e8a246b 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -164,9 +164,9 @@ static int text_eol_is_crlf(struct repository *repo)\n \t\treturn 1;\n \telse if (repo_auto_crlf(repo) == AUTO_CRLF_INPUT)\n \t\treturn 0;\n-\tif (core_eol == EOL_CRLF)\n+\tif (repo_core_eol(repo) == EOL_CRLF)\n \t\treturn 1;\n-\tif (core_eol == EOL_UNSET && EOL_NATIVE == EOL_CRLF)\n+\tif (repo_core_eol(repo) == EOL_UNSET && EOL_NATIVE == EOL_CRLF)\n \t\treturn 1;\n \treturn 0;\n }\n@@ -192,7 +192,7 @@ static enum eol output_eol(struct repository *repo,\n \t\treturn text_eol_is_crlf(repo) ? EOL_CRLF : EOL_LF;\n \t}\n \twarning(_(\"illegal crlf_action %d\"), (int)crlf_action);\n-\treturn core_eol;\n+\treturn repo_core_eol(repo);\n }\n \n static void check_global_conv_flags_eol(const char *path,\ndiff --git a/convert.h b/convert.h\nindex dae11d372d..3c51130177 100644\n--- a/convert.h\n+++ b/convert.h\n@@ -19,17 +19,6 @@ struct strbuf;\n \n extern int global_conv_flags_eol;\n \n-enum eol {\n-\tEOL_UNSET,\n-\tEOL_CRLF,\n-\tEOL_LF,\n-#ifdef NATIVE_CRLF\n-\tEOL_NATIVE = EOL_CRLF\n-#else\n-\tEOL_NATIVE = EOL_LF\n-#endif\n-};\n-\n enum ce_delay_state {\n \tCE_NO_DELAY = 0,\n \tCE_CAN_DELAY = 1,\n@@ -84,7 +73,6 @@ struct conv_attrs {\n void convert_attrs(struct index_state *istate,\n \t\t   struct conv_attrs *ca, const char *path);\n \n-extern enum eol core_eol;\n extern char *check_roundtrip_encoding;\n const char *get_cached_convert_stats_ascii(struct index_state *istate,\n \t\t\t\t\t   const char *path);\ndiff --git a/environment.c b/environment.c\nindex bbac8ed8c9..6445994986 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -49,7 +49,6 @@ int fsync_object_files = -1;\n int use_fsync = -1;\n enum fsync_method fsync_method = FSYNC_METHOD_DEFAULT;\n enum fsync_component fsync_components = FSYNC_COMPONENTS_DEFAULT;\n-enum eol core_eol = EOL_UNSET;\n int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n char *check_roundtrip_encoding;\n #ifndef OBJECT_CREATION_MODE\n@@ -158,6 +157,13 @@ enum auto_crlf repo_auto_crlf(struct repository *repo)\n \t\t: AUTO_CRLF_FALSE;\n }\n \n+enum eol repo_core_eol(struct repository *repo)\n+{\n+\treturn repo->initialized\n+\t\t? repo_config_values(repo)->core_eol\n+\t\t: EOL_UNSET;\n+}\n+\n const char *repo_excludes_file(struct repository *repo)\n {\n \tstruct repo_config_values *cfg = repo_config_values(repo);\n@@ -447,13 +453,13 @@ int git_default_core_config(const char *var, const char *value,\n \n \tif (!strcmp(var, \"core.eol\")) {\n \t\tif (value && !strcasecmp(value, \"lf\"))\n-\t\t\tcore_eol = EOL_LF;\n+\t\t\tcfg->core_eol = EOL_LF;\n \t\telse if (value && !strcasecmp(value, \"crlf\"))\n-\t\t\tcore_eol = EOL_CRLF;\n+\t\t\tcfg->core_eol = EOL_CRLF;\n \t\telse if (value && !strcasecmp(value, \"native\"))\n-\t\t\tcore_eol = EOL_NATIVE;\n+\t\t\tcfg->core_eol = EOL_NATIVE;\n \t\telse\n-\t\t\tcore_eol = EOL_UNSET;\n+\t\t\tcfg->core_eol = EOL_UNSET;\n \t\treturn 0;\n \t}\n \n@@ -784,6 +790,7 @@ void repo_config_values_init(struct repo_config_values *cfg)\n \tcfg->has_symlinks = platform_has_symlinks();\n \tcfg->use_nanosec = 0;\n \tcfg->auto_crlf = AUTO_CRLF_FALSE;\n+\tcfg->core_eol = EOL_UNSET;\n \n \t/* section \"sparse\" config values */\n \tcfg->sparse_expect_files_outside_of_patterns = 0;\ndiff --git a/environment.h b/environment.h\nindex 872da3576b..bf6701560d 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -129,6 +129,17 @@ enum auto_crlf {\n \tAUTO_CRLF_INPUT = -1\n };\n \n+enum eol {\n+\tEOL_UNSET,\n+\tEOL_CRLF,\n+\tEOL_LF,\n+#ifdef NATIVE_CRLF\n+\tEOL_NATIVE = EOL_CRLF\n+#else\n+\tEOL_NATIVE = EOL_LF\n+#endif\n+};\n+\n struct repo_config_values {\n \t/* section \"core\" config values */\n \tchar *attributes_file;\n@@ -156,6 +167,7 @@ struct repo_config_values {\n \tint has_symlinks;\n \tint use_nanosec;\n \tenum auto_crlf auto_crlf;\n+\tenum eol core_eol;\n \n \t/* section \"sparse\" config values */\n \tint sparse_expect_files_outside_of_patterns;\n@@ -212,6 +224,8 @@ int repo_has_symlinks(struct repository *repo);\n \n enum auto_crlf repo_auto_crlf(struct repository *repo);\n \n+enum eol repo_core_eol(struct repository *repo);\n+\n const char *repo_excludes_file(struct repository *repo);\n \n void repo_config_values_init(struct repo_config_values *cfg);\n-- \n2.43.0\n\n\n"},{"id":"556194","messageId":"20261024220012.486-5-aniketgupta3001@gmail.com","threadId":"66655","inReplyTo":"20261024220012.486-1-aniketgupta3001@gmail.com","subject":"[PATCH 4/4] environment: move global_conv_flags_eol into repo_config_values","fromName":"Aniket Gupta","fromEmail":"aniketgupta3001@gmail.com","sentAt":"2026-10-24T22:00:12Z","receivedAt":"2026-10-24T22:00:12Z","isPatch":true,"sender":{"key":"aniketgupta3001@gmail.com","avatar":null},"body":"The global variable 'global_conv_flags_eol' holds the value of the\n'core.safecrlf' configuration, which controls whether Git warns or\nrefuses to proceed when converting line endings would not be\nreversible. Move it into 'struct repo_config_values' to continue the\nlibification effort.\n\nInitialize the per-repository value to its default in\n'repo_config_values_init()', and modify the configuration parsing in\nenvironment.c to update the per-repository structure directly.\n\nTo read the value, introduce the getter 'repo_global_conv_flags_eol()'\nand update its users in diff.c, combine-diff.c and object-file.c. In\nobject-file.c, pass the index to get_conv_flags() so that it can find\nthe repository.\n\nSigned-off-by: Aniket Gupta <aniketgupta3001@gmail.com>\n---\n combine-diff.c |  4 +++-\n convert.h      |  2 --\n diff.c         |  2 +-\n environment.c  | 13 ++++++++++---\n environment.h  |  3 +++\n object-file.c  | 11 +++++++----\n 6 files changed, 24 insertions(+), 11 deletions(-)\n\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 717d537688..c77990aacf 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -1098,9 +1098,11 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,\n \t\t\t/* If not a fake symlink, apply filters, e.g. autocrlf */\n \t\t\tif (is_file) {\n \t\t\t\tstruct strbuf buf = STRBUF_INIT;\n+\t\t\t\tint conv_flags =\n+\t\t\t\t\trepo_global_conv_flags_eol(rev->diffopt.repo);\n \n \t\t\t\tif (convert_to_git(rev->diffopt.repo->index,\n-\t\t\t\t\t\t   elem->path, result, len, &buf, global_conv_flags_eol)) {\n+\t\t\t\t\t\t   elem->path, result, len, &buf, conv_flags)) {\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/convert.h b/convert.h\nindex 3c51130177..18be39ca90 100644\n--- a/convert.h\n+++ b/convert.h\n@@ -17,8 +17,6 @@ struct strbuf;\n #define CONV_EOL_KEEP_CRLF    (1<<3) /* Keep CRLF line endings as is */\n #define CONV_WRITE_OBJECT     (1<<4) /* Content is written to the index */\n \n-extern int global_conv_flags_eol;\n-\n enum ce_delay_state {\n \tCE_NO_DELAY = 0,\n \tCE_CAN_DELAY = 1,\ndiff --git a/diff.c b/diff.c\nindex b4ac17f8ef..7eb45160c2 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -4480,7 +4480,7 @@ int diff_populate_filespec(struct repository *r,\n \tint size_only = options ? options->check_size_only : 0;\n \tint check_binary = options ? options->check_binary : 0;\n \tint err = 0;\n-\tint conv_flags = global_conv_flags_eol;\n+\tint conv_flags = repo_global_conv_flags_eol(r);\n \t/*\n \t * demote FAIL to WARN to allow inspecting the situation\n \t * instead of refusing.\ndiff --git a/environment.c b/environment.c\nindex 6445994986..9b98b3b075 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -49,7 +49,6 @@ int fsync_object_files = -1;\n int use_fsync = -1;\n enum fsync_method fsync_method = FSYNC_METHOD_DEFAULT;\n enum fsync_component fsync_components = FSYNC_COMPONENTS_DEFAULT;\n-int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n char *check_roundtrip_encoding;\n #ifndef OBJECT_CREATION_MODE\n #define OBJECT_CREATION_MODE OBJECT_CREATION_USES_HARDLINKS\n@@ -164,6 +163,13 @@ enum eol repo_core_eol(struct repository *repo)\n \t\t: EOL_UNSET;\n }\n \n+int repo_global_conv_flags_eol(struct repository *repo)\n+{\n+\treturn repo->initialized\n+\t\t? repo_config_values(repo)->global_conv_flags_eol\n+\t\t: CONV_EOL_RNDTRP_WARN;\n+}\n+\n const char *repo_excludes_file(struct repository *repo)\n {\n \tstruct repo_config_values *cfg = repo_config_values(repo);\n@@ -442,11 +448,11 @@ int git_default_core_config(const char *var, const char *value,\n \tif (!strcmp(var, \"core.safecrlf\")) {\n \t\tint eol_rndtrp_die;\n \t\tif (value && !strcasecmp(value, \"warn\")) {\n-\t\t\tglobal_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n+\t\t\tcfg->global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n \t\t\treturn 0;\n \t\t}\n \t\teol_rndtrp_die = git_config_bool(var, value);\n-\t\tglobal_conv_flags_eol = eol_rndtrp_die ?\n+\t\tcfg->global_conv_flags_eol = eol_rndtrp_die ?\n \t\t\tCONV_EOL_RNDTRP_DIE : 0;\n \t\treturn 0;\n \t}\n@@ -791,6 +797,7 @@ void repo_config_values_init(struct repo_config_values *cfg)\n \tcfg->use_nanosec = 0;\n \tcfg->auto_crlf = AUTO_CRLF_FALSE;\n \tcfg->core_eol = EOL_UNSET;\n+\tcfg->global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;\n \n \t/* section \"sparse\" config values */\n \tcfg->sparse_expect_files_outside_of_patterns = 0;\ndiff --git a/environment.h b/environment.h\nindex bf6701560d..47d7a9792d 100644\n--- a/environment.h\n+++ b/environment.h\n@@ -168,6 +168,7 @@ struct repo_config_values {\n \tint use_nanosec;\n \tenum auto_crlf auto_crlf;\n \tenum eol core_eol;\n+\tint global_conv_flags_eol;\n \n \t/* section \"sparse\" config values */\n \tint sparse_expect_files_outside_of_patterns;\n@@ -226,6 +227,8 @@ enum auto_crlf repo_auto_crlf(struct repository *repo);\n \n enum eol repo_core_eol(struct repository *repo);\n \n+int repo_global_conv_flags_eol(struct repository *repo);\n+\n const char *repo_excludes_file(struct repository *repo);\n \n void repo_config_values_init(struct repo_config_values *cfg);\ndiff --git a/object-file.c b/object-file.c\nindex c049bf13f7..b3ab8f5bcb 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -33,12 +33,15 @@\n #include \"tempfile.h\"\n #include \"tmp-objdir.h\"\n \n-static int get_conv_flags(unsigned flags)\n+static int get_conv_flags(struct index_state *istate, unsigned flags)\n {\n+\tstruct repository *repo = istate && istate->repo ?\n+\t\t\t\t  istate->repo : the_repository;\n+\n \tif (flags & INDEX_RENORMALIZE)\n \t\treturn CONV_EOL_RENORMALIZE;\n \telse if (flags & INDEX_WRITE_OBJECT)\n-\t\treturn global_conv_flags_eol | CONV_WRITE_OBJECT;\n+\t\treturn repo_global_conv_flags_eol(repo) | CONV_WRITE_OBJECT;\n \telse\n \t\treturn 0;\n }\n@@ -576,7 +579,7 @@ static int index_mem(struct index_state *istate,\n \t */\n \tif ((type == OBJ_BLOB) && path) {\n \t\tif (convert_to_git(istate, path, buf, size, &nbuf,\n-\t\t\t\t   get_conv_flags(flags))) {\n+\t\t\t\t   get_conv_flags(istate, flags))) {\n \t\t\tbuf = nbuf.buf;\n \t\t\tsize = nbuf.len;\n \t\t}\n@@ -615,7 +618,7 @@ static int index_stream_convert_blob(struct index_state *istate,\n \tASSERT(would_convert_to_git_filter_fd(istate, path));\n \n \tconvert_to_git_filter_fd(istate, path, fd, &sbuf,\n-\t\t\t\t get_conv_flags(flags));\n+\t\t\t\t get_conv_flags(istate, flags));\n \n \tif (write_object)\n \t\tret = odb_write_object(istate->repo->objects, sbuf.buf, sbuf.len, OBJ_BLOB,\n-- \n2.43.0\n\n\n"},{"id":"556330","messageId":"at9HOXZhVcl53CGX@pks.im","threadId":"66655","inReplyTo":"20261024220012.486-1-aniketgupta3001@gmail.com","subject":"Re: [PATCH 0/4] environment: move line ending config variables into repo_config_values","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-10-26T12:27:37Z","receivedAt":"2026-10-26T12:27:37Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Hi,\n\nOn Sat, Oct 24, 2026 at 10:00:08PM +0000, Aniket Gupta wrote:\n> Hi,\n> \n> This series moves the global variables behind core.autocrlf, core.eol\n> and core.safecrlf into 'struct repo_config_values' to continue the\n> libification effort.\n> \n> The first patch passes 'repo' to the working tree conversion\n> functions which need it to read the values. The other three move one\n> variable each just like the earlier conversions.\n> \n> An alternative to passing 'repo' would be to store the resolved values\n> in 'struct conv_attrs'. I went with passing it since that is what the\n> earlier conversions did, but I can change it if you prefer.\n\nThis isn't really your fault, but we've had the discussion multiple\ntimes by now that we need to stop moving more config values into\n`repo_config_values` until we have a way for how to decouple it from\n`the_repository`. The problem here is that the only way to populate\nthose settings is via `repo_config(git_default_config)`, and that\nfunction will populate the repo config values of `the_repository`.\nConsequently, `repo_config_values()` BUGs when called with a different\nrepostiory.\n\nWhile these patches _look_ like they libify Git more, they actually do\nthe exact opposite right now and tie us more and more to\n`the_repository`. So I'm inclined to say that we should hold off merging\nthese patches until we fix that issue, or otherwise we paint ourselves\ninto a corner.\n\nPatrick\n\n"},{"id":"556342","messageId":"20261026131023.408-1-aniketgupta3001@gmail.com","threadId":"66655","inReplyTo":"at9HOXZhVcl53CGX@pks.im","subject":"Re: [PATCH 0/4] environment: move line ending config variables into repo_config_values","fromName":"Aniket Gupta","fromEmail":"aniketgupta3001@gmail.com","sentAt":"2026-10-26T13:10:23Z","receivedAt":"2026-10-26T13:10:23Z","isPatch":true,"sender":{"key":"aniketgupta3001@gmail.com","avatar":null},"body":"Hi Patrick,\n\nThanks for the explanation. I was not aware of this and will hold off.\nIs there any thread or branch about decoupling that I could read? I\nwould love to contribute to it if I can.\n\n"},{"id":"556345","messageId":"at9U26GJKmbHAAg0@pks.im","threadId":"66655","inReplyTo":"20261026131023.408-1-aniketgupta3001@gmail.com","subject":"Re: [PATCH 0/4] environment: move line ending config variables into repo_config_values","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-10-26T13:25:47Z","receivedAt":"2026-10-26T13:25:47Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"Hey Aniket,\n\nOn Mon, Oct 26, 2026 at 01:10:23PM +0000, Aniket Gupta wrote:\n> Hi Patrick,\n> \n> Thanks for the explanation. I was not aware of this and will hold off.\n> Is there any thread or branch about decoupling that I could read? I\n> would love to contribute to it if I can.\n\nSorry, I should have provided a reference right from the start. I think\n<xmqq8q5n1fa2.fsf@gitster.g> is where we discussed this most in-depth.\n\nThanks!\n\nPatrick\n\n"},{"id":"556366","messageId":"xmqq4ie8tq3u.fsf@gitster.g","threadId":"66655","inReplyTo":"at9HOXZhVcl53CGX@pks.im","subject":"Re: [PATCH 0/4] environment: move line ending config variables into repo_config_values","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-10-26T15:53:57Z","receivedAt":"2026-10-26T15:53:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> While these patches _look_ like they libify Git more, they actually do\n> the exact opposite right now and tie us more and more to\n> `the_repository`. So I'm inclined to say that we should hold off merging\n> these patches until we fix that issue, or otherwise we paint ourselves\n> into a corner.\n\nCould you please volunteer to add a quick patch to add a comment\nnext to the problematic structure to tell people stop moving things\nthere (for now) and point at the message I am responding to?\n\nThanks.\n\n"},{"id":"557269","messageId":"aumOHhbTVW0bT3We@pks.im","threadId":"66655","inReplyTo":"xmqq4ie8tq3u.fsf@gitster.g","subject":"Re: [PATCH 0/4] environment: move line ending config variables into repo_config_values","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-11-03T07:32:46Z","receivedAt":"2026-11-03T07:32:46Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Mon, Oct 26, 2026 at 08:53:57AM -0700, Junio C Hamano wrote:\n> Patrick Steinhardt <ps@pks.im> writes:\n> \n> > While these patches _look_ like they libify Git more, they actually do\n> > the exact opposite right now and tie us more and more to\n> > `the_repository`. So I'm inclined to say that we should hold off merging\n> > these patches until we fix that issue, or otherwise we paint ourselves\n> > into a corner.\n> \n> Could you please volunteer to add a quick patch to add a comment\n> next to the problematic structure to tell people stop moving things\n> there (for now) and point at the message I am responding to?\n\nSorry, I planned to do that but haven't yet gotten around to it. But I\nsee that you've sent it by now via [1]. Thanks!\n\nPatrick\n\n[1]: <xmqqh5hzjdwr.fsf_-_@gitster.g> \n\n"},{"id":"557335","messageId":"xmqq7bitc0hu.fsf@gitster.g","threadId":"66655","inReplyTo":"aumOHhbTVW0bT3We@pks.im","subject":"Re: [PATCH 0/4] environment: move line ending config variables into repo_config_values","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-11-03T17:01:49Z","receivedAt":"2026-11-03T17:01:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Patrick Steinhardt <ps@pks.im> writes:\n\n> On Mon, Oct 26, 2026 at 08:53:57AM -0700, Junio C Hamano wrote:\n>> Patrick Steinhardt <ps@pks.im> writes:\n>> \n>> > While these patches _look_ like they libify Git more, they actually do\n>> > the exact opposite right now and tie us more and more to\n>> > `the_repository`. So I'm inclined to say that we should hold off merging\n>> > these patches until we fix that issue, or otherwise we paint ourselves\n>> > into a corner.\n>> \n>> Could you please volunteer to add a quick patch to add a comment\n>> next to the problematic structure to tell people stop moving things\n>> there (for now) and point at the message I am responding to?\n>\n> Sorry, I planned to do that but haven't yet gotten around to it. But I\n> see that you've sent it by now via [1]. Thanks!\n\nAh, I completely forgot about this exchange when I did [1] myself.\nAnyway, I'll take it as an Acked-by for it.\n\nThanks.\n\n>\n> Patrick\n>\n> [1]: <xmqqh5hzjdwr.fsf_-_@gitster.g> \n\n\n"}]}