{"thread":{"id":"46161","subject":"[PATCH 0/4] config.h","startedAt":"2017-06-12T21:34:30Z","lastAt":"2017-06-16T00:12:43Z","messageCount":57,"participants":["Brandon Williams","Jeff King","Jonathan Nieder","Junio C Hamano","Jacob Keller"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"321999","messageId":"20170612213406.83247-1-bmwill@google.com","threadId":"46161","inReplyTo":null,"subject":"[PATCH 0/4] config.h","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-12T21:34:02Z","receivedAt":"2017-06-12T21:34:30Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"After some discussion I realized that my 'repository object' series was getting\nto be rather long and increase in scope.  So I've decided to break off these\ncouple patches into their own series so they can be reviewed more easily.  This\nshould also let them be merged in faster as I suspect it'll take a while for my\n'repository object' series to be reviewed thourouly and these couple patches\ncould result in a lot of merge conflicts as it touches a lot of files.\n\nBrandon Williams (4):\n  config: create config.h\n  config: remove git_config_iter\n  config: don't include config.h by default\n  config: don't implicitly use gitdir\n\n advice.c                         |   1 +\n alias.c                          |   1 +\n apply.c                          |   1 +\n archive-tar.c                    |   1 +\n archive-zip.c                    |   1 +\n archive.c                        |   1 +\n attr.c                           |   1 +\n bisect.c                         |   1 +\n branch.c                         |   1 +\n builtin/add.c                    |   1 +\n builtin/am.c                     |   1 +\n builtin/blame.c                  |   2 +\n builtin/branch.c                 |   1 +\n builtin/cat-file.c               |   1 +\n builtin/check-attr.c             |   1 +\n builtin/check-ignore.c           |   1 +\n builtin/check-mailmap.c          |   1 +\n builtin/checkout-index.c         |   1 +\n builtin/checkout.c               |   1 +\n builtin/clean.c                  |   1 +\n builtin/clone.c                  |   1 +\n builtin/column.c                 |   1 +\n builtin/commit-tree.c            |   1 +\n builtin/commit.c                 |   1 +\n builtin/config.c                 |   3 +\n builtin/count-objects.c          |   1 +\n builtin/describe.c               |   1 +\n builtin/diff-files.c             |   1 +\n builtin/diff-index.c             |   1 +\n builtin/diff-tree.c              |   1 +\n builtin/diff.c                   |   1 +\n builtin/difftool.c               |   1 +\n builtin/fast-export.c            |   1 +\n builtin/fetch.c                  |   1 +\n builtin/fmt-merge-msg.c          |   1 +\n builtin/for-each-ref.c           |   1 +\n builtin/fsck.c                   |   1 +\n builtin/gc.c                     |   1 +\n builtin/grep.c                   |   1 +\n builtin/hash-object.c            |   1 +\n builtin/help.c                   |   1 +\n builtin/index-pack.c             |   1 +\n builtin/init-db.c                |   1 +\n builtin/log.c                    |   1 +\n builtin/ls-files.c               |   1 +\n builtin/ls-tree.c                |   1 +\n builtin/merge-base.c             |   1 +\n builtin/merge-file.c             |   1 +\n builtin/merge.c                  |   1 +\n builtin/mv.c                     |   1 +\n builtin/name-rev.c               |   1 +\n builtin/notes.c                  |   1 +\n builtin/pack-objects.c           |   1 +\n builtin/patch-id.c               |   1 +\n builtin/pull.c                   |   1 +\n builtin/push.c                   |   1 +\n builtin/read-tree.c              |   1 +\n builtin/rebase--helper.c         |   1 +\n builtin/receive-pack.c           |   1 +\n builtin/reflog.c                 |   1 +\n builtin/remote.c                 |   1 +\n builtin/repack.c                 |   1 +\n builtin/replace.c                |   1 +\n builtin/rerere.c                 |   1 +\n builtin/reset.c                  |   1 +\n builtin/rev-list.c               |   1 +\n builtin/rev-parse.c              |   1 +\n builtin/revert.c                 |   1 +\n builtin/rm.c                     |   1 +\n builtin/send-pack.c              |   1 +\n builtin/shortlog.c               |   1 +\n builtin/show-branch.c            |   1 +\n builtin/stripspace.c             |   1 +\n builtin/submodule--helper.c      |   1 +\n builtin/symbolic-ref.c           |   1 +\n builtin/tag.c                    |   1 +\n builtin/unpack-file.c            |   1 +\n builtin/unpack-objects.c         |   1 +\n builtin/update-index.c           |   1 +\n builtin/update-ref.c             |   1 +\n builtin/update-server-info.c     |   1 +\n builtin/var.c                    |   1 +\n builtin/verify-commit.c          |   1 +\n builtin/verify-pack.c            |   1 +\n builtin/verify-tag.c             |   1 +\n builtin/worktree.c               |   1 +\n builtin/write-tree.c             |   1 +\n cache.h                          | 189 --------------------------------------\n color.c                          |   1 +\n column.c                         |   1 +\n config.c                         |   7 +-\n config.h                         | 193 +++++++++++++++++++++++++++++++++++++++\n connect.c                        |   1 +\n convert.c                        |   1 +\n credential-cache--daemon.c       |   1 +\n credential.c                     |   1 +\n daemon.c                         |   1 +\n diff.c                           |   1 +\n dir.c                            |   1 +\n environment.c                    |   1 +\n fast-import.c                    |   1 +\n fetch-pack.c                     |   1 +\n git.c                            |   1 +\n gpg-interface.c                  |   1 +\n graph.c                          |   1 +\n grep.c                           |   1 +\n help.c                           |   1 +\n http-backend.c                   |   1 +\n http-fetch.c                     |   1 +\n http.c                           |   1 +\n ident.c                          |   1 +\n imap-send.c                      |   1 +\n ll-merge.c                       |   1 +\n log-tree.c                       |   1 +\n mailinfo.c                       |   1 +\n merge-recursive.c                |   1 +\n notes-utils.c                    |   1 +\n notes.c                          |   1 +\n pager.c                          |   1 +\n parse-options.c                  |   1 +\n pathspec.c                       |   1 +\n pretty.c                         |   1 +\n prompt.c                         |   1 +\n read-cache.c                     |   1 +\n refs.c                           |   1 +\n refs/files-backend.c             |   1 +\n remote-curl.c                    |   1 +\n remote.c                         |   1 +\n rerere.c                         |   1 +\n send-pack.c                      |   1 +\n sequencer.c                      |   1 +\n setup.c                          |   1 +\n sha1_file.c                      |   1 +\n sha1_name.c                      |   1 +\n submodule-config.c               |   1 +\n submodule.c                      |   1 +\n t/helper/test-config.c           |   1 +\n t/helper/test-submodule-config.c |   1 +\n trailer.c                        |   1 +\n transport.c                      |   1 +\n unpack-trees.c                   |   1 +\n upload-pack.c                    |   1 +\n userdiff.c                       |   1 +\n versioncmp.c                     |   1 +\n wrapper.c                        |   1 +\n xdiff-interface.c                |   1 +\n 146 files changed, 342 insertions(+), 193 deletions(-)\n create mode 100644 config.h\n\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322000","messageId":"20170612213406.83247-2-bmwill@google.com","threadId":"46161","inReplyTo":"20170612213406.83247-1-bmwill@google.com","subject":"[PATCH 1/4] config: create config.h","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-12T21:34:03Z","receivedAt":"2017-06-12T21:34:33Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Move all config related declarations from cache.h to a new config.h\nheader file.  This makes cache.h smaller and allows for the opportunity\nin a following patch to only include config.h when needed.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n cache.h  | 190 +------------------------------------------------------------\n config.h | 194 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 195 insertions(+), 189 deletions(-)\n create mode 100644 config.h\n\ndiff --git a/cache.h b/cache.h\nindex 4d92aae0e..ed56f8818 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -11,6 +11,7 @@\n #include \"string-list.h\"\n #include \"pack-revindex.h\"\n #include \"hash.h\"\n+#include \"config.h\"\n \n #ifndef platform_SHA_CTX\n /*\n@@ -1872,188 +1873,9 @@ extern int packed_object_info(struct packed_git *pack, off_t offset, struct obje\n /* Dumb servers support */\n extern int update_server_info(int);\n \n-/* git_config_parse_key() returns these negated: */\n-#define CONFIG_INVALID_KEY 1\n-#define CONFIG_NO_SECTION_OR_NAME 2\n-/* git_config_set_gently(), git_config_set_multivar_gently() return the above or these: */\n-#define CONFIG_NO_LOCK -1\n-#define CONFIG_INVALID_FILE 3\n-#define CONFIG_NO_WRITE 4\n-#define CONFIG_NOTHING_SET 5\n-#define CONFIG_INVALID_PATTERN 6\n-#define CONFIG_GENERIC_ERROR 7\n-\n-#define CONFIG_REGEX_NONE ((void *)1)\n-\n-struct git_config_source {\n-\tunsigned int use_stdin:1;\n-\tconst char *file;\n-\tconst char *blob;\n-};\n-\n-enum config_origin_type {\n-\tCONFIG_ORIGIN_BLOB,\n-\tCONFIG_ORIGIN_FILE,\n-\tCONFIG_ORIGIN_STDIN,\n-\tCONFIG_ORIGIN_SUBMODULE_BLOB,\n-\tCONFIG_ORIGIN_CMDLINE\n-};\n-\n-struct config_options {\n-\tunsigned int respect_includes : 1;\n-\tconst char *git_dir;\n-};\n-\n-typedef int (*config_fn_t)(const char *, const char *, void *);\n-extern int git_default_config(const char *, const char *, void *);\n-extern int git_config_from_file(config_fn_t fn, const char *, void *);\n-extern int git_config_from_mem(config_fn_t fn, const enum config_origin_type,\n-\t\t\t\t\tconst char *name, const char *buf, size_t len, void *data);\n-extern int git_config_from_blob_sha1(config_fn_t fn, const char *name,\n-\t\t\t\t     const unsigned char *sha1, void *data);\n-extern void git_config_push_parameter(const char *text);\n-extern int git_config_from_parameters(config_fn_t fn, void *data);\n-extern void read_early_config(config_fn_t cb, void *data);\n-extern void git_config(config_fn_t fn, void *);\n-extern int git_config_with_options(config_fn_t fn, void *,\n-\t\t\t\t   struct git_config_source *config_source,\n-\t\t\t\t   const struct config_options *opts);\n-extern int git_parse_ulong(const char *, unsigned long *);\n-extern int git_parse_maybe_bool(const char *);\n-extern int git_config_int(const char *, const char *);\n-extern int64_t git_config_int64(const char *, const char *);\n-extern unsigned long git_config_ulong(const char *, const char *);\n-extern ssize_t git_config_ssize_t(const char *, const char *);\n-extern int git_config_bool_or_int(const char *, const char *, int *);\n-extern int git_config_bool(const char *, const char *);\n-extern int git_config_maybe_bool(const char *, const char *);\n-extern int git_config_string(const char **, const char *, const char *);\n-extern int git_config_pathname(const char **, const char *, const char *);\n-extern int git_config_set_in_file_gently(const char *, const char *, const char *);\n-extern void git_config_set_in_file(const char *, const char *, const char *);\n-extern int git_config_set_gently(const char *, const char *);\n-extern void git_config_set(const char *, const char *);\n-extern int git_config_parse_key(const char *, char **, int *);\n-extern int git_config_key_is_valid(const char *key);\n-extern int git_config_set_multivar_gently(const char *, const char *, const char *, int);\n-extern void git_config_set_multivar(const char *, const char *, const char *, int);\n-extern int git_config_set_multivar_in_file_gently(const char *, const char *, const char *, const char *, int);\n-extern void git_config_set_multivar_in_file(const char *, const char *, const char *, const char *, int);\n-extern int git_config_rename_section(const char *, const char *);\n-extern int git_config_rename_section_in_file(const char *, const char *, const char *);\n-extern const char *git_etc_gitconfig(void);\n-extern int git_env_bool(const char *, int);\n-extern unsigned long git_env_ulong(const char *, unsigned long);\n-extern int git_config_system(void);\n-extern int config_error_nonbool(const char *);\n-#if defined(__GNUC__)\n-#define config_error_nonbool(s) (config_error_nonbool(s), const_error())\n-#endif\n extern const char *get_log_output_encoding(void);\n extern const char *get_commit_output_encoding(void);\n \n-extern int git_config_parse_parameter(const char *, config_fn_t fn, void *data);\n-\n-enum config_scope {\n-\tCONFIG_SCOPE_UNKNOWN = 0,\n-\tCONFIG_SCOPE_SYSTEM,\n-\tCONFIG_SCOPE_GLOBAL,\n-\tCONFIG_SCOPE_REPO,\n-\tCONFIG_SCOPE_CMDLINE,\n-};\n-\n-extern enum config_scope current_config_scope(void);\n-extern const char *current_config_origin_type(void);\n-extern const char *current_config_name(void);\n-\n-struct config_include_data {\n-\tint depth;\n-\tconfig_fn_t fn;\n-\tvoid *data;\n-\tconst struct config_options *opts;\n-};\n-#define CONFIG_INCLUDE_INIT { 0 }\n-extern int git_config_include(const char *name, const char *value, void *data);\n-\n-/*\n- * Match and parse a config key of the form:\n- *\n- *   section.(subsection.)?key\n- *\n- * (i.e., what gets handed to a config_fn_t). The caller provides the section;\n- * we return -1 if it does not match, 0 otherwise. The subsection and key\n- * out-parameters are filled by the function (and *subsection is NULL if it is\n- * missing).\n- *\n- * If the subsection pointer-to-pointer passed in is NULL, returns 0 only if\n- * there is no subsection at all.\n- */\n-extern int parse_config_key(const char *var,\n-\t\t\t    const char *section,\n-\t\t\t    const char **subsection, int *subsection_len,\n-\t\t\t    const char **key);\n-\n-struct config_set_element {\n-\tstruct hashmap_entry ent;\n-\tchar *key;\n-\tstruct string_list value_list;\n-};\n-\n-struct configset_list_item {\n-\tstruct config_set_element *e;\n-\tint value_index;\n-};\n-\n-/*\n- * the contents of the list are ordered according to their\n- * position in the config files and order of parsing the files.\n- * (i.e. key-value pair at the last position of .git/config will\n- * be at the last item of the list)\n- */\n-struct configset_list {\n-\tstruct configset_list_item *items;\n-\tunsigned int nr, alloc;\n-};\n-\n-struct config_set {\n-\tstruct hashmap config_hash;\n-\tint hash_initialized;\n-\tstruct configset_list list;\n-};\n-\n-extern void git_configset_init(struct config_set *cs);\n-extern int git_configset_add_file(struct config_set *cs, const char *filename);\n-extern int git_configset_get_value(struct config_set *cs, const char *key, const char **value);\n-extern const struct string_list *git_configset_get_value_multi(struct config_set *cs, const char *key);\n-extern void git_configset_clear(struct config_set *cs);\n-extern int git_configset_get_string_const(struct config_set *cs, const char *key, const char **dest);\n-extern int git_configset_get_string(struct config_set *cs, const char *key, char **dest);\n-extern int git_configset_get_int(struct config_set *cs, const char *key, int *dest);\n-extern int git_configset_get_ulong(struct config_set *cs, const char *key, unsigned long *dest);\n-extern int git_configset_get_bool(struct config_set *cs, const char *key, int *dest);\n-extern int git_configset_get_bool_or_int(struct config_set *cs, const char *key, int *is_bool, int *dest);\n-extern int git_configset_get_maybe_bool(struct config_set *cs, const char *key, int *dest);\n-extern int git_configset_get_pathname(struct config_set *cs, const char *key, const char **dest);\n-\n-extern int git_config_get_value(const char *key, const char **value);\n-extern const struct string_list *git_config_get_value_multi(const char *key);\n-extern void git_config_clear(void);\n-extern void git_config_iter(config_fn_t fn, void *data);\n-extern int git_config_get_string_const(const char *key, const char **dest);\n-extern int git_config_get_string(const char *key, char **dest);\n-extern int git_config_get_int(const char *key, int *dest);\n-extern int git_config_get_ulong(const char *key, unsigned long *dest);\n-extern int git_config_get_bool(const char *key, int *dest);\n-extern int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest);\n-extern int git_config_get_maybe_bool(const char *key, int *dest);\n-extern int git_config_get_pathname(const char *key, const char **dest);\n-extern int git_config_get_untracked_cache(void);\n-extern int git_config_get_split_index(void);\n-extern int git_config_get_max_percent_split_change(void);\n-\n-/* This dies if the configured or default date is in the future */\n-extern int git_config_get_expiry(const char *key, const char **output);\n-\n /*\n  * This is a hack for test programs like test-dump-untracked-cache to\n  * ensure that they do not modify the untracked cache when reading it.\n@@ -2061,16 +1883,6 @@ extern int git_config_get_expiry(const char *key, const char **output);\n  */\n extern int ignore_untracked_cache_config;\n \n-struct key_value_info {\n-\tconst char *filename;\n-\tint linenr;\n-\tenum config_origin_type origin_type;\n-\tenum config_scope scope;\n-};\n-\n-extern NORETURN void git_die_config(const char *key, const char *err, ...) __attribute__((format(printf, 2, 3)));\n-extern NORETURN void git_die_config_linenr(const char *key, const char *filename, int linenr);\n-\n extern int committer_ident_sufficiently_given(void);\n extern int author_ident_sufficiently_given(void);\n \ndiff --git a/config.h b/config.h\nnew file mode 100644\nindex 000000000..f7f8b66c5\n--- /dev/null\n+++ b/config.h\n@@ -0,0 +1,194 @@\n+#ifndef CONFIG_H\n+#define CONFIG_H\n+\n+/* git_config_parse_key() returns these negated: */\n+#define CONFIG_INVALID_KEY 1\n+#define CONFIG_NO_SECTION_OR_NAME 2\n+/* git_config_set_gently(), git_config_set_multivar_gently() return the above or these: */\n+#define CONFIG_NO_LOCK -1\n+#define CONFIG_INVALID_FILE 3\n+#define CONFIG_NO_WRITE 4\n+#define CONFIG_NOTHING_SET 5\n+#define CONFIG_INVALID_PATTERN 6\n+#define CONFIG_GENERIC_ERROR 7\n+\n+#define CONFIG_REGEX_NONE ((void *)1)\n+\n+struct git_config_source {\n+\tunsigned int use_stdin:1;\n+\tconst char *file;\n+\tconst char *blob;\n+};\n+\n+enum config_origin_type {\n+\tCONFIG_ORIGIN_BLOB,\n+\tCONFIG_ORIGIN_FILE,\n+\tCONFIG_ORIGIN_STDIN,\n+\tCONFIG_ORIGIN_SUBMODULE_BLOB,\n+\tCONFIG_ORIGIN_CMDLINE\n+};\n+\n+struct config_options {\n+\tunsigned int respect_includes : 1;\n+\tconst char *git_dir;\n+};\n+\n+typedef int (*config_fn_t)(const char *, const char *, void *);\n+extern int git_default_config(const char *, const char *, void *);\n+extern int git_config_from_file(config_fn_t fn, const char *, void *);\n+extern int git_config_from_mem(config_fn_t fn, const enum config_origin_type,\n+\t\t\t\t\tconst char *name, const char *buf, size_t len, void *data);\n+extern int git_config_from_blob_sha1(config_fn_t fn, const char *name,\n+\t\t\t\t     const unsigned char *sha1, void *data);\n+extern void git_config_push_parameter(const char *text);\n+extern int git_config_from_parameters(config_fn_t fn, void *data);\n+extern void read_early_config(config_fn_t cb, void *data);\n+extern void git_config(config_fn_t fn, void *);\n+extern int git_config_with_options(config_fn_t fn, void *,\n+\t\t\t\t   struct git_config_source *config_source,\n+\t\t\t\t   const struct config_options *opts);\n+extern int git_parse_ulong(const char *, unsigned long *);\n+extern int git_parse_maybe_bool(const char *);\n+extern int git_config_int(const char *, const char *);\n+extern int64_t git_config_int64(const char *, const char *);\n+extern unsigned long git_config_ulong(const char *, const char *);\n+extern ssize_t git_config_ssize_t(const char *, const char *);\n+extern int git_config_bool_or_int(const char *, const char *, int *);\n+extern int git_config_bool(const char *, const char *);\n+extern int git_config_maybe_bool(const char *, const char *);\n+extern int git_config_string(const char **, const char *, const char *);\n+extern int git_config_pathname(const char **, const char *, const char *);\n+extern int git_config_set_in_file_gently(const char *, const char *, const char *);\n+extern void git_config_set_in_file(const char *, const char *, const char *);\n+extern int git_config_set_gently(const char *, const char *);\n+extern void git_config_set(const char *, const char *);\n+extern int git_config_parse_key(const char *, char **, int *);\n+extern int git_config_key_is_valid(const char *key);\n+extern int git_config_set_multivar_gently(const char *, const char *, const char *, int);\n+extern void git_config_set_multivar(const char *, const char *, const char *, int);\n+extern int git_config_set_multivar_in_file_gently(const char *, const char *, const char *, const char *, int);\n+extern void git_config_set_multivar_in_file(const char *, const char *, const char *, const char *, int);\n+extern int git_config_rename_section(const char *, const char *);\n+extern int git_config_rename_section_in_file(const char *, const char *, const char *);\n+extern const char *git_etc_gitconfig(void);\n+extern int git_env_bool(const char *, int);\n+extern unsigned long git_env_ulong(const char *, unsigned long);\n+extern int git_config_system(void);\n+extern int config_error_nonbool(const char *);\n+#if defined(__GNUC__)\n+#define config_error_nonbool(s) (config_error_nonbool(s), const_error())\n+#endif\n+\n+extern int git_config_parse_parameter(const char *, config_fn_t fn, void *data);\n+\n+enum config_scope {\n+\tCONFIG_SCOPE_UNKNOWN = 0,\n+\tCONFIG_SCOPE_SYSTEM,\n+\tCONFIG_SCOPE_GLOBAL,\n+\tCONFIG_SCOPE_REPO,\n+\tCONFIG_SCOPE_CMDLINE,\n+};\n+\n+extern enum config_scope current_config_scope(void);\n+extern const char *current_config_origin_type(void);\n+extern const char *current_config_name(void);\n+\n+struct config_include_data {\n+\tint depth;\n+\tconfig_fn_t fn;\n+\tvoid *data;\n+\tconst struct config_options *opts;\n+};\n+#define CONFIG_INCLUDE_INIT { 0 }\n+extern int git_config_include(const char *name, const char *value, void *data);\n+\n+/*\n+ * Match and parse a config key of the form:\n+ *\n+ *   section.(subsection.)?key\n+ *\n+ * (i.e., what gets handed to a config_fn_t). The caller provides the section;\n+ * we return -1 if it does not match, 0 otherwise. The subsection and key\n+ * out-parameters are filled by the function (and *subsection is NULL if it is\n+ * missing).\n+ *\n+ * If the subsection pointer-to-pointer passed in is NULL, returns 0 only if\n+ * there is no subsection at all.\n+ */\n+extern int parse_config_key(const char *var,\n+\t\t\t    const char *section,\n+\t\t\t    const char **subsection, int *subsection_len,\n+\t\t\t    const char **key);\n+\n+struct config_set_element {\n+\tstruct hashmap_entry ent;\n+\tchar *key;\n+\tstruct string_list value_list;\n+};\n+\n+struct configset_list_item {\n+\tstruct config_set_element *e;\n+\tint value_index;\n+};\n+\n+/*\n+ * the contents of the list are ordered according to their\n+ * position in the config files and order of parsing the files.\n+ * (i.e. key-value pair at the last position of .git/config will\n+ * be at the last item of the list)\n+ */\n+struct configset_list {\n+\tstruct configset_list_item *items;\n+\tunsigned int nr, alloc;\n+};\n+\n+struct config_set {\n+\tstruct hashmap config_hash;\n+\tint hash_initialized;\n+\tstruct configset_list list;\n+};\n+\n+extern void git_configset_init(struct config_set *cs);\n+extern int git_configset_add_file(struct config_set *cs, const char *filename);\n+extern int git_configset_get_value(struct config_set *cs, const char *key, const char **value);\n+extern const struct string_list *git_configset_get_value_multi(struct config_set *cs, const char *key);\n+extern void git_configset_clear(struct config_set *cs);\n+extern int git_configset_get_string_const(struct config_set *cs, const char *key, const char **dest);\n+extern int git_configset_get_string(struct config_set *cs, const char *key, char **dest);\n+extern int git_configset_get_int(struct config_set *cs, const char *key, int *dest);\n+extern int git_configset_get_ulong(struct config_set *cs, const char *key, unsigned long *dest);\n+extern int git_configset_get_bool(struct config_set *cs, const char *key, int *dest);\n+extern int git_configset_get_bool_or_int(struct config_set *cs, const char *key, int *is_bool, int *dest);\n+extern int git_configset_get_maybe_bool(struct config_set *cs, const char *key, int *dest);\n+extern int git_configset_get_pathname(struct config_set *cs, const char *key, const char **dest);\n+\n+extern int git_config_get_value(const char *key, const char **value);\n+extern const struct string_list *git_config_get_value_multi(const char *key);\n+extern void git_config_clear(void);\n+extern void git_config_iter(config_fn_t fn, void *data);\n+extern int git_config_get_string_const(const char *key, const char **dest);\n+extern int git_config_get_string(const char *key, char **dest);\n+extern int git_config_get_int(const char *key, int *dest);\n+extern int git_config_get_ulong(const char *key, unsigned long *dest);\n+extern int git_config_get_bool(const char *key, int *dest);\n+extern int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest);\n+extern int git_config_get_maybe_bool(const char *key, int *dest);\n+extern int git_config_get_pathname(const char *key, const char **dest);\n+extern int git_config_get_untracked_cache(void);\n+extern int git_config_get_split_index(void);\n+extern int git_config_get_max_percent_split_change(void);\n+\n+/* This dies if the configured or default date is in the future */\n+extern int git_config_get_expiry(const char *key, const char **output);\n+\n+struct key_value_info {\n+\tconst char *filename;\n+\tint linenr;\n+\tenum config_origin_type origin_type;\n+\tenum config_scope scope;\n+};\n+\n+extern NORETURN void git_die_config(const char *key, const char *err, ...) __attribute__((format(printf, 2, 3)));\n+extern NORETURN void git_die_config_linenr(const char *key, const char *filename, int linenr);\n+\n+#endif /* CONFIG_H */\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322001","messageId":"20170612213406.83247-3-bmwill@google.com","threadId":"46161","inReplyTo":"20170612213406.83247-1-bmwill@google.com","subject":"[PATCH 2/4] config: remove git_config_iter","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-12T21:34:04Z","receivedAt":"2017-06-12T21:34:34Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Since there is no implementation of the function 'git_config_iter' lets\nstop exporting it and remove the prototype from config.h.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n config.h | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/config.h b/config.h\nindex f7f8b66c5..c70599bd5 100644\n--- a/config.h\n+++ b/config.h\n@@ -165,7 +165,6 @@ extern int git_configset_get_pathname(struct config_set *cs, const char *key, co\n extern int git_config_get_value(const char *key, const char **value);\n extern const struct string_list *git_config_get_value_multi(const char *key);\n extern void git_config_clear(void);\n-extern void git_config_iter(config_fn_t fn, void *data);\n extern int git_config_get_string_const(const char *key, const char **dest);\n extern int git_config_get_string(const char *key, char **dest);\n extern int git_config_get_int(const char *key, int *dest);\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322002","messageId":"20170612213406.83247-5-bmwill@google.com","threadId":"46161","inReplyTo":"20170612213406.83247-1-bmwill@google.com","subject":"[PATCH 4/4] config: don't implicitly use gitdir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-12T21:34:06Z","receivedAt":"2017-06-12T21:34:36Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Commit 2185fde56 (config: handle conditional include when $GIT_DIR is\nnot set up) added a 'git_dir' field to the config_options struct.  Let's\nuse this option field explicitly all the time instead of occasionally\nfalling back to calling 'git_pathdup(\"config\")' to get the path to the\nlocal repository configuration.  This allows 'do_git_config_sequence()'\nto not implicitly rely on global repository state.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/config.c | 2 ++\n config.c         | 6 ++----\n 2 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 753c40a5c..90f49a6ee 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -539,6 +539,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\tconfig_options.respect_includes = !given_config_source.file;\n \telse\n \t\tconfig_options.respect_includes = respect_includes_opt;\n+\tif (have_git_dir())\n+\t\tconfig_options.git_dir = get_git_common_dir();\n \n \tif (end_null) {\n \t\tterm = '\\0';\ndiff --git a/config.c b/config.c\nindex 2390f98e3..4e2842689 100644\n--- a/config.c\n+++ b/config.c\n@@ -219,8 +219,6 @@ static int include_by_gitdir(const struct config_options *opts,\n \n \tif (opts->git_dir)\n \t\tgit_dir = opts->git_dir;\n-\telse if (have_git_dir())\n-\t\tgit_dir = get_git_dir();\n \telse\n \t\tgoto done;\n \n@@ -1548,8 +1546,6 @@ static int do_git_config_sequence(const struct config_options *opts,\n \n \tif (opts->git_dir)\n \t\trepo_config = mkpathdup(\"%s/config\", opts->git_dir);\n-\telse if (have_git_dir())\n-\t\trepo_config = git_pathdup(\"config\");\n \telse\n \t\trepo_config = NULL;\n \n@@ -1613,6 +1609,8 @@ static void git_config_raw(config_fn_t fn, void *data)\n \tstruct config_options opts = {0};\n \n \topts.respect_includes = 1;\n+\tif (have_git_dir())\n+\t\topts.git_dir = get_git_common_dir();\n \tif (git_config_with_options(fn, data, NULL, &opts) < 0)\n \t\t/*\n \t\t * git_config_with_options() normally returns only\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322003","messageId":"20170612213406.83247-4-bmwill@google.com","threadId":"46161","inReplyTo":"20170612213406.83247-1-bmwill@google.com","subject":"[PATCH 3/4] config: don't include config.h by default","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-12T21:34:05Z","receivedAt":"2017-06-12T21:34:46Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Stop including config.h by default in cache.h.  Instead only include\nconfig.h in those files which require use of the config system.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n advice.c                         | 1 +\n alias.c                          | 1 +\n apply.c                          | 1 +\n archive-tar.c                    | 1 +\n archive-zip.c                    | 1 +\n archive.c                        | 1 +\n attr.c                           | 1 +\n bisect.c                         | 1 +\n branch.c                         | 1 +\n builtin/add.c                    | 1 +\n builtin/am.c                     | 1 +\n builtin/blame.c                  | 2 ++\n builtin/branch.c                 | 1 +\n builtin/cat-file.c               | 1 +\n builtin/check-attr.c             | 1 +\n builtin/check-ignore.c           | 1 +\n builtin/check-mailmap.c          | 1 +\n builtin/checkout-index.c         | 1 +\n builtin/checkout.c               | 1 +\n builtin/clean.c                  | 1 +\n builtin/clone.c                  | 1 +\n builtin/column.c                 | 1 +\n builtin/commit-tree.c            | 1 +\n builtin/commit.c                 | 1 +\n builtin/config.c                 | 1 +\n builtin/count-objects.c          | 1 +\n builtin/describe.c               | 1 +\n builtin/diff-files.c             | 1 +\n builtin/diff-index.c             | 1 +\n builtin/diff-tree.c              | 1 +\n builtin/diff.c                   | 1 +\n builtin/difftool.c               | 1 +\n builtin/fast-export.c            | 1 +\n builtin/fetch.c                  | 1 +\n builtin/fmt-merge-msg.c          | 1 +\n builtin/for-each-ref.c           | 1 +\n builtin/fsck.c                   | 1 +\n builtin/gc.c                     | 1 +\n builtin/grep.c                   | 1 +\n builtin/hash-object.c            | 1 +\n builtin/help.c                   | 1 +\n builtin/index-pack.c             | 1 +\n builtin/init-db.c                | 1 +\n builtin/log.c                    | 1 +\n builtin/ls-files.c               | 1 +\n builtin/ls-tree.c                | 1 +\n builtin/merge-base.c             | 1 +\n builtin/merge-file.c             | 1 +\n builtin/merge.c                  | 1 +\n builtin/mv.c                     | 1 +\n builtin/name-rev.c               | 1 +\n builtin/notes.c                  | 1 +\n builtin/pack-objects.c           | 1 +\n builtin/patch-id.c               | 1 +\n builtin/pull.c                   | 1 +\n builtin/push.c                   | 1 +\n builtin/read-tree.c              | 1 +\n builtin/rebase--helper.c         | 1 +\n builtin/receive-pack.c           | 1 +\n builtin/reflog.c                 | 1 +\n builtin/remote.c                 | 1 +\n builtin/repack.c                 | 1 +\n builtin/replace.c                | 1 +\n builtin/rerere.c                 | 1 +\n builtin/reset.c                  | 1 +\n builtin/rev-list.c               | 1 +\n builtin/rev-parse.c              | 1 +\n builtin/revert.c                 | 1 +\n builtin/rm.c                     | 1 +\n builtin/send-pack.c              | 1 +\n builtin/shortlog.c               | 1 +\n builtin/show-branch.c            | 1 +\n builtin/stripspace.c             | 1 +\n builtin/submodule--helper.c      | 1 +\n builtin/symbolic-ref.c           | 1 +\n builtin/tag.c                    | 1 +\n builtin/unpack-file.c            | 1 +\n builtin/unpack-objects.c         | 1 +\n builtin/update-index.c           | 1 +\n builtin/update-ref.c             | 1 +\n builtin/update-server-info.c     | 1 +\n builtin/var.c                    | 1 +\n builtin/verify-commit.c          | 1 +\n builtin/verify-pack.c            | 1 +\n builtin/verify-tag.c             | 1 +\n builtin/worktree.c               | 1 +\n builtin/write-tree.c             | 1 +\n cache.h                          | 1 -\n color.c                          | 1 +\n column.c                         | 1 +\n config.c                         | 1 +\n connect.c                        | 1 +\n convert.c                        | 1 +\n credential-cache--daemon.c       | 1 +\n credential.c                     | 1 +\n daemon.c                         | 1 +\n diff.c                           | 1 +\n dir.c                            | 1 +\n environment.c                    | 1 +\n fast-import.c                    | 1 +\n fetch-pack.c                     | 1 +\n git.c                            | 1 +\n gpg-interface.c                  | 1 +\n graph.c                          | 1 +\n grep.c                           | 1 +\n help.c                           | 1 +\n http-backend.c                   | 1 +\n http-fetch.c                     | 1 +\n http.c                           | 1 +\n ident.c                          | 1 +\n imap-send.c                      | 1 +\n ll-merge.c                       | 1 +\n log-tree.c                       | 1 +\n mailinfo.c                       | 1 +\n merge-recursive.c                | 1 +\n notes-utils.c                    | 1 +\n notes.c                          | 1 +\n pager.c                          | 1 +\n parse-options.c                  | 1 +\n pathspec.c                       | 1 +\n pretty.c                         | 1 +\n prompt.c                         | 1 +\n read-cache.c                     | 1 +\n refs.c                           | 1 +\n refs/files-backend.c             | 1 +\n remote-curl.c                    | 1 +\n remote.c                         | 1 +\n rerere.c                         | 1 +\n send-pack.c                      | 1 +\n sequencer.c                      | 1 +\n setup.c                          | 1 +\n sha1_file.c                      | 1 +\n sha1_name.c                      | 1 +\n submodule-config.c               | 1 +\n submodule.c                      | 1 +\n t/helper/test-config.c           | 1 +\n t/helper/test-submodule-config.c | 1 +\n trailer.c                        | 1 +\n transport.c                      | 1 +\n unpack-trees.c                   | 1 +\n upload-pack.c                    | 1 +\n userdiff.c                       | 1 +\n versioncmp.c                     | 1 +\n wrapper.c                        | 1 +\n xdiff-interface.c                | 1 +\n 145 files changed, 145 insertions(+), 1 deletion(-)\n\ndiff --git a/advice.c b/advice.c\nindex b84ae4960..3fa04fca0 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n \n int advice_push_update_rejected = 1;\n int advice_push_non_ff_current = 1;\ndiff --git a/alias.c b/alias.c\nindex 3b90397a9..052f34136 100644\n--- a/alias.c\n+++ b/alias.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n \n char *alias_lookup(const char *alias)\n {\ndiff --git a/apply.c b/apply.c\nindex c49cef063..87db9618d 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -8,6 +8,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"blob.h\"\n #include \"delta.h\"\n #include \"diff.h\"\ndiff --git a/archive-tar.c b/archive-tar.c\nindex 073e60ebd..c6ed96ee7 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -2,6 +2,7 @@\n  * Copyright (c) 2005, 2006 Rene Scharfe\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tar.h\"\n #include \"archive.h\"\n #include \"streaming.h\"\ndiff --git a/archive-zip.c b/archive-zip.c\nindex 27563e9e2..e8913e5a2 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -2,6 +2,7 @@\n  * Copyright (c) 2006 Rene Scharfe\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"archive.h\"\n #include \"streaming.h\"\n #include \"utf8.h\"\ndiff --git a/archive.c b/archive.c\nindex b15a922da..60b3035a7 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"tree-walk.h\"\ndiff --git a/attr.c b/attr.c\nindex 7e2134471..9f8b02936 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -9,6 +9,7 @@\n \n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"exec_cmd.h\"\n #include \"attr.h\"\n #include \"dir.h\"\ndiff --git a/bisect.c b/bisect.c\nindex c952df692..d8587d11c 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"revision.h\"\ndiff --git a/branch.c b/branch.c\nindex 985316eb7..a8a548ccf 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"branch.h\"\n #include \"refs.h\"\n #include \"remote.h\"\ndiff --git a/builtin/add.c b/builtin/add.c\nindex d9a2491e4..f2415e99f 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) 2006 Linus Torvalds\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 5ee146bfb..242d70361 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -4,6 +4,7 @@\n  * Based on git-am.sh by Junio C Hamano.\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex d7a2df3b4..381927920 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -6,6 +6,8 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n+#include \"refs.h\"\n #include \"builtin.h\"\n #include \"commit.h\"\n #include \"diff.h\"\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 83fcda43d..c958e9325 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -6,6 +6,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"color.h\"\n #include \"refs.h\"\n #include \"commit.h\"\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 4bffd7a2d..7efbc4019 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"diff.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex 4d01ca0c8..91444dc04 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"attr.h\"\n #include \"quote.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex c7b8c0889..3e280b9c7 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"quote.h\"\n #include \"pathspec.h\"\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex cf0f54f6b..cdce144f3 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"mailmap.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/checkout-index.c b/builtin/checkout-index.c\nindex 07631d0c9..39c8be05d 100644\n--- a/builtin/checkout-index.c\n+++ b/builtin/checkout-index.c\n@@ -5,6 +5,7 @@\n  *\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex a6b2af39d..45fab5a4d 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 142bf668c..ed954134d 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -8,6 +8,7 @@\n \n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 743f16ae2..4922a5496 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -9,6 +9,7 @@\n  */\n \n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\n #include \"fetch-pack.h\"\ndiff --git a/builtin/column.c b/builtin/column.c\nindex 33314b4d7..0c3223d64 100644\n--- a/builtin/column.c\n+++ b/builtin/column.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"strbuf.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex f39c2b273..a4a923d7c 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"tree.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex da1ba4c86..805da4915 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -6,6 +6,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"cache-tree.h\"\n #include \"color.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 7f6c25d4d..753c40a5c 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"color.h\"\n #include \"parse-options.h\"\n #include \"urlmatch.h\"\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex acb05940f..1d82e61f2 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -5,6 +5,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex 893c8789f..70eb14460 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"commit.h\"\n #include \"tag.h\"\ndiff --git a/builtin/diff-files.c b/builtin/diff-files.c\nindex a572da9d5..965f2fb76 100644\n--- a/builtin/diff-files.c\n+++ b/builtin/diff-files.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"revision.h\"\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex f084826a2..ad9971f64 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"revision.h\"\ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex e40111204..36c220f93 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"log-tree.h\"\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 0c8f86e40..0d59e99ef 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -4,6 +4,7 @@\n  * Copyright (c) 2006 Junio C Hamano\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"color.h\"\n #include \"commit.h\"\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex b9a892f26..9199227f6 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -12,6 +12,7 @@\n  * Copyright (C) 2016 Johannes Schindelin\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"run-command.h\"\n #include \"exec_cmd.h\"\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 24e29ad7e..0dfd980dd 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -5,6 +5,7 @@\n  */\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"object.h\"\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 47708451b..65317bd6c 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -2,6 +2,7 @@\n  * \"git fetch\"\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 70137b0b7..10cbb4341 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"diff.h\"\ndiff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c\nindex eca365bf8..52be99cba 100644\n--- a/builtin/for-each-ref.c\n+++ b/builtin/for-each-ref.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"object.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex cb2ba6cd1..90593491e 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"tree.h\"\n #include \"blob.h\"\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex f484eda43..bd91f136f 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -11,6 +11,7 @@\n  */\n \n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"tempfile.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 7df9c253e..7f720ca6c 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -4,6 +4,7 @@\n  * Copyright (c) 2006 Junio C Hamano\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"blob.h\"\n #include \"tree.h\"\n #include \"commit.h\"\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex bbeaf20bc..d04baf999 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -5,6 +5,7 @@\n  * Copyright (C) Junio C Hamano, 2005\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"blob.h\"\n #include \"quote.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 49f7a07f8..334a8494a 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -2,6 +2,7 @@\n  * Builtin help command\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 04b9dcaf0..edc1a91d8 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"delta.h\"\n #include \"pack.h\"\n #include \"csum-file.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex 8a6acb0ec..47823f9aa 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\ndiff --git a/builtin/log.c b/builtin/log.c\nindex e89ec941c..01d7213c1 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -5,6 +5,7 @@\n  *\t\t 2006 Junio Hamano\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"color.h\"\n #include \"commit.h\"\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex b376afc31..c4357dc30 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -6,6 +6,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"quote.h\"\n #include \"dir.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex ee7b293b1..ef965408e 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"blob.h\"\n #include \"tree.h\"\n #include \"commit.h\"\ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex 0c36a70ad..6dbd167d3 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"diff.h\"\ndiff --git a/builtin/merge-file.c b/builtin/merge-file.c\nindex 47dde7c39..b08803e61 100644\n--- a/builtin/merge-file.c\n+++ b/builtin/merge-file.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"xdiff/xdiff.h\"\n #include \"xdiff-interface.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex a4a098f40..2512370c1 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -7,6 +7,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"builtin.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex 61d20037a..dcf6736b5 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) 2006 Johannes Schindelin\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"pathspec.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 7fc7e66e8..e21715f1d 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"tag.h\"\n #include \"refs.h\"\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 7196bff0e..8d14f434a 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -8,6 +8,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"notes.h\"\n #include \"blob.h\"\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex f672225de..d5e96ed2d 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"attr.h\"\n #include \"object.h\"\n #include \"blob.h\"\ndiff --git a/builtin/patch-id.c b/builtin/patch-id.c\nindex 81552e02e..970d0d30b 100644\n--- a/builtin/patch-id.c\n+++ b/builtin/patch-id.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n \n static void flush_current_id(int patchlen, struct object_id *id, struct object_id *result)\n {\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex da8b60fc8..0c77381da 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -6,6 +6,7 @@\n  * Fetch one or more remote refs and merge it/them into the current HEAD.\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\n #include \"exec_cmd.h\"\ndiff --git a/builtin/push.c b/builtin/push.c\nindex a597759d8..76aa713d2 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -2,6 +2,7 @@\n  * \"git push\"\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"run-command.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex 78d319365..6eb2a0e57 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -5,6 +5,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"object.h\"\n #include \"tree.h\"\ndiff --git a/builtin/rebase--helper.c b/builtin/rebase--helper.c\nindex ca1ebb2fa..c82b4dce6 100644\n--- a/builtin/rebase--helper.c\n+++ b/builtin/rebase--helper.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"sequencer.h\"\n \ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex b1706a573..71c0c768d 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"pack.h\"\n #include \"refs.h\"\ndiff --git a/builtin/reflog.c b/builtin/reflog.c\nindex 920c16dac..44cdc2dbd 100644\n--- a/builtin/reflog.c\n+++ b/builtin/reflog.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"commit.h\"\n #include \"refs.h\"\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex f1a88fe26..6273c0c23 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"transport.h\"\n #include \"remote.h\"\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 38ba4ef82..f17a68a17 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"parse-options.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex c921bc976..80a15cf35 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -9,6 +9,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"refs.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/rerere.c b/builtin/rerere.c\nindex 1bf72423b..ffb66e290 100644\n--- a/builtin/rerere.c\n+++ b/builtin/rerere.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 430602d10..d0b604103 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -8,6 +8,7 @@\n  * Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"tag.h\"\n #include \"object.h\"\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 718c6059c..f8e2b7bf5 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"revision.h\"\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex efdc14473..c78b7b33d 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"quote.h\"\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 345d9586a..16028b9ea 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\n #include \"diff.h\"\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex 7c323d012..824d1de9e 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds 2006\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/send-pack.c b/builtin/send-pack.c\nindex b8e2e74fe..633e0c3cd 100644\n--- a/builtin/send-pack.c\n+++ b/builtin/send-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 7cff1839f..43c4799ea 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 4a6cc6f49..e4cf1b5bb 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/stripspace.c b/builtin/stripspace.c\nindex 1e62a008c..bdf032886 100644\n--- a/builtin/stripspace.c\n+++ b/builtin/stripspace.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\n \ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 8cc648d85..4dcbfb952 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"quote.h\"\n #include \"pathspec.h\"\ndiff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c\nindex 70addef15..df75cb9d4 100644\n--- a/builtin/symbolic-ref.c\n+++ b/builtin/symbolic-ref.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"cache.h\"\n #include \"refs.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 1f74a56db..01154ea8d 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -7,6 +7,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"refs.h\"\n #include \"tag.h\"\ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex 6fc6bcdf7..73f133419 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n \n static char *create_temp_file(unsigned char *sha1)\n {\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex 8bc999776..193f8b9d5 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"object.h\"\n #include \"delta.h\"\n #include \"pack.h\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex ebfc09faa..0a4c23648 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex 0b2ecf41a..40ccfc193 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/update-server-info.c b/builtin/update-server-info.c\nindex 6c8cc3edc..873070e51 100644\n--- a/builtin/update-server-info.c\n+++ b/builtin/update-server-info.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/var.c b/builtin/var.c\nindex aedbb53a2..6c6f46b4a 100644\n--- a/builtin/var.c\n+++ b/builtin/var.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Eric Biederman, 2005\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n \n static const char var_usage[] = \"git var (-l | <variable>)\";\n \ndiff --git a/builtin/verify-commit.c b/builtin/verify-commit.c\nindex 05b734e6d..ba38ac9b1 100644\n--- a/builtin/verify-commit.c\n+++ b/builtin/verify-commit.c\n@@ -6,6 +6,7 @@\n  * Based on git-verify-tag\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"commit.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex c94e15693..c2a1a5c50 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 5199553d9..f9a5f7535 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -6,6 +6,7 @@\n  * Based on git-verify-tag.sh\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"tag.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 793306ea5..0c5476ee9 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"dir.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/write-tree.c b/builtin/write-tree.c\nindex 084c0df78..bd0a78aa3 100644\n--- a/builtin/write-tree.c\n+++ b/builtin/write-tree.c\n@@ -5,6 +5,7 @@\n  */\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\n #include \"parse-options.h\"\ndiff --git a/cache.h b/cache.h\nindex ed56f8818..fd45b8c55 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -11,7 +11,6 @@\n #include \"string-list.h\"\n #include \"pack-revindex.h\"\n #include \"hash.h\"\n-#include \"config.h\"\n \n #ifndef platform_SHA_CTX\n /*\ndiff --git a/color.c b/color.c\nindex dee61557e..31b6207a0 100644\n--- a/color.c\n+++ b/color.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"color.h\"\n \n static int git_use_color_default = GIT_COLOR_AUTO;\ndiff --git a/column.c b/column.c\nindex d55ead18e..ff7bdab1a 100644\n--- a/column.c\n+++ b/column.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"column.h\"\n #include \"string-list.h\"\n #include \"parse-options.h\"\ndiff --git a/config.c b/config.c\nindex 146cb3452..2390f98e3 100644\n--- a/config.c\n+++ b/config.c\n@@ -6,6 +6,7 @@\n  *\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"exec_cmd.h\"\n #include \"strbuf.h\"\ndiff --git a/connect.c b/connect.c\nindex c72b1d115..e78d3f43d 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"pkt-line.h\"\n #include \"quote.h\"\n #include \"refs.h\"\ndiff --git a/convert.c b/convert.c\nindex f1e168bc3..5f4a4b1f5 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"attr.h\"\n #include \"run-command.h\"\n #include \"quote.h\"\ndiff --git a/credential-cache--daemon.c b/credential-cache--daemon.c\nindex f3814cc47..0d5c62509 100644\n--- a/credential-cache--daemon.c\n+++ b/credential-cache--daemon.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tempfile.h\"\n #include \"credential.h\"\n #include \"unix-socket.h\"\ndiff --git a/credential.c b/credential.c\nindex aa996669f..67a523353 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"credential.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\ndiff --git a/daemon.c b/daemon.c\nindex ac7181a48..30747075f 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"pkt-line.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\ndiff --git a/diff.c b/diff.c\nindex 5275c4b78..3458ec640 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2,6 +2,7 @@\n  * Copyright (C) 2005 Junio C Hamano\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tempfile.h\"\n #include \"quote.h\"\n #include \"diff.h\"\ndiff --git a/dir.c b/dir.c\nindex 9efcf1eab..d4e4258ea 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -9,6 +9,7 @@\n  */\n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"attr.h\"\n #include \"refs.h\"\ndiff --git a/environment.c b/environment.c\nindex aa478e71d..d40b21fb7 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -8,6 +8,7 @@\n  * are.\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"fmt-merge-msg.h\"\n #include \"commit.h\"\ndiff --git a/fast-import.c b/fast-import.c\nindex e69d21968..2881d4898 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -154,6 +154,7 @@ Format of STDIN stream:\n \n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"object.h\"\n #include \"blob.h\"\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex cd86865be..fbbc99c88 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\ndiff --git a/git.c b/git.c\nindex 8ff44f081..594436e43 100644\n--- a/git.c\n+++ b/git.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"exec_cmd.h\"\n #include \"help.h\"\n #include \"run-command.h\"\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex e44cc27da..8ab32df45 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"gpg-interface.h\"\ndiff --git a/graph.c b/graph.c\nindex 8b9049dd2..e7e20650d 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"color.h\"\n #include \"graph.h\"\ndiff --git a/grep.c b/grep.c\nindex d03d424e5..62c7cf970 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"grep.h\"\n #include \"userdiff.h\"\n #include \"xdiff-interface.h\"\ndiff --git a/help.c b/help.c\nindex db7f3d79a..5d44f811a 100644\n--- a/help.c\n+++ b/help.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\n #include \"run-command.h\"\ndiff --git a/http-backend.c b/http-backend.c\nindex ba5ff1aa2..519025d2c 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\n #include \"object.h\"\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 3b556d661..8af380050 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"exec_cmd.h\"\n #include \"http.h\"\n #include \"walker.h\"\ndiff --git a/http.c b/http.c\nindex d2e11ec6f..013bb0cc6 100644\n--- a/http.c\n+++ b/http.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"http.h\"\n+#include \"config.h\"\n #include \"pack.h\"\n #include \"sideband.h\"\n #include \"run-command.h\"\ndiff --git a/ident.c b/ident.c\nindex bea871c8e..d41fc9119 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -6,6 +6,7 @@\n  * Copyright (C) 2005 Linus Torvalds\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n \n static struct strbuf git_default_name = STRBUF_INIT;\n static struct strbuf git_default_email = STRBUF_INIT;\ndiff --git a/imap-send.c b/imap-send.c\nindex 857591660..59e9b12d2 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -23,6 +23,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"credential.h\"\n #include \"exec_cmd.h\"\n #include \"run-command.h\"\ndiff --git a/ll-merge.c b/ll-merge.c\nindex ac0d4a5d7..24ff94e1d 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -5,6 +5,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"attr.h\"\n #include \"xdiff-interface.h\"\n #include \"run-command.h\"\ndiff --git a/log-tree.c b/log-tree.c\nindex a4ec11c2b..7e1dfd749 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"tag.h\"\ndiff --git a/mailinfo.c b/mailinfo.c\nindex f92cb9f72..f59162453 100644\n--- a/mailinfo.c\n+++ b/mailinfo.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"utf8.h\"\n #include \"strbuf.h\"\n #include \"mailinfo.h\"\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex ae5238d82..c2494f34f 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -4,6 +4,7 @@\n  * The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"advice.h\"\n #include \"lockfile.h\"\n #include \"cache-tree.h\"\ndiff --git a/notes-utils.c b/notes-utils.c\nindex 031503d7b..3f6cbdc47 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"notes-utils.h\"\ndiff --git a/notes.c b/notes.c\nindex 542563b28..dbcfef4d7 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"notes.h\"\n #include \"blob.h\"\n #include \"tree.h\"\ndiff --git a/pager.c b/pager.c\nindex c113d898a..4dd9e1b26 100644\n--- a/pager.c\n+++ b/pager.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"run-command.h\"\n #include \"sigchain.h\"\n \ndiff --git a/parse-options.c b/parse-options.c\nindex e5ad34a2c..0dd9fc6a0 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"parse-options.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"color.h\"\n #include \"utf8.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex 828405021..ecc5331c2 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -1,5 +1,6 @@\n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"pathspec.h\"\n #include \"attr.h\"\ndiff --git a/pretty.c b/pretty.c\nindex 09701bd2f..9c9f81b5b 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"utf8.h\"\n #include \"diff.h\"\ndiff --git a/prompt.c b/prompt.c\nindex 75406390c..6d5885d00 100644\n--- a/prompt.c\n+++ b/prompt.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"prompt.h\"\ndiff --git a/read-cache.c b/read-cache.c\nindex bc156a133..c8c766dab 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -5,6 +5,7 @@\n  */\n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tempfile.h\"\n #include \"lockfile.h\"\n #include \"cache-tree.h\"\ndiff --git a/refs.c b/refs.c\nindex f0685c925..84112c88e 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -3,6 +3,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"hashmap.h\"\n #include \"lockfile.h\"\n #include \"iterator.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex d8b3f7314..621a4086c 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -1,4 +1,5 @@\n #include \"../cache.h\"\n+#include \"../config.h\"\n #include \"../refs.h\"\n #include \"refs-internal.h\"\n #include \"ref-cache.h\"\ndiff --git a/remote-curl.c b/remote-curl.c\nindex ece45993d..0053b0954 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"remote.h\"\n #include \"strbuf.h\"\n #include \"walker.h\"\ndiff --git a/remote.c b/remote.c\nindex 3649d60cd..68d20f650 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"remote.h\"\n #include \"refs.h\"\n #include \"commit.h\"\ndiff --git a/rerere.c b/rerere.c\nindex 3bd55caf3..344d6aa81 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"string-list.h\"\n #include \"rerere.h\"\ndiff --git a/send-pack.c b/send-pack.c\nindex 78bb34ebe..ed3cee321 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\ndiff --git a/sequencer.c b/sequencer.c\nindex 924fb1d0c..86b0640d2 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"sequencer.h\"\n #include \"dir.h\"\ndiff --git a/setup.c b/setup.c\nindex e3f7699a9..e99a82cbe 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"string-list.h\"\n \ndiff --git a/sha1_file.c b/sha1_file.c\nindex 59a4ed2ed..44561e0b9 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -7,6 +7,7 @@\n  * creation etc.\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"string-list.h\"\n #include \"lockfile.h\"\n #include \"delta.h\"\ndiff --git a/sha1_name.c b/sha1_name.c\nindex e9ffe685d..2875771ff 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tag.h\"\n #include \"commit.h\"\n #include \"tree.h\"\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 4f58491dd..d8f8d5ea3 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n #include \"strbuf.h\"\ndiff --git a/submodule.c b/submodule.c\nindex bf5a93d16..95328de61 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n #include \"dir.h\"\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 8e3ed6a76..1a7b8bd3d 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"string-list.h\"\n \n /*\ndiff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c\nindex 2f144d539..c6c57bba0 100644\n--- a/t/helper/test-submodule-config.c\n+++ b/t/helper/test-submodule-config.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n \ndiff --git a/trailer.c b/trailer.c\nindex 11f0b9fb4..751b56c00 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\n #include \"commit.h\"\ndiff --git a/transport.c b/transport.c\nindex 9bfcf870f..b9995306f 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"transport.h\"\n #include \"run-command.h\"\n #include \"pkt-line.h\"\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex d38c37e38..dd535bc84 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -1,5 +1,6 @@\n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"tree.h\"\n #include \"tree-walk.h\"\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 5330c02c1..7efff2fbf 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\n #include \"sideband.h\"\ndiff --git a/userdiff.c b/userdiff.c\nindex 8b732e40b..2c1502f71 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"userdiff.h\"\n #include \"attr.h\"\n \ndiff --git a/versioncmp.c b/versioncmp.c\nindex 9f81dc106..069ee94a4 100644\n--- a/versioncmp.c\n+++ b/versioncmp.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"string-list.h\"\n \n /*\ndiff --git a/wrapper.c b/wrapper.c\nindex d83741770..487a9f753 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -2,6 +2,7 @@\n  * Various trivial helper wrappers around standard functions\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n \n static void do_nothing(size_t size)\n {\ndiff --git a/xdiff-interface.c b/xdiff-interface.c\nindex 060038c2d..5ac07d734 100644\n--- a/xdiff-interface.c\n+++ b/xdiff-interface.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"xdiff-interface.h\"\n #include \"xdiff/xtypes.h\"\n #include \"xdiff/xdiffi.h\"\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322005","messageId":"20170612214502.xynyfswj2ipf25ah@sigill.intra.peff.net","threadId":"46161","inReplyTo":"20170612213406.83247-1-bmwill@google.com","subject":"Re: [PATCH 0/4] config.h","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-06-12T21:45:02Z","receivedAt":"2017-06-12T21:45:09Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 12, 2017 at 02:34:02PM -0700, Brandon Williams wrote:\n\n> After some discussion I realized that my 'repository object' series was getting\n> to be rather long and increase in scope.  So I've decided to break off these\n> couple patches into their own series so they can be reviewed more easily.  This\n> should also let them be merged in faster as I suspect it'll take a while for my\n> 'repository object' series to be reviewed thourouly and these couple patches\n> could result in a lot of merge conflicts as it touches a lot of files.\n> \n> Brandon Williams (4):\n>   config: create config.h\n>   config: remove git_config_iter\n>   config: don't include config.h by default\n>   config: don't implicitly use gitdir\n\nThese all seem reasonable to me. Patch 3 made me shrug a little, because\nit seems like the majority of C files end up including it anyway. I\nsuspect you could break config.h down into two files: the few things\nthat everybody needs (git_config() and the few parsing functions needed\nin callbacks) and the ones for commands that actually manipulate the\nconfig.\n\nThat would reduce the surface area of the module that most callers look\nat, but I don't think there's a huge benefit to doing so (mostly it just\nmakes re-compiling faster by decreasing the chance that a dependent\nheader has changed for each file).\n\n-Peff\n"},{"id":"322006","messageId":"20170612215352.GE154599@google.com","threadId":"46161","inReplyTo":"20170612214502.xynyfswj2ipf25ah@sigill.intra.peff.net","subject":"Re: [PATCH 0/4] config.h","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-12T21:53:52Z","receivedAt":"2017-06-12T21:53:59Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/12, Jeff King wrote:\n> On Mon, Jun 12, 2017 at 02:34:02PM -0700, Brandon Williams wrote:\n> \n> > After some discussion I realized that my 'repository object' series was getting\n> > to be rather long and increase in scope.  So I've decided to break off these\n> > couple patches into their own series so they can be reviewed more easily.  This\n> > should also let them be merged in faster as I suspect it'll take a while for my\n> > 'repository object' series to be reviewed thourouly and these couple patches\n> > could result in a lot of merge conflicts as it touches a lot of files.\n> > \n> > Brandon Williams (4):\n> >   config: create config.h\n> >   config: remove git_config_iter\n> >   config: don't include config.h by default\n> >   config: don't implicitly use gitdir\n> \n> These all seem reasonable to me. Patch 3 made me shrug a little, because\n> it seems like the majority of C files end up including it anyway. I\n> suspect you could break config.h down into two files: the few things\n> that everybody needs (git_config() and the few parsing functions needed\n> in callbacks) and the ones for commands that actually manipulate the\n> config.\n> \n> That would reduce the surface area of the module that most callers look\n> at, but I don't think there's a huge benefit to doing so (mostly it just\n> makes re-compiling faster by decreasing the chance that a dependent\n> header has changed for each file).\n\nYes, ultimately I think it would be a good thing to break config.c down\ninto at least 2 more files (the file parsing logic and the config_set\nlogic) but that can be done at a later point.  I started looking at\ndoing that now but that logic is a little more entangled than I thought\nit was.\n\nThanks for taking a look Jeff!\n\n-- \nBrandon Williams\n"},{"id":"322008","messageId":"20170612220244.dcndhmxpnsz2tg5d@sigill.intra.peff.net","threadId":"46161","inReplyTo":"20170612215352.GE154599@google.com","subject":"Re: [PATCH 0/4] config.h","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-06-12T22:02:44Z","receivedAt":"2017-06-12T22:02:49Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 12, 2017 at 02:53:52PM -0700, Brandon Williams wrote:\n\n> > These all seem reasonable to me. Patch 3 made me shrug a little, because\n> > it seems like the majority of C files end up including it anyway. I\n> > suspect you could break config.h down into two files: the few things\n> > that everybody needs (git_config() and the few parsing functions needed\n> > in callbacks) and the ones for commands that actually manipulate the\n> > config.\n> > \n> > That would reduce the surface area of the module that most callers look\n> > at, but I don't think there's a huge benefit to doing so (mostly it just\n> > makes re-compiling faster by decreasing the chance that a dependent\n> > header has changed for each file).\n> \n> Yes, ultimately I think it would be a good thing to break config.c down\n> into at least 2 more files (the file parsing logic and the config_set\n> logic) but that can be done at a later point.  I started looking at\n> doing that now but that logic is a little more entangled than I thought\n> it was.\n\nTo be clear, I don't mind that sort of module refactoring and like the\nresults.  But it almost certainly isn't the biggest bang-for-buck in\nterms of the time it takes versus the benefit it brings. So take my\ncomment as \"we could also do...\" but not \"we should not take your patch\nbecause it does not go far enough\".\n\n-Peff\n"},{"id":"322010","messageId":"20170612220605.GF154599@google.com","threadId":"46161","inReplyTo":"20170612220244.dcndhmxpnsz2tg5d@sigill.intra.peff.net","subject":"Re: [PATCH 0/4] config.h","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-12T22:06:05Z","receivedAt":"2017-06-12T22:06:13Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/12, Jeff King wrote:\n> On Mon, Jun 12, 2017 at 02:53:52PM -0700, Brandon Williams wrote:\n> \n> > > These all seem reasonable to me. Patch 3 made me shrug a little, because\n> > > it seems like the majority of C files end up including it anyway. I\n> > > suspect you could break config.h down into two files: the few things\n> > > that everybody needs (git_config() and the few parsing functions needed\n> > > in callbacks) and the ones for commands that actually manipulate the\n> > > config.\n> > > \n> > > That would reduce the surface area of the module that most callers look\n> > > at, but I don't think there's a huge benefit to doing so (mostly it just\n> > > makes re-compiling faster by decreasing the chance that a dependent\n> > > header has changed for each file).\n> > \n> > Yes, ultimately I think it would be a good thing to break config.c down\n> > into at least 2 more files (the file parsing logic and the config_set\n> > logic) but that can be done at a later point.  I started looking at\n> > doing that now but that logic is a little more entangled than I thought\n> > it was.\n> \n> To be clear, I don't mind that sort of module refactoring and like the\n> results.  But it almost certainly isn't the biggest bang-for-buck in\n> terms of the time it takes versus the benefit it brings. So take my\n> comment as \"we could also do...\" but not \"we should not take your patch\n> because it does not go far enough\".\n\nYes, that's how I understood your comment.  I realize that there's a lot\nof improvements that can be done across our code base and one rabbit\nhole that is easy to fall into is \"fix all the things right now!\" hence\nwhy I decided to defer doing that to a later date.  And I agree that\ndoing that extra work doesn't buy us 'all too much'.\n\nHaving said that I do think it was worthwhile to remove the config\ndeclarations from cache.h.  I think in the long term it would be nice to\nlimit cache.h's scope as it is very unapproachable in its current form.\n\n-- \nBrandon Williams\n"},{"id":"322033","messageId":"20170613004911.GA133952@aiede.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170612213406.83247-3-bmwill@google.com","subject":"Re: [PATCH 2/4] config: remove git_config_iter","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-13T00:49:11Z","receivedAt":"2017-06-13T00:49:51Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"(+tanayabh)\nHi,\n\nBrandon Williams wrote:\n\n> Since there is no implementation of the function 'git_config_iter' lets\n> stop exporting it and remove the prototype from config.h.\n>\n> Signed-off-by: Brandon Williams <bmwill@google.com>\n> ---\n>  config.h | 1 -\n>  1 file changed, 1 deletion(-)\n\nGood eyes.  Looks like the function never existed.\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\n> diff --git a/config.h b/config.h\n> index f7f8b66c5..c70599bd5 100644\n> --- a/config.h\n> +++ b/config.h\n> @@ -165,7 +165,6 @@ extern int git_configset_get_pathname(struct config_set *cs, const char *key, co\n>  extern int git_config_get_value(const char *key, const char **value);\n>  extern const struct string_list *git_config_get_value_multi(const char *key);\n>  extern void git_config_clear(void);\n> -extern void git_config_iter(config_fn_t fn, void *data);\n>  extern int git_config_get_string_const(const char *key, const char **dest);\n>  extern int git_config_get_string(const char *key, char **dest);\n>  extern int git_config_get_int(const char *key, int *dest);\n"},{"id":"322035","messageId":"20170613005723.fd54nx7fazclutlz@sigill.intra.peff.net","threadId":"46161","inReplyTo":"20170613004911.GA133952@aiede.mtv.corp.google.com","subject":"Re: [PATCH 2/4] config: remove git_config_iter","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-06-13T00:57:24Z","receivedAt":"2017-06-13T00:57:30Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 12, 2017 at 05:49:11PM -0700, Jonathan Nieder wrote:\n\n> > Since there is no implementation of the function 'git_config_iter' lets\n> > stop exporting it and remove the prototype from config.h.\n> >\n> > Signed-off-by: Brandon Williams <bmwill@google.com>\n> > ---\n> >  config.h | 1 -\n> >  1 file changed, 1 deletion(-)\n> \n> Good eyes.  Looks like the function never existed.\n\nYou can find mention of it on the list[1,2] in early versions of Tanay's\npatches. I think it was originally intended to be a variant of\ngit_config() that used the cache. But in the end, we made git_config()\ndo that by default (and added git_config_raw as its underlying helper).\n\nI just looked that up to satisfy my curiosity. You are right that its\nimplementation never actually got committed, and clearly removing the\ndeclaration is the right thing.\n\n-Peff\n\n[1] http://public-inbox.org/git/1404280905-26763-2-git-send-email-tanayabh@gmail.com/\n\n[2] http://public-inbox.org/git/xmqqd2dnitm7.fsf@gitster.dls.corp.google.com/\n"},{"id":"322036","messageId":"20170613010518.GB133952@aiede.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170612213406.83247-5-bmwill@google.com","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-13T01:05:18Z","receivedAt":"2017-06-13T01:05:29Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nBrandon Williams wrote:\n\n> Commit 2185fde56 (config: handle conditional include when $GIT_DIR is\n> not set up) added a 'git_dir' field to the config_options struct.  Let's\n> use this option field explicitly all the time instead of occasionally\n> falling back to calling 'git_pathdup(\"config\")' to get the path to the\n> local repository configuration.  This allows 'do_git_config_sequence()'\n> to not implicitly rely on global repository state.\n>\n> Signed-off-by: Brandon Williams <bmwill@google.com>\n> ---\n>  builtin/config.c | 2 ++\n>  config.c         | 6 ++----\n>  2 files changed, 4 insertions(+), 4 deletions(-)\n\nUnlike the previous 3, this one makes me pause for a moment: it means\nthat \"gitdir:\" includes and .git/config discovery would stop working\nif the caller does not remember to set git_dir in their\nconfig_options.\n\nSo we have to inspect callers.\n\nCallers that set respect_includes = 1:\n\n- read_early_config carefully sets git_dir *phew*\n- git_config_raw doesn't and is used approximately everywhere.\n\ndo_git_config_sequence call chain:\n- called by git_config_with_options, which is called by\n  - read_early_config\n  - git_config_raw\n  - various callers in builtin/config.c, using &config_options\n\n> --- a/builtin/config.c\n> +++ b/builtin/config.c\n> @@ -539,6 +539,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n>  \t\tconfig_options.respect_includes = !given_config_source.file;\n>  \telse\n>  \t\tconfig_options.respect_includes = respect_includes_opt;\n> +\tif (have_git_dir())\n> +\t\tconfig_options.git_dir = get_git_common_dir();\n\nnit: because of the context, this 'if' can be \"if (!nongit)\".\n\n[...]\n> --- a/config.c\n> +++ b/config.c\n> @@ -219,8 +219,6 @@ static int include_by_gitdir(const struct config_options *opts,\n>  \n>  \tif (opts->git_dir)\n>  \t\tgit_dir = opts->git_dir;\n> -\telse if (have_git_dir())\n> -\t\tgit_dir = get_git_dir();\n>  \telse\n>  \t\tgoto done;\n\nI wonder if this should have a sanity-check:\n\n\telse if (have_git_dir())\n\t\tBUG(\"caller forgot to set opts->git_dir\");\n\nAlternatively, could this patch rename git_config_with_options?  That\nway any other patch in flight that calls git_config_with_options would\nconflict with this patch, giving us an opportunity to make sure it\nalso sets git_dir.  As another nice side benefit it would make it easy\nfor someone reading the patch to verify it didn't miss any callers.\n\n> @@ -1548,8 +1546,6 @@ static int do_git_config_sequence(const struct config_options *opts,\n>  \n>  \tif (opts->git_dir)\n>  \t\trepo_config = mkpathdup(\"%s/config\", opts->git_dir);\n> -\telse if (have_git_dir())\n> -\t\trepo_config = git_pathdup(\"config\");\n>  \telse\n>  \t\trepo_config = NULL;\n\nLikewise: either this should get a sanity check\n\n\telse if (have_git_dir())\n\t\tBUG(\"caller forgot to set opts->git_dir\");\n\nor the public interface git_config_with_options should be renamed.\n\n> @@ -1613,6 +1609,8 @@ static void git_config_raw(config_fn_t fn, void *data)\n>  \tstruct config_options opts = {0};\n>  \n>  \topts.respect_includes = 1;\n> +\tif (have_git_dir())\n> +\t\topts.git_dir = get_git_common_dir();\n\ncurious: Why get_git_common_dir() instead of get_git_dir()?\n\nThanks,\nJonathan\n"},{"id":"322037","messageId":"20170613010747.GC133952@aiede.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170612213406.83247-1-bmwill@google.com","subject":"Re: [PATCH 0/4] config.h","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-13T01:07:47Z","receivedAt":"2017-06-13T01:07:55Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Williams wrote:\n\n> Brandon Williams (4):\n>   config: create config.h\n>   config: remove git_config_iter\n>   config: don't include config.h by default\n>   config: don't implicitly use gitdir\n\nPatches 1-3 are\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nI'm very happy to see cache.h getting shorter and less intimidating.\n\nI have some minor concerns with patch 4 that I described in a reply to\nthat patch.  I'd expect that after another round that one will be\nready.\n\nThanks for a pleasant read.\n\nSincerely,\nJonathan\n"},{"id":"322038","messageId":"20170613012337.GH154599@google.com","threadId":"46161","inReplyTo":"20170613010518.GB133952@aiede.mtv.corp.google.com","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T01:23:37Z","receivedAt":"2017-06-13T01:23:45Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/12, Jonathan Nieder wrote:\n> Hi,\n> \n> Brandon Williams wrote:\n> \n> > Commit 2185fde56 (config: handle conditional include when $GIT_DIR is\n> > not set up) added a 'git_dir' field to the config_options struct.  Let's\n> > use this option field explicitly all the time instead of occasionally\n> > falling back to calling 'git_pathdup(\"config\")' to get the path to the\n> > local repository configuration.  This allows 'do_git_config_sequence()'\n> > to not implicitly rely on global repository state.\n> >\n> > Signed-off-by: Brandon Williams <bmwill@google.com>\n> > ---\n> >  builtin/config.c | 2 ++\n> >  config.c         | 6 ++----\n> >  2 files changed, 4 insertions(+), 4 deletions(-)\n> \n> Unlike the previous 3, this one makes me pause for a moment: it means\n> that \"gitdir:\" includes and .git/config discovery would stop working\n> if the caller does not remember to set git_dir in their\n> config_options.\n> \n> So we have to inspect callers.\n> \n> Callers that set respect_includes = 1:\n> \n> - read_early_config carefully sets git_dir *phew*\n> - git_config_raw doesn't and is used approximately everywhere.\n> \n> do_git_config_sequence call chain:\n> - called by git_config_with_options, which is called by\n>   - read_early_config\n>   - git_config_raw\n>   - various callers in builtin/config.c, using &config_options\n> \n> > --- a/builtin/config.c\n> > +++ b/builtin/config.c\n> > @@ -539,6 +539,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n> >  \t\tconfig_options.respect_includes = !given_config_source.file;\n> >  \telse\n> >  \t\tconfig_options.respect_includes = respect_includes_opt;\n> > +\tif (have_git_dir())\n> > +\t\tconfig_options.git_dir = get_git_common_dir();\n> \n> nit: because of the context, this 'if' can be \"if (!nongit)\".\n\nWill do.\n\n> \n> [...]\n> > --- a/config.c\n> > +++ b/config.c\n> > @@ -219,8 +219,6 @@ static int include_by_gitdir(const struct config_options *opts,\n> >  \n> >  \tif (opts->git_dir)\n> >  \t\tgit_dir = opts->git_dir;\n> > -\telse if (have_git_dir())\n> > -\t\tgit_dir = get_git_dir();\n> >  \telse\n> >  \t\tgoto done;\n> \n> I wonder if this should have a sanity-check:\n> \n> \telse if (have_git_dir())\n> \t\tBUG(\"caller forgot to set opts->git_dir\");\n> \n> Alternatively, could this patch rename git_config_with_options?  That\n> way any other patch in flight that calls git_config_with_options would\n> conflict with this patch, giving us an opportunity to make sure it\n> also sets git_dir.  As another nice side benefit it would make it easy\n> for someone reading the patch to verify it didn't miss any callers.\n\nThat kind of defeats the purpose of the patch.  The point is to not rely\non global repository state and with the BUG statement we still are\nrelying on global state.\n\nAnd I don't know if I agree with renaming a function just to rename it.\n\n> \n> > @@ -1548,8 +1546,6 @@ static int do_git_config_sequence(const struct config_options *opts,\n> >  \n> >  \tif (opts->git_dir)\n> >  \t\trepo_config = mkpathdup(\"%s/config\", opts->git_dir);\n> > -\telse if (have_git_dir())\n> > -\t\trepo_config = git_pathdup(\"config\");\n> >  \telse\n> >  \t\trepo_config = NULL;\n> \n> Likewise: either this should get a sanity check\n> \n> \telse if (have_git_dir())\n> \t\tBUG(\"caller forgot to set opts->git_dir\");\n> \n> or the public interface git_config_with_options should be renamed.\n> \n> > @@ -1613,6 +1609,8 @@ static void git_config_raw(config_fn_t fn, void *data)\n> >  \tstruct config_options opts = {0};\n> >  \n> >  \topts.respect_includes = 1;\n> > +\tif (have_git_dir())\n> > +\t\topts.git_dir = get_git_common_dir();\n> \n> curious: Why get_git_common_dir() instead of get_git_dir()?\n\nNeeds to be commondir since the config is stored in the common git\ndirectory and not a per worktree git directory.\n\n-- \nBrandon Williams\n"},{"id":"322039","messageId":"20170613013350.GD133952@aiede.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170613012337.GH154599@google.com","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-13T01:33:50Z","receivedAt":"2017-06-13T01:33:59Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Williams wrote:\n> On 06/12, Jonathan Nieder wrote:\n>> Brandon Williams wrote:\n\n>>> Commit 2185fde56 (config: handle conditional include when $GIT_DIR is\n>>> not set up) added a 'git_dir' field to the config_options struct.  Let's\n>>> use this option field explicitly all the time instead of occasionally\n>>> falling back to calling 'git_pathdup(\"config\")' to get the path to the\n>>> local repository configuration.  This allows 'do_git_config_sequence()'\n>>> to not implicitly rely on global repository state.\n>>>\n>>> Signed-off-by: Brandon Williams <bmwill@google.com>\n[...]\n>> Unlike the previous 3, this one makes me pause for a moment: it means\n>> that \"gitdir:\" includes and .git/config discovery would stop working\n>> if the caller does not remember to set git_dir in their\n>> config_options.\n>>\n>> So we have to inspect callers.\n[...]\n>> nit: because of the context, this 'if' can be \"if (!nongit)\".\n>\n> Will do.\n\nThanks.\n\n[...]\n>>> +++ b/config.c\n>>> @@ -219,8 +219,6 @@ static int include_by_gitdir(const struct config_options *opts,\n>>>  \n>>>  \tif (opts->git_dir)\n>>>  \t\tgit_dir = opts->git_dir;\n>>> -\telse if (have_git_dir())\n>>> -\t\tgit_dir = get_git_dir();\n>>>  \telse\n>>>  \t\tgoto done;\n>>\n>> I wonder if this should have a sanity-check:\n>>\n>> \telse if (have_git_dir())\n>> \t\tBUG(\"caller forgot to set opts->git_dir\");\n>>\n>> Alternatively, could this patch rename git_config_with_options?  That\n>> way any other patch in flight that calls git_config_with_options would\n>> conflict with this patch, giving us an opportunity to make sure it\n>> also sets git_dir.  As another nice side benefit it would make it easy\n>> for someone reading the patch to verify it didn't miss any callers.\n>\n> That kind of defeats the purpose of the patch.  The point is to not rely\n> on global repository state and with the BUG statement we still are\n> relying on global state.\n\nBy \"that\" are you referring to the BUG()?  I agree --- I'd prefer\nrenaming the function over adding a BUG() to catch mistaken old callers,\nso I shouldn't have mentioned the idea.  I mentioned it to give another\nexample of how to make this kind of change safely.\n\n> And I don't know if I agree with renaming a function just to rename it.\n\nIt is not renaming just to rename: this is approximately the only safe\nway that the Git project has to make a significant breaking change to\nthe API of a function.  In a project where people push directly to the\nrepository in a fast-forward way, it may be possible to make such a\nchange by announcing it loudly and relying on patch authors keeping\ntrack of what is happening in the repository.  But in a project like\nGit that juggles multiple patches in flight, some more explicit\ncoordination, for example by renaming the identifier, is needed.\n\nSorry.\n\nDo you have another method in mind?\n\nThanks,\nJonathan\n"},{"id":"322040","messageId":"20170613013817.GE133952@aiede.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170613012337.GH154599@google.com","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-13T01:38:17Z","receivedAt":"2017-06-13T01:38:25Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi again,\n\nBrandon Williams wrote:\n> On 06/12, Jonathan Nieder wrote:\n\n>> Alternatively, could this patch rename git_config_with_options?  That\n>> way any other patch in flight that calls git_config_with_options would\n>> conflict with this patch, giving us an opportunity to make sure it\n>> also sets git_dir.  As another nice side benefit it would make it easy\n>> for someone reading the patch to verify it didn't miss any callers.\n[...]\n> And I don't know if I agree with renaming a function just to rename it.\n\nI forgot to say: another way to accomplish the same thing can be to\nreorder the function's arguments.  The relevant thing is to make code\nthat calls the function without being aware of the new requirements\nfail to compile.\n\n[...]\n>> Brandon Williams wrote:\n\n>>>  \topts.respect_includes = 1;\n>>> +\tif (have_git_dir())\n>>> +\t\topts.git_dir = get_git_common_dir();\n>>\n>> curious: Why get_git_common_dir() instead of get_git_dir()?\n>\n> Needs to be commondir since the config is stored in the common git\n> directory and not a per worktree git directory.\n\n*puzzled* Why wasn't this needed before, then?  The rest of the patch\nshould result in no functional change, but this part seems different.\n\nPlease add some explanation to the commit message.\n\nThanks,\nJonathan\n"},{"id":"322043","messageId":"20170613025945.v54vrza2n23tk5pw@sigill.intra.peff.net","threadId":"46161","inReplyTo":"20170613013817.GE133952@aiede.mtv.corp.google.com","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-06-13T02:59:45Z","receivedAt":"2017-06-13T02:59:54Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 12, 2017 at 06:38:17PM -0700, Jonathan Nieder wrote:\n\n> Brandon Williams wrote:\n> > On 06/12, Jonathan Nieder wrote:\n> \n> >> Alternatively, could this patch rename git_config_with_options?  That\n> >> way any other patch in flight that calls git_config_with_options would\n> >> conflict with this patch, giving us an opportunity to make sure it\n> >> also sets git_dir.  As another nice side benefit it would make it easy\n> >> for someone reading the patch to verify it didn't miss any callers.\n> [...]\n> > And I don't know if I agree with renaming a function just to rename it.\n> \n> I forgot to say: another way to accomplish the same thing can be to\n> reorder the function's arguments.  The relevant thing is to make code\n> that calls the function without being aware of the new requirements\n> fail to compile.\n\nIf the parameter is now required, then it might make sense for it to\nbecome an actual function parameter instead of being stuffed into the\nconfig_options struct. That would give you your breaking change, plus\nmake it more obvious to the reader that it is not optional.\n\nThe downside is that has to get shuttled around manually through the\ncallstack. Most of the damage is in builtin/config.c, where we call\ngit_config_with_options() a lot.\n\ninclude_by_gitdir is also a bit annoying, as we pass around the\nconfig_options struct through our void-pointer callbacks. But we can\nsolve that by sticking the git_dir into the include_data struct (whose\nexact purpose is to carry the information we need to handle includes).\n\nThe patch below (on top of Brandon's series does that).\n\n> >>> +\tif (have_git_dir())\n> >>> +\t\topts.git_dir = get_git_common_dir();\n> >>\n> >> curious: Why get_git_common_dir() instead of get_git_dir()?\n> >\n> > Needs to be commondir since the config is stored in the common git\n> > directory and not a per worktree git directory.\n> \n> *puzzled* Why wasn't this needed before, then?  The rest of the patch\n> should result in no functional change, but this part seems different.\n\nNow I'm puzzled, too. The original that got filled in lazily by the\nconfig functions was always get_git_dir(). I can buy the argument that\nthis was a bug (I'm not familiar enough with worktree to say one way or\nthe other), but if it's a fix it should definitely go into another\npatch.\n\n---\n builtin/config.c | 17 ++++++++++----\n config.c         | 43 +++++++++++++++++++----------------\n config.h         |  4 ++--\n 3 files changed, 37 insertions(+), 27 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 90f49a6ee..f5dd6f7ff 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -29,6 +29,7 @@ static int actions, types;\n static int end_null;\n static int respect_includes_opt = -1;\n static struct config_options config_options;\n+const char *config_git_dir;\n static int show_origin;\n \n #define ACTION_GET (1<<0)\n@@ -244,7 +245,9 @@ static int get_value(const char *key_, const char *regex_)\n \t}\n \n \tgit_config_with_options(collect_config, &values,\n-\t\t\t\t&given_config_source, &config_options);\n+\t\t\t\t&given_config_source,\n+\t\t\t\tconfig_git_dir,\n+\t\t\t\t&config_options);\n \n \tret = !values.nr;\n \n@@ -322,7 +325,8 @@ static void get_color(const char *var, const char *def_color)\n \tget_color_found = 0;\n \tparsed_color[0] = '\\0';\n \tgit_config_with_options(git_get_color_config, NULL,\n-\t\t\t\t&given_config_source, &config_options);\n+\t\t\t\t&given_config_source,\n+\t\t\t\tconfig_git_dir, &config_options);\n \n \tif (!get_color_found && def_color) {\n \t\tif (color_parse(def_color, parsed_color) < 0)\n@@ -354,7 +358,8 @@ static int get_colorbool(const char *var, int print)\n \tget_diff_color_found = -1;\n \tget_color_ui_found = -1;\n \tgit_config_with_options(git_get_colorbool_config, NULL,\n-\t\t\t\t&given_config_source, &config_options);\n+\t\t\t\t&given_config_source,\n+\t\t\t\tconfig_git_dir, &config_options);\n \n \tif (get_colorbool_found < 0) {\n \t\tif (!strcmp(get_colorbool_slot, \"color.diff\"))\n@@ -443,7 +448,8 @@ static int get_urlmatch(const char *var, const char *url)\n \t}\n \n \tgit_config_with_options(urlmatch_config_entry, &config,\n-\t\t\t\t&given_config_source, &config_options);\n+\t\t\t\t&given_config_source, config_git_dir,\n+\t\t\t\t&config_options);\n \n \tret = !values.nr;\n \n@@ -540,7 +546,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \telse\n \t\tconfig_options.respect_includes = respect_includes_opt;\n \tif (have_git_dir())\n-\t\tconfig_options.git_dir = get_git_common_dir();\n+\t\tconfig_git_dir = get_git_common_dir();\n \n \tif (end_null) {\n \t\tterm = '\\0';\n@@ -587,6 +593,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\tcheck_argc(argc, 0, 0);\n \t\tif (git_config_with_options(show_all_config, NULL,\n \t\t\t\t\t    &given_config_source,\n+\t\t\t\t\t    config_git_dir,\n \t\t\t\t\t    &config_options) < 0) {\n \t\t\tif (given_config_source.file)\n \t\t\t\tdie_errno(\"unable to read config file '%s'\",\ndiff --git a/config.c b/config.c\nindex 4e2842689..e1566f7b4 100644\n--- a/config.c\n+++ b/config.c\n@@ -208,21 +208,18 @@ static int prepare_include_condition_pattern(struct strbuf *pat)\n \treturn prefix;\n }\n \n-static int include_by_gitdir(const struct config_options *opts,\n+static int include_by_gitdir(const struct config_include_data *inc,\n \t\t\t     const char *cond, size_t cond_len, int icase)\n {\n \tstruct strbuf text = STRBUF_INIT;\n \tstruct strbuf pattern = STRBUF_INIT;\n \tint ret = 0, prefix;\n-\tconst char *git_dir;\n \tint already_tried_absolute = 0;\n \n-\tif (opts->git_dir)\n-\t\tgit_dir = opts->git_dir;\n-\telse\n+\tif (!inc->git_dir)\n \t\tgoto done;\n \n-\tstrbuf_realpath(&text, git_dir, 1);\n+\tstrbuf_realpath(&text, inc->git_dir, 1);\n \tstrbuf_add(&pattern, cond, cond_len);\n \tprefix = prepare_include_condition_pattern(&pattern);\n \n@@ -256,7 +253,7 @@ static int include_by_gitdir(const struct config_options *opts,\n \t\t * which'll do the right thing\n \t\t */\n \t\tstrbuf_reset(&text);\n-\t\tstrbuf_add_absolute_path(&text, git_dir);\n+\t\tstrbuf_add_absolute_path(&text, inc->git_dir);\n \t\talready_tried_absolute = 1;\n \t\tgoto again;\n \t}\n@@ -266,14 +263,14 @@ static int include_by_gitdir(const struct config_options *opts,\n \treturn ret;\n }\n \n-static int include_condition_is_true(const struct config_options *opts,\n+static int include_condition_is_true(const struct config_include_data *inc,\n \t\t\t\t     const char *cond, size_t cond_len)\n {\n \n \tif (skip_prefix_mem(cond, cond_len, \"gitdir:\", &cond, &cond_len))\n-\t\treturn include_by_gitdir(opts, cond, cond_len, 0);\n+\t\treturn include_by_gitdir(inc, cond, cond_len, 0);\n \telse if (skip_prefix_mem(cond, cond_len, \"gitdir/i:\", &cond, &cond_len))\n-\t\treturn include_by_gitdir(opts, cond, cond_len, 1);\n+\t\treturn include_by_gitdir(inc, cond, cond_len, 1);\n \n \t/* unknown conditionals are always false */\n \treturn 0;\n@@ -298,7 +295,7 @@ int git_config_include(const char *var, const char *value, void *data)\n \t\tret = handle_path_include(value, inc);\n \n \tif (!parse_config_key(var, \"includeif\", &cond, &cond_len, &key) &&\n-\t    (cond && include_condition_is_true(inc->opts, cond, cond_len)) &&\n+\t    (cond && include_condition_is_true(inc, cond, cond_len)) &&\n \t    !strcmp(key, \"path\"))\n \t\tret = handle_path_include(value, inc);\n \n@@ -1537,6 +1534,7 @@ int git_config_system(void)\n }\n \n static int do_git_config_sequence(const struct config_options *opts,\n+\t\t\t\t  const char *git_dir,\n \t\t\t\t  config_fn_t fn, void *data)\n {\n \tint ret = 0;\n@@ -1544,8 +1542,8 @@ static int do_git_config_sequence(const struct config_options *opts,\n \tchar *user_config = expand_user_path(\"~/.gitconfig\", 0);\n \tchar *repo_config;\n \n-\tif (opts->git_dir)\n-\t\trepo_config = mkpathdup(\"%s/config\", opts->git_dir);\n+\tif (git_dir)\n+\t\trepo_config = mkpathdup(\"%s/config\", git_dir);\n \telse\n \t\trepo_config = NULL;\n \n@@ -1578,6 +1576,7 @@ static int do_git_config_sequence(const struct config_options *opts,\n \n int git_config_with_options(config_fn_t fn, void *data,\n \t\t\t    struct git_config_source *config_source,\n+\t\t\t    const char *git_dir,\n \t\t\t    const struct config_options *opts)\n {\n \tstruct config_include_data inc = CONFIG_INCLUDE_INIT;\n@@ -1585,7 +1584,7 @@ int git_config_with_options(config_fn_t fn, void *data,\n \tif (opts->respect_includes) {\n \t\tinc.fn = fn;\n \t\tinc.data = data;\n-\t\tinc.opts = opts;\n+\t\tinc.git_dir = git_dir;\n \t\tfn = git_config_include;\n \t\tdata = &inc;\n \t}\n@@ -1601,17 +1600,18 @@ int git_config_with_options(config_fn_t fn, void *data,\n \telse if (config_source && config_source->blob)\n \t\treturn git_config_from_blob_ref(fn, config_source->blob, data);\n \n-\treturn do_git_config_sequence(opts, fn, data);\n+\treturn do_git_config_sequence(opts, git_dir, fn, data);\n }\n \n static void git_config_raw(config_fn_t fn, void *data)\n {\n \tstruct config_options opts = {0};\n+\tconst char *git_dir;\n \n \topts.respect_includes = 1;\n \tif (have_git_dir())\n-\t\topts.git_dir = get_git_common_dir();\n-\tif (git_config_with_options(fn, data, NULL, &opts) < 0)\n+\t\tgit_dir = get_git_common_dir();\n+\tif (git_config_with_options(fn, data, NULL, git_dir, &opts) < 0)\n \t\t/*\n \t\t * git_config_with_options() normally returns only\n \t\t * zero, as most errors are fatal, and\n@@ -1653,11 +1653,12 @@ void read_early_config(config_fn_t cb, void *data)\n {\n \tstruct config_options opts = {0};\n \tstruct strbuf buf = STRBUF_INIT;\n+\tconst char *git_dir;\n \n \topts.respect_includes = 1;\n \n \tif (have_git_dir())\n-\t\topts.git_dir = get_git_dir();\n+\t\tgit_dir = get_git_dir();\n \t/*\n \t * When setup_git_directory() was not yet asked to discover the\n \t * GIT_DIR, we ask discover_git_directory() to figure out whether there\n@@ -1667,9 +1668,11 @@ void read_early_config(config_fn_t cb, void *data)\n \t * call).\n \t */\n \telse if (discover_git_directory(&buf))\n-\t\topts.git_dir = buf.buf;\n+\t\tgit_dir = buf.buf;\n+\telse\n+\t\tgit_dir = NULL;\n \n-\tgit_config_with_options(cb, data, NULL, &opts);\n+\tgit_config_with_options(cb, data, NULL, git_dir, &opts);\n \n \tstrbuf_release(&buf);\n }\ndiff --git a/config.h b/config.h\nindex c70599bd5..47a8e8845 100644\n--- a/config.h\n+++ b/config.h\n@@ -30,7 +30,6 @@ enum config_origin_type {\n \n struct config_options {\n \tunsigned int respect_includes : 1;\n-\tconst char *git_dir;\n };\n \n typedef int (*config_fn_t)(const char *, const char *, void *);\n@@ -46,6 +45,7 @@ extern void read_early_config(config_fn_t cb, void *data);\n extern void git_config(config_fn_t fn, void *);\n extern int git_config_with_options(config_fn_t fn, void *,\n \t\t\t\t   struct git_config_source *config_source,\n+\t\t\t\t   const char *git_dir,\n \t\t\t\t   const struct config_options *opts);\n extern int git_parse_ulong(const char *, unsigned long *);\n extern int git_parse_maybe_bool(const char *);\n@@ -97,7 +97,7 @@ struct config_include_data {\n \tint depth;\n \tconfig_fn_t fn;\n \tvoid *data;\n-\tconst struct config_options *opts;\n+\tconst char *git_dir;\n };\n #define CONFIG_INCLUDE_INIT { 0 }\n extern int git_config_include(const char *name, const char *value, void *data);\n"},{"id":"322047","messageId":"20170613055243.GI154599@google.com","threadId":"46161","inReplyTo":"20170613013817.GE133952@aiede.mtv.corp.google.com","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T05:52:43Z","receivedAt":"2017-06-13T05:52:53Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/12, Jonathan Nieder wrote:\n> Hi again,\n> \n> Brandon Williams wrote:\n> > On 06/12, Jonathan Nieder wrote:\n> \n> >> Alternatively, could this patch rename git_config_with_options?  That\n> >> way any other patch in flight that calls git_config_with_options would\n> >> conflict with this patch, giving us an opportunity to make sure it\n> >> also sets git_dir.  As another nice side benefit it would make it easy\n> >> for someone reading the patch to verify it didn't miss any callers.\n> [...]\n> > And I don't know if I agree with renaming a function just to rename it.\n> \n> I forgot to say: another way to accomplish the same thing can be to\n> reorder the function's arguments.  The relevant thing is to make code\n> that calls the function without being aware of the new requirements\n> fail to compile.\n> \n> [...]\n> >> Brandon Williams wrote:\n> \n> >>>  \topts.respect_includes = 1;\n> >>> +\tif (have_git_dir())\n> >>> +\t\topts.git_dir = get_git_common_dir();\n> >>\n> >> curious: Why get_git_common_dir() instead of get_git_dir()?\n> >\n> > Needs to be commondir since the config is stored in the common git\n> > directory and not a per worktree git directory.\n> \n> *puzzled* Why wasn't this needed before, then?  The rest of the patch\n> should result in no functional change, but this part seems different.\n\nthere is no functional change, this is what always happened.\ngit_path(\"config\") will replace gitdir with commondir under the hood.\n\n> \n> Please add some explanation to the commit message.\n> \n> Thanks,\n> Jonathan\n\n-- \nBrandon Williams\n"},{"id":"322048","messageId":"20170613061627.GJ154599@google.com","threadId":"46161","inReplyTo":"20170613025945.v54vrza2n23tk5pw@sigill.intra.peff.net","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T06:16:27Z","receivedAt":"2017-06-13T06:16:41Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/12, Jeff King wrote:\n> On Mon, Jun 12, 2017 at 06:38:17PM -0700, Jonathan Nieder wrote:\n> \n> > Brandon Williams wrote:\n> > > On 06/12, Jonathan Nieder wrote:\n> > \n> > >> Alternatively, could this patch rename git_config_with_options?  That\n> > >> way any other patch in flight that calls git_config_with_options would\n> > >> conflict with this patch, giving us an opportunity to make sure it\n> > >> also sets git_dir.  As another nice side benefit it would make it easy\n> > >> for someone reading the patch to verify it didn't miss any callers.\n> > [...]\n> > > And I don't know if I agree with renaming a function just to rename it.\n> > \n> > I forgot to say: another way to accomplish the same thing can be to\n> > reorder the function's arguments.  The relevant thing is to make code\n> > that calls the function without being aware of the new requirements\n> > fail to compile.\n> \n> If the parameter is now required, then it might make sense for it to\n> become an actual function parameter instead of being stuffed into the\n> config_options struct. That would give you your breaking change, plus\n> make it more obvious to the reader that it is not optional.\n> \n> The downside is that has to get shuttled around manually through the\n> callstack. Most of the damage is in builtin/config.c, where we call\n> git_config_with_options() a lot.\n> \n> include_by_gitdir is also a bit annoying, as we pass around the\n> config_options struct through our void-pointer callbacks. But we can\n> solve that by sticking the git_dir into the include_data struct (whose\n> exact purpose is to carry the information we need to handle includes).\n> \n> The patch below (on top of Brandon's series does that).\n\nI really don't understand why this has to be so difficult and why a\n'breaking change' is even needed.  Duy just added the 'git_dir' field to\nthe config_options struct in April of this year (2185fde56 config:\nhandle conditional include when $GIT_DIR is not set up) and now we want\nto strip it out again?  That's not even two months. Seems very counter\nproductive and makes the api more unwieldy.\n\n> \n> > >>> +\tif (have_git_dir())\n> > >>> +\t\topts.git_dir = get_git_common_dir();\n> > >>\n> > >> curious: Why get_git_common_dir() instead of get_git_dir()?\n> > >\n> > > Needs to be commondir since the config is stored in the common git\n> > > directory and not a per worktree git directory.\n> > \n> > *puzzled* Why wasn't this needed before, then?  The rest of the patch\n> > should result in no functional change, but this part seems different.\n> \n> Now I'm puzzled, too. The original that got filled in lazily by the\n> config functions was always get_git_dir(). I can buy the argument that\n> this was a bug (I'm not familiar enough with worktree to say one way or\n> the other), but if it's a fix it should definitely go into another\n> patch.\n\nWell actually... in do_git_config_sequence 'git_path(\"config\")' is\ncalled which will convert gitdir to commondir under the hood.  you can't\nuse vanilla gitdir because the config isn't stored in a worktree's\ngitdir but rather in the commondir as the config is shared by all\nworktrees.\n\nSo maybe we actually need to add a field to the 'config_options' struct\nof 'commondir' such that the commondir can be used to load the actual\nconfig file and 'gitdir' can be used to handle the 'IncludeIf' stuff.\n\n> \n> ---\n>  builtin/config.c | 17 ++++++++++----\n>  config.c         | 43 +++++++++++++++++++----------------\n>  config.h         |  4 ++--\n>  3 files changed, 37 insertions(+), 27 deletions(-)\n> \n> diff --git a/builtin/config.c b/builtin/config.c\n> index 90f49a6ee..f5dd6f7ff 100644\n> --- a/builtin/config.c\n> +++ b/builtin/config.c\n> @@ -29,6 +29,7 @@ static int actions, types;\n>  static int end_null;\n>  static int respect_includes_opt = -1;\n>  static struct config_options config_options;\n> +const char *config_git_dir;\n>  static int show_origin;\n>  \n>  #define ACTION_GET (1<<0)\n> @@ -244,7 +245,9 @@ static int get_value(const char *key_, const char *regex_)\n>  \t}\n>  \n>  \tgit_config_with_options(collect_config, &values,\n> -\t\t\t\t&given_config_source, &config_options);\n> +\t\t\t\t&given_config_source,\n> +\t\t\t\tconfig_git_dir,\n> +\t\t\t\t&config_options);\n>  \n>  \tret = !values.nr;\n>  \n> @@ -322,7 +325,8 @@ static void get_color(const char *var, const char *def_color)\n>  \tget_color_found = 0;\n>  \tparsed_color[0] = '\\0';\n>  \tgit_config_with_options(git_get_color_config, NULL,\n> -\t\t\t\t&given_config_source, &config_options);\n> +\t\t\t\t&given_config_source,\n> +\t\t\t\tconfig_git_dir, &config_options);\n>  \n>  \tif (!get_color_found && def_color) {\n>  \t\tif (color_parse(def_color, parsed_color) < 0)\n> @@ -354,7 +358,8 @@ static int get_colorbool(const char *var, int print)\n>  \tget_diff_color_found = -1;\n>  \tget_color_ui_found = -1;\n>  \tgit_config_with_options(git_get_colorbool_config, NULL,\n> -\t\t\t\t&given_config_source, &config_options);\n> +\t\t\t\t&given_config_source,\n> +\t\t\t\tconfig_git_dir, &config_options);\n>  \n>  \tif (get_colorbool_found < 0) {\n>  \t\tif (!strcmp(get_colorbool_slot, \"color.diff\"))\n> @@ -443,7 +448,8 @@ static int get_urlmatch(const char *var, const char *url)\n>  \t}\n>  \n>  \tgit_config_with_options(urlmatch_config_entry, &config,\n> -\t\t\t\t&given_config_source, &config_options);\n> +\t\t\t\t&given_config_source, config_git_dir,\n> +\t\t\t\t&config_options);\n>  \n>  \tret = !values.nr;\n>  \n> @@ -540,7 +546,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n>  \telse\n>  \t\tconfig_options.respect_includes = respect_includes_opt;\n>  \tif (have_git_dir())\n> -\t\tconfig_options.git_dir = get_git_common_dir();\n> +\t\tconfig_git_dir = get_git_common_dir();\n>  \n>  \tif (end_null) {\n>  \t\tterm = '\\0';\n> @@ -587,6 +593,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n>  \t\tcheck_argc(argc, 0, 0);\n>  \t\tif (git_config_with_options(show_all_config, NULL,\n>  \t\t\t\t\t    &given_config_source,\n> +\t\t\t\t\t    config_git_dir,\n>  \t\t\t\t\t    &config_options) < 0) {\n>  \t\t\tif (given_config_source.file)\n>  \t\t\t\tdie_errno(\"unable to read config file '%s'\",\n> diff --git a/config.c b/config.c\n> index 4e2842689..e1566f7b4 100644\n> --- a/config.c\n> +++ b/config.c\n> @@ -208,21 +208,18 @@ static int prepare_include_condition_pattern(struct strbuf *pat)\n>  \treturn prefix;\n>  }\n>  \n> -static int include_by_gitdir(const struct config_options *opts,\n> +static int include_by_gitdir(const struct config_include_data *inc,\n>  \t\t\t     const char *cond, size_t cond_len, int icase)\n>  {\n>  \tstruct strbuf text = STRBUF_INIT;\n>  \tstruct strbuf pattern = STRBUF_INIT;\n>  \tint ret = 0, prefix;\n> -\tconst char *git_dir;\n>  \tint already_tried_absolute = 0;\n>  \n> -\tif (opts->git_dir)\n> -\t\tgit_dir = opts->git_dir;\n> -\telse\n> +\tif (!inc->git_dir)\n>  \t\tgoto done;\n>  \n> -\tstrbuf_realpath(&text, git_dir, 1);\n> +\tstrbuf_realpath(&text, inc->git_dir, 1);\n>  \tstrbuf_add(&pattern, cond, cond_len);\n>  \tprefix = prepare_include_condition_pattern(&pattern);\n>  \n> @@ -256,7 +253,7 @@ static int include_by_gitdir(const struct config_options *opts,\n>  \t\t * which'll do the right thing\n>  \t\t */\n>  \t\tstrbuf_reset(&text);\n> -\t\tstrbuf_add_absolute_path(&text, git_dir);\n> +\t\tstrbuf_add_absolute_path(&text, inc->git_dir);\n>  \t\talready_tried_absolute = 1;\n>  \t\tgoto again;\n>  \t}\n> @@ -266,14 +263,14 @@ static int include_by_gitdir(const struct config_options *opts,\n>  \treturn ret;\n>  }\n>  \n> -static int include_condition_is_true(const struct config_options *opts,\n> +static int include_condition_is_true(const struct config_include_data *inc,\n>  \t\t\t\t     const char *cond, size_t cond_len)\n>  {\n>  \n>  \tif (skip_prefix_mem(cond, cond_len, \"gitdir:\", &cond, &cond_len))\n> -\t\treturn include_by_gitdir(opts, cond, cond_len, 0);\n> +\t\treturn include_by_gitdir(inc, cond, cond_len, 0);\n>  \telse if (skip_prefix_mem(cond, cond_len, \"gitdir/i:\", &cond, &cond_len))\n> -\t\treturn include_by_gitdir(opts, cond, cond_len, 1);\n> +\t\treturn include_by_gitdir(inc, cond, cond_len, 1);\n>  \n>  \t/* unknown conditionals are always false */\n>  \treturn 0;\n> @@ -298,7 +295,7 @@ int git_config_include(const char *var, const char *value, void *data)\n>  \t\tret = handle_path_include(value, inc);\n>  \n>  \tif (!parse_config_key(var, \"includeif\", &cond, &cond_len, &key) &&\n> -\t    (cond && include_condition_is_true(inc->opts, cond, cond_len)) &&\n> +\t    (cond && include_condition_is_true(inc, cond, cond_len)) &&\n>  \t    !strcmp(key, \"path\"))\n>  \t\tret = handle_path_include(value, inc);\n>  \n> @@ -1537,6 +1534,7 @@ int git_config_system(void)\n>  }\n>  \n>  static int do_git_config_sequence(const struct config_options *opts,\n> +\t\t\t\t  const char *git_dir,\n>  \t\t\t\t  config_fn_t fn, void *data)\n>  {\n>  \tint ret = 0;\n> @@ -1544,8 +1542,8 @@ static int do_git_config_sequence(const struct config_options *opts,\n>  \tchar *user_config = expand_user_path(\"~/.gitconfig\", 0);\n>  \tchar *repo_config;\n>  \n> -\tif (opts->git_dir)\n> -\t\trepo_config = mkpathdup(\"%s/config\", opts->git_dir);\n> +\tif (git_dir)\n> +\t\trepo_config = mkpathdup(\"%s/config\", git_dir);\n>  \telse\n>  \t\trepo_config = NULL;\n>  \n> @@ -1578,6 +1576,7 @@ static int do_git_config_sequence(const struct config_options *opts,\n>  \n>  int git_config_with_options(config_fn_t fn, void *data,\n>  \t\t\t    struct git_config_source *config_source,\n> +\t\t\t    const char *git_dir,\n>  \t\t\t    const struct config_options *opts)\n>  {\n>  \tstruct config_include_data inc = CONFIG_INCLUDE_INIT;\n> @@ -1585,7 +1584,7 @@ int git_config_with_options(config_fn_t fn, void *data,\n>  \tif (opts->respect_includes) {\n>  \t\tinc.fn = fn;\n>  \t\tinc.data = data;\n> -\t\tinc.opts = opts;\n> +\t\tinc.git_dir = git_dir;\n>  \t\tfn = git_config_include;\n>  \t\tdata = &inc;\n>  \t}\n> @@ -1601,17 +1600,18 @@ int git_config_with_options(config_fn_t fn, void *data,\n>  \telse if (config_source && config_source->blob)\n>  \t\treturn git_config_from_blob_ref(fn, config_source->blob, data);\n>  \n> -\treturn do_git_config_sequence(opts, fn, data);\n> +\treturn do_git_config_sequence(opts, git_dir, fn, data);\n>  }\n>  \n>  static void git_config_raw(config_fn_t fn, void *data)\n>  {\n>  \tstruct config_options opts = {0};\n> +\tconst char *git_dir;\n>  \n>  \topts.respect_includes = 1;\n>  \tif (have_git_dir())\n> -\t\topts.git_dir = get_git_common_dir();\n> -\tif (git_config_with_options(fn, data, NULL, &opts) < 0)\n> +\t\tgit_dir = get_git_common_dir();\n> +\tif (git_config_with_options(fn, data, NULL, git_dir, &opts) < 0)\n>  \t\t/*\n>  \t\t * git_config_with_options() normally returns only\n>  \t\t * zero, as most errors are fatal, and\n> @@ -1653,11 +1653,12 @@ void read_early_config(config_fn_t cb, void *data)\n>  {\n>  \tstruct config_options opts = {0};\n>  \tstruct strbuf buf = STRBUF_INIT;\n> +\tconst char *git_dir;\n>  \n>  \topts.respect_includes = 1;\n>  \n>  \tif (have_git_dir())\n> -\t\topts.git_dir = get_git_dir();\n> +\t\tgit_dir = get_git_dir();\n>  \t/*\n>  \t * When setup_git_directory() was not yet asked to discover the\n>  \t * GIT_DIR, we ask discover_git_directory() to figure out whether there\n> @@ -1667,9 +1668,11 @@ void read_early_config(config_fn_t cb, void *data)\n>  \t * call).\n>  \t */\n>  \telse if (discover_git_directory(&buf))\n> -\t\topts.git_dir = buf.buf;\n> +\t\tgit_dir = buf.buf;\n> +\telse\n> +\t\tgit_dir = NULL;\n>  \n> -\tgit_config_with_options(cb, data, NULL, &opts);\n> +\tgit_config_with_options(cb, data, NULL, git_dir, &opts);\n>  \n>  \tstrbuf_release(&buf);\n>  }\n> diff --git a/config.h b/config.h\n> index c70599bd5..47a8e8845 100644\n> --- a/config.h\n> +++ b/config.h\n> @@ -30,7 +30,6 @@ enum config_origin_type {\n>  \n>  struct config_options {\n>  \tunsigned int respect_includes : 1;\n> -\tconst char *git_dir;\n>  };\n>  \n>  typedef int (*config_fn_t)(const char *, const char *, void *);\n> @@ -46,6 +45,7 @@ extern void read_early_config(config_fn_t cb, void *data);\n>  extern void git_config(config_fn_t fn, void *);\n>  extern int git_config_with_options(config_fn_t fn, void *,\n>  \t\t\t\t   struct git_config_source *config_source,\n> +\t\t\t\t   const char *git_dir,\n>  \t\t\t\t   const struct config_options *opts);\n>  extern int git_parse_ulong(const char *, unsigned long *);\n>  extern int git_parse_maybe_bool(const char *);\n> @@ -97,7 +97,7 @@ struct config_include_data {\n>  \tint depth;\n>  \tconfig_fn_t fn;\n>  \tvoid *data;\n> -\tconst struct config_options *opts;\n> +\tconst char *git_dir;\n>  };\n>  #define CONFIG_INCLUDE_INIT { 0 }\n>  extern int git_config_include(const char *name, const char *value, void *data);\n\n-- \nBrandon Williams\n"},{"id":"322050","messageId":"20170613062941.r22r64y5ymdpfhbx@sigill.intra.peff.net","threadId":"46161","inReplyTo":"20170613055243.GI154599@google.com","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-06-13T06:29:41Z","receivedAt":"2017-06-13T06:29:48Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 12, 2017 at 10:52:43PM -0700, Brandon Williams wrote:\n\n> > >> curious: Why get_git_common_dir() instead of get_git_dir()?\n> > >\n> > > Needs to be commondir since the config is stored in the common git\n> > > directory and not a per worktree git directory.\n> > \n> > *puzzled* Why wasn't this needed before, then?  The rest of the patch\n> > should result in no functional change, but this part seems different.\n> \n> there is no functional change, this is what always happened.\n> git_path(\"config\") will replace gitdir with commondir under the hood.\n\nOf the two callsites you removed, one is git_pathdup(), and the other\nis get_git_dir(). So they weren't matched, though I suspect the one in\ninclude_by_gitdir probably ought to have been commondir?\n\n-Peff\n"},{"id":"322052","messageId":"20170613064532.pucjnyrftulmjinj@sigill.intra.peff.net","threadId":"46161","inReplyTo":"20170613061627.GJ154599@google.com","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-06-13T06:45:32Z","receivedAt":"2017-06-13T06:45:40Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 12, 2017 at 11:16:27PM -0700, Brandon Williams wrote:\n\n> > If the parameter is now required, then it might make sense for it to\n> > become an actual function parameter instead of being stuffed into the\n> > config_options struct. That would give you your breaking change, plus\n> > make it more obvious to the reader that it is not optional.\n> > \n> > The downside is that has to get shuttled around manually through the\n> > callstack. Most of the damage is in builtin/config.c, where we call\n> > git_config_with_options() a lot.\n> > \n> > include_by_gitdir is also a bit annoying, as we pass around the\n> > config_options struct through our void-pointer callbacks. But we can\n> > solve that by sticking the git_dir into the include_data struct (whose\n> > exact purpose is to carry the information we need to handle includes).\n> > \n> > The patch below (on top of Brandon's series does that).\n> \n> I really don't understand why this has to be so difficult and why a\n> 'breaking change' is even needed.  Duy just added the 'git_dir' field to\n> the config_options struct in April of this year (2185fde56 config:\n> handle conditional include when $GIT_DIR is not set up) and now we want\n> to strip it out again?  That's not even two months. Seems very counter\n> productive and makes the api more unwieldy.\n\nI could go either way on it. But note that you're not just changing the\nexisting opt->git_dir behavior.\n\nIf I call git_config_with_options() without having set opt->git_dir, the\ncall will now quietly ignore repo config. But even before opt->git_dir\nexisted, calling that function would always have read from repo config\n(when we're in one, of course). So if there's a patch in flight that\nadds a call to git_config_with_options(), it's now very subtly broken.\n\nThe reason I say \"I could go either way\" is that we can make a guess as\nto whether there are any topics in flight that add such a call.\n\nThere aren't any in pu right now. That's not the whole world, of course;\npeople may have topics they haven't yet published. Or they may have long\nrunning forks. Git for Windows is one, and I maintain one that GitHub\nuses internally. But GfW is public and doesn't have any new calls (and\nnor does my fork).  In general, it's kind of an unlikely call for a fork\nor a new branch to add.\n\nSo at some point I think we say \"good enough, it's not worth the hassle\"\nand this may be such a case.\n\n-Peff\n"},{"id":"322053","messageId":"20170613070813.v3vthqlqsga7djgz@sigill.intra.peff.net","threadId":"46161","inReplyTo":"20170613061627.GJ154599@google.com","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-06-13T07:08:14Z","receivedAt":"2017-06-13T07:08:21Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 12, 2017 at 11:16:27PM -0700, Brandon Williams wrote:\n\n> > > *puzzled* Why wasn't this needed before, then?  The rest of the patch\n> > > should result in no functional change, but this part seems different.\n> > \n> > Now I'm puzzled, too. The original that got filled in lazily by the\n> > config functions was always get_git_dir(). I can buy the argument that\n> > this was a bug (I'm not familiar enough with worktree to say one way or\n> > the other), but if it's a fix it should definitely go into another\n> > patch.\n> \n> Well actually... in do_git_config_sequence 'git_path(\"config\")' is\n> called which will convert gitdir to commondir under the hood.  you can't\n> use vanilla gitdir because the config isn't stored in a worktree's\n> gitdir but rather in the commondir as the config is shared by all\n> worktrees.\n\nSorry, I missed the fact that there were two sites changed on the first\nread.\n\n> So maybe we actually need to add a field to the 'config_options' struct\n> of 'commondir' such that the commondir can be used to load the actual\n> config file and 'gitdir' can be used to handle the 'IncludeIf' stuff.\n\nOn reflection, I suspect that probably is the case. If you have a\nworkdir in ~/foo, you probably want to match IncludeIf against that\ninstead of wherever the common dir happens to be.\n\n-Peff\n"},{"id":"322090","messageId":"20170613144316.GK154599@google.com","threadId":"46161","inReplyTo":"20170613070813.v3vthqlqsga7djgz@sigill.intra.peff.net","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T14:43:16Z","receivedAt":"2017-06-13T14:43:24Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/13, Jeff King wrote:\n> On Mon, Jun 12, 2017 at 11:16:27PM -0700, Brandon Williams wrote:\n> \n> > > > *puzzled* Why wasn't this needed before, then?  The rest of the patch\n> > > > should result in no functional change, but this part seems different.\n> > > \n> > > Now I'm puzzled, too. The original that got filled in lazily by the\n> > > config functions was always get_git_dir(). I can buy the argument that\n> > > this was a bug (I'm not familiar enough with worktree to say one way or\n> > > the other), but if it's a fix it should definitely go into another\n> > > patch.\n> > \n> > Well actually... in do_git_config_sequence 'git_path(\"config\")' is\n> > called which will convert gitdir to commondir under the hood.  you can't\n> > use vanilla gitdir because the config isn't stored in a worktree's\n> > gitdir but rather in the commondir as the config is shared by all\n> > worktrees.\n> \n> Sorry, I missed the fact that there were two sites changed on the first\n> read.\n\nWell I missed that fact when I first wrote these patches too :)\n\n> \n> > So maybe we actually need to add a field to the 'config_options' struct\n> > of 'commondir' such that the commondir can be used to load the actual\n> > config file and 'gitdir' can be used to handle the 'IncludeIf' stuff.\n> \n> On reflection, I suspect that probably is the case. If you have a\n> workdir in ~/foo, you probably want to match IncludeIf against that\n> instead of wherever the common dir happens to be.\n\nK I'll look into adding that then.  I will say keeping track of\n'commondir' vs 'gitdir' does get slightly confusing.\n\n-- \nBrandon Williams\n"},{"id":"322091","messageId":"20170613144717.GL154599@google.com","threadId":"46161","inReplyTo":"20170613062941.r22r64y5ymdpfhbx@sigill.intra.peff.net","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T14:47:17Z","receivedAt":"2017-06-13T14:47:24Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/13, Jeff King wrote:\n> On Mon, Jun 12, 2017 at 10:52:43PM -0700, Brandon Williams wrote:\n> \n> > > >> curious: Why get_git_common_dir() instead of get_git_dir()?\n> > > >\n> > > > Needs to be commondir since the config is stored in the common git\n> > > > directory and not a per worktree git directory.\n> > > \n> > > *puzzled* Why wasn't this needed before, then?  The rest of the patch\n> > > should result in no functional change, but this part seems different.\n> > \n> > there is no functional change, this is what always happened.\n> > git_path(\"config\") will replace gitdir with commondir under the hood.\n> \n> Of the two callsites you removed, one is git_pathdup(), and the other\n> is get_git_dir(). So they weren't matched, though I suspect the one in\n> include_by_gitdir probably ought to have been commondir?\n\nGood point, I hope my reply on the other part of the thread answers\nthis.\n\n-- \nBrandon Williams\n"},{"id":"322103","messageId":"20170613170621.GG133952@aiede.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170613025945.v54vrza2n23tk5pw@sigill.intra.peff.net","subject":"Re: [PATCH 4/4] config: don't implicitly use gitdir","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-13T17:06:21Z","receivedAt":"2017-06-13T17:06:29Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jeff King wrote:\n> On Mon, Jun 12, 2017 at 06:38:17PM -0700, Jonathan Nieder wrote:\n>> Brandon Williams wrote:\n>>> On 06/12, Jonathan Nieder wrote:\n\n>>>> Alternatively, could this patch rename git_config_with_options?  That\n>>>> way any other patch in flight that calls git_config_with_options would\n>>>> conflict with this patch, giving us an opportunity to make sure it\n>>>> also sets git_dir.  As another nice side benefit it would make it easy\n>>>> for someone reading the patch to verify it didn't miss any callers.\n>> [...]\n>>> And I don't know if I agree with renaming a function just to rename it.\n>>\n>> I forgot to say: another way to accomplish the same thing can be to\n>> reorder the function's arguments.  The relevant thing is to make code\n>> that calls the function without being aware of the new requirements\n>> fail to compile.\n>\n> If the parameter is now required, then it might make sense for it to\n> become an actual function parameter instead of being stuffed into the\n> config_options struct. That would give you your breaking change, plus\n> make it more obvious to the reader that it is not optional.\n\nI like it.  I also like that in your proposed patch the no longer\nnecessary local git_dir goes away.\n\nWhat's the next step?  The discussion of get_git_common_dir() reveals\nthat switching from git_path() to mkpathdup() loses the\nadjust_git_path() step and everything becomes complicated.  So perhaps\nadding opts.git_common_dir and using that instead of git_path should\nhappen as a preliminary patch, making this patch afterward a more\nstraightforward refactoring.\n\nThanks,\nJonathan\n"},{"id":"322139","messageId":"20170613210321.152978-1-bmwill@google.com","threadId":"46161","inReplyTo":"20170612213406.83247-1-bmwill@google.com","subject":"[PATCH v2 0/6] config.h","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T21:03:15Z","receivedAt":"2017-06-13T21:03:38Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Changes in v2:\n * Fix a small nit in builtin/config.c that Jonathan pointed out.\n * Added two patches which ensure that the repository wide config is properly\n   read by providing 'commondir' as a field in the 'config_options' struct.\n\nBrandon Williams (6):\n  config: create config.h\n  config: remove git_config_iter\n  config: don't include config.h by default\n  config: don't implicitly use gitdir\n  setup: teach discover_git_directory to respect the commondir\n  config: respect commondir\n\n--- interdiff with 'origin/bw/config-h'\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 90f49a6ee..8b6e227c5 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -539,8 +539,10 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\tconfig_options.respect_includes = !given_config_source.file;\n \telse\n \t\tconfig_options.respect_includes = respect_includes_opt;\n-\tif (have_git_dir())\n-\t\tconfig_options.git_dir = get_git_common_dir();\n+\tif (!nongit) {\n+\t\tconfig_options.commondir = get_git_common_dir();\n+\t\tconfig_options.git_dir = get_git_dir();\n+\t}\n \n \tif (end_null) {\n \t\tterm = '\\0';\ndiff --git a/cache.h b/cache.h\nindex fd45b8c55..a4176436d 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -530,7 +530,8 @@ extern void setup_work_tree(void);\n  * appended to gitdir. The return value is either NULL if no repository was\n  * found, or pointing to the path inside gitdir's buffer.\n  */\n-extern const char *discover_git_directory(struct strbuf *gitdir);\n+extern const char *discover_git_directory(struct strbuf *commondir,\n+\t\t\t\t\t  struct strbuf *gitdir);\n extern const char *setup_git_directory_gently(int *);\n extern const char *setup_git_directory(void);\n extern char *prefix_path(const char *prefix, int len, const char *path);\ndiff --git a/config.c b/config.c\nindex 4e2842689..81151fb54 100644\n--- a/config.c\n+++ b/config.c\n@@ -1544,8 +1544,8 @@ static int do_git_config_sequence(const struct config_options *opts,\n \tchar *user_config = expand_user_path(\"~/.gitconfig\", 0);\n \tchar *repo_config;\n \n-\tif (opts->git_dir)\n-\t\trepo_config = mkpathdup(\"%s/config\", opts->git_dir);\n+\tif (opts->commondir)\n+\t\trepo_config = mkpathdup(\"%s/config\", opts->commondir);\n \telse\n \t\trepo_config = NULL;\n \n@@ -1609,8 +1609,11 @@ static void git_config_raw(config_fn_t fn, void *data)\n \tstruct config_options opts = {0};\n \n \topts.respect_includes = 1;\n-\tif (have_git_dir())\n-\t\topts.git_dir = get_git_common_dir();\n+\tif (have_git_dir()) {\n+\t\topts.commondir = get_git_common_dir();\n+\t\topts.git_dir = get_git_dir();\n+\t}\n+\n \tif (git_config_with_options(fn, data, NULL, &opts) < 0)\n \t\t/*\n \t\t * git_config_with_options() normally returns only\n@@ -1652,11 +1655,13 @@ static void configset_iter(struct config_set *cs, config_fn_t fn, void *data)\n void read_early_config(config_fn_t cb, void *data)\n {\n \tstruct config_options opts = {0};\n-\tstruct strbuf buf = STRBUF_INIT;\n+\tstruct strbuf commondir = STRBUF_INIT;\n+\tstruct strbuf gitdir = STRBUF_INIT;\n \n \topts.respect_includes = 1;\n \n-\tif (have_git_dir())\n+\tif (have_git_dir()) {\n+\t\topts.commondir = get_git_common_dir();\n \t\topts.git_dir = get_git_dir();\n \t/*\n \t * When setup_git_directory() was not yet asked to discover the\n@@ -1666,12 +1671,15 @@ void read_early_config(config_fn_t cb, void *data)\n \t * notably, the current working directory is still the same after the\n \t * call).\n \t */\n-\telse if (discover_git_directory(&buf))\n-\t\topts.git_dir = buf.buf;\n+\t} else if (discover_git_directory(&commondir, &gitdir)) {\n+\t\topts.commondir = commondir.buf;\n+\t\topts.git_dir = gitdir.buf;\n+\t}\n \n \tgit_config_with_options(cb, data, NULL, &opts);\n \n-\tstrbuf_release(&buf);\n+\tstrbuf_release(&commondir);\n+\tstrbuf_release(&gitdir);\n }\n \n static void git_config_check_init(void);\ndiff --git a/config.h b/config.h\nindex c70599bd5..63b92784c 100644\n--- a/config.h\n+++ b/config.h\n@@ -30,6 +30,7 @@ enum config_origin_type {\n \n struct config_options {\n \tunsigned int respect_includes : 1;\n+\tconst char *commondir;\n \tconst char *git_dir;\n };\n \ndiff --git a/setup.c b/setup.c\nindex e99a82cbe..7bbb8736f 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -946,10 +946,12 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,\n \t}\n }\n \n-const char *discover_git_directory(struct strbuf *gitdir)\n+const char *discover_git_directory(struct strbuf *commondir,\n+\t\t\t\t   struct strbuf *gitdir)\n {\n \tstruct strbuf dir = STRBUF_INIT, err = STRBUF_INIT;\n \tsize_t gitdir_offset = gitdir->len, cwd_len;\n+\tsize_t commondir_offset = commondir->len;\n \tstruct repository_format candidate;\n \n \tif (strbuf_getcwd(&dir))\n@@ -974,8 +976,10 @@ const char *discover_git_directory(struct strbuf *gitdir)\n \t\tstrbuf_insert(gitdir, gitdir_offset, dir.buf, dir.len);\n \t}\n \n+\tget_common_dir(commondir, gitdir->buf + gitdir_offset);\n+\n \tstrbuf_reset(&dir);\n-\tstrbuf_addf(&dir, \"%s/config\", gitdir->buf + gitdir_offset);\n+\tstrbuf_addf(&dir, \"%s/config\", commondir->buf + commondir_offset);\n \tread_repository_format(&candidate, dir.buf);\n \tstrbuf_release(&dir);\n \n@@ -983,6 +987,7 @@ const char *discover_git_directory(struct strbuf *gitdir)\n \t\twarning(\"ignoring git dir '%s': %s\",\n \t\t\tgitdir->buf + gitdir_offset, err.buf);\n \t\tstrbuf_release(&err);\n+\t\tstrbuf_setlen(commondir, commondir_offset);\n \t\treturn NULL;\n \t}\n\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322140","messageId":"20170613210321.152978-2-bmwill@google.com","threadId":"46161","inReplyTo":"20170613210321.152978-1-bmwill@google.com","subject":"[PATCH v2 1/6] config: create config.h","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T21:03:16Z","receivedAt":"2017-06-13T21:03:40Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Move all config related declarations from cache.h to a new config.h\nheader file.  This makes cache.h smaller and allows for the opportunity\nin a following patch to only include config.h when needed.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n cache.h  | 190 +------------------------------------------------------------\n config.h | 194 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 195 insertions(+), 189 deletions(-)\n create mode 100644 config.h\n\ndiff --git a/cache.h b/cache.h\nindex 4d92aae0e..ed56f8818 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -11,6 +11,7 @@\n #include \"string-list.h\"\n #include \"pack-revindex.h\"\n #include \"hash.h\"\n+#include \"config.h\"\n \n #ifndef platform_SHA_CTX\n /*\n@@ -1872,188 +1873,9 @@ extern int packed_object_info(struct packed_git *pack, off_t offset, struct obje\n /* Dumb servers support */\n extern int update_server_info(int);\n \n-/* git_config_parse_key() returns these negated: */\n-#define CONFIG_INVALID_KEY 1\n-#define CONFIG_NO_SECTION_OR_NAME 2\n-/* git_config_set_gently(), git_config_set_multivar_gently() return the above or these: */\n-#define CONFIG_NO_LOCK -1\n-#define CONFIG_INVALID_FILE 3\n-#define CONFIG_NO_WRITE 4\n-#define CONFIG_NOTHING_SET 5\n-#define CONFIG_INVALID_PATTERN 6\n-#define CONFIG_GENERIC_ERROR 7\n-\n-#define CONFIG_REGEX_NONE ((void *)1)\n-\n-struct git_config_source {\n-\tunsigned int use_stdin:1;\n-\tconst char *file;\n-\tconst char *blob;\n-};\n-\n-enum config_origin_type {\n-\tCONFIG_ORIGIN_BLOB,\n-\tCONFIG_ORIGIN_FILE,\n-\tCONFIG_ORIGIN_STDIN,\n-\tCONFIG_ORIGIN_SUBMODULE_BLOB,\n-\tCONFIG_ORIGIN_CMDLINE\n-};\n-\n-struct config_options {\n-\tunsigned int respect_includes : 1;\n-\tconst char *git_dir;\n-};\n-\n-typedef int (*config_fn_t)(const char *, const char *, void *);\n-extern int git_default_config(const char *, const char *, void *);\n-extern int git_config_from_file(config_fn_t fn, const char *, void *);\n-extern int git_config_from_mem(config_fn_t fn, const enum config_origin_type,\n-\t\t\t\t\tconst char *name, const char *buf, size_t len, void *data);\n-extern int git_config_from_blob_sha1(config_fn_t fn, const char *name,\n-\t\t\t\t     const unsigned char *sha1, void *data);\n-extern void git_config_push_parameter(const char *text);\n-extern int git_config_from_parameters(config_fn_t fn, void *data);\n-extern void read_early_config(config_fn_t cb, void *data);\n-extern void git_config(config_fn_t fn, void *);\n-extern int git_config_with_options(config_fn_t fn, void *,\n-\t\t\t\t   struct git_config_source *config_source,\n-\t\t\t\t   const struct config_options *opts);\n-extern int git_parse_ulong(const char *, unsigned long *);\n-extern int git_parse_maybe_bool(const char *);\n-extern int git_config_int(const char *, const char *);\n-extern int64_t git_config_int64(const char *, const char *);\n-extern unsigned long git_config_ulong(const char *, const char *);\n-extern ssize_t git_config_ssize_t(const char *, const char *);\n-extern int git_config_bool_or_int(const char *, const char *, int *);\n-extern int git_config_bool(const char *, const char *);\n-extern int git_config_maybe_bool(const char *, const char *);\n-extern int git_config_string(const char **, const char *, const char *);\n-extern int git_config_pathname(const char **, const char *, const char *);\n-extern int git_config_set_in_file_gently(const char *, const char *, const char *);\n-extern void git_config_set_in_file(const char *, const char *, const char *);\n-extern int git_config_set_gently(const char *, const char *);\n-extern void git_config_set(const char *, const char *);\n-extern int git_config_parse_key(const char *, char **, int *);\n-extern int git_config_key_is_valid(const char *key);\n-extern int git_config_set_multivar_gently(const char *, const char *, const char *, int);\n-extern void git_config_set_multivar(const char *, const char *, const char *, int);\n-extern int git_config_set_multivar_in_file_gently(const char *, const char *, const char *, const char *, int);\n-extern void git_config_set_multivar_in_file(const char *, const char *, const char *, const char *, int);\n-extern int git_config_rename_section(const char *, const char *);\n-extern int git_config_rename_section_in_file(const char *, const char *, const char *);\n-extern const char *git_etc_gitconfig(void);\n-extern int git_env_bool(const char *, int);\n-extern unsigned long git_env_ulong(const char *, unsigned long);\n-extern int git_config_system(void);\n-extern int config_error_nonbool(const char *);\n-#if defined(__GNUC__)\n-#define config_error_nonbool(s) (config_error_nonbool(s), const_error())\n-#endif\n extern const char *get_log_output_encoding(void);\n extern const char *get_commit_output_encoding(void);\n \n-extern int git_config_parse_parameter(const char *, config_fn_t fn, void *data);\n-\n-enum config_scope {\n-\tCONFIG_SCOPE_UNKNOWN = 0,\n-\tCONFIG_SCOPE_SYSTEM,\n-\tCONFIG_SCOPE_GLOBAL,\n-\tCONFIG_SCOPE_REPO,\n-\tCONFIG_SCOPE_CMDLINE,\n-};\n-\n-extern enum config_scope current_config_scope(void);\n-extern const char *current_config_origin_type(void);\n-extern const char *current_config_name(void);\n-\n-struct config_include_data {\n-\tint depth;\n-\tconfig_fn_t fn;\n-\tvoid *data;\n-\tconst struct config_options *opts;\n-};\n-#define CONFIG_INCLUDE_INIT { 0 }\n-extern int git_config_include(const char *name, const char *value, void *data);\n-\n-/*\n- * Match and parse a config key of the form:\n- *\n- *   section.(subsection.)?key\n- *\n- * (i.e., what gets handed to a config_fn_t). The caller provides the section;\n- * we return -1 if it does not match, 0 otherwise. The subsection and key\n- * out-parameters are filled by the function (and *subsection is NULL if it is\n- * missing).\n- *\n- * If the subsection pointer-to-pointer passed in is NULL, returns 0 only if\n- * there is no subsection at all.\n- */\n-extern int parse_config_key(const char *var,\n-\t\t\t    const char *section,\n-\t\t\t    const char **subsection, int *subsection_len,\n-\t\t\t    const char **key);\n-\n-struct config_set_element {\n-\tstruct hashmap_entry ent;\n-\tchar *key;\n-\tstruct string_list value_list;\n-};\n-\n-struct configset_list_item {\n-\tstruct config_set_element *e;\n-\tint value_index;\n-};\n-\n-/*\n- * the contents of the list are ordered according to their\n- * position in the config files and order of parsing the files.\n- * (i.e. key-value pair at the last position of .git/config will\n- * be at the last item of the list)\n- */\n-struct configset_list {\n-\tstruct configset_list_item *items;\n-\tunsigned int nr, alloc;\n-};\n-\n-struct config_set {\n-\tstruct hashmap config_hash;\n-\tint hash_initialized;\n-\tstruct configset_list list;\n-};\n-\n-extern void git_configset_init(struct config_set *cs);\n-extern int git_configset_add_file(struct config_set *cs, const char *filename);\n-extern int git_configset_get_value(struct config_set *cs, const char *key, const char **value);\n-extern const struct string_list *git_configset_get_value_multi(struct config_set *cs, const char *key);\n-extern void git_configset_clear(struct config_set *cs);\n-extern int git_configset_get_string_const(struct config_set *cs, const char *key, const char **dest);\n-extern int git_configset_get_string(struct config_set *cs, const char *key, char **dest);\n-extern int git_configset_get_int(struct config_set *cs, const char *key, int *dest);\n-extern int git_configset_get_ulong(struct config_set *cs, const char *key, unsigned long *dest);\n-extern int git_configset_get_bool(struct config_set *cs, const char *key, int *dest);\n-extern int git_configset_get_bool_or_int(struct config_set *cs, const char *key, int *is_bool, int *dest);\n-extern int git_configset_get_maybe_bool(struct config_set *cs, const char *key, int *dest);\n-extern int git_configset_get_pathname(struct config_set *cs, const char *key, const char **dest);\n-\n-extern int git_config_get_value(const char *key, const char **value);\n-extern const struct string_list *git_config_get_value_multi(const char *key);\n-extern void git_config_clear(void);\n-extern void git_config_iter(config_fn_t fn, void *data);\n-extern int git_config_get_string_const(const char *key, const char **dest);\n-extern int git_config_get_string(const char *key, char **dest);\n-extern int git_config_get_int(const char *key, int *dest);\n-extern int git_config_get_ulong(const char *key, unsigned long *dest);\n-extern int git_config_get_bool(const char *key, int *dest);\n-extern int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest);\n-extern int git_config_get_maybe_bool(const char *key, int *dest);\n-extern int git_config_get_pathname(const char *key, const char **dest);\n-extern int git_config_get_untracked_cache(void);\n-extern int git_config_get_split_index(void);\n-extern int git_config_get_max_percent_split_change(void);\n-\n-/* This dies if the configured or default date is in the future */\n-extern int git_config_get_expiry(const char *key, const char **output);\n-\n /*\n  * This is a hack for test programs like test-dump-untracked-cache to\n  * ensure that they do not modify the untracked cache when reading it.\n@@ -2061,16 +1883,6 @@ extern int git_config_get_expiry(const char *key, const char **output);\n  */\n extern int ignore_untracked_cache_config;\n \n-struct key_value_info {\n-\tconst char *filename;\n-\tint linenr;\n-\tenum config_origin_type origin_type;\n-\tenum config_scope scope;\n-};\n-\n-extern NORETURN void git_die_config(const char *key, const char *err, ...) __attribute__((format(printf, 2, 3)));\n-extern NORETURN void git_die_config_linenr(const char *key, const char *filename, int linenr);\n-\n extern int committer_ident_sufficiently_given(void);\n extern int author_ident_sufficiently_given(void);\n \ndiff --git a/config.h b/config.h\nnew file mode 100644\nindex 000000000..f7f8b66c5\n--- /dev/null\n+++ b/config.h\n@@ -0,0 +1,194 @@\n+#ifndef CONFIG_H\n+#define CONFIG_H\n+\n+/* git_config_parse_key() returns these negated: */\n+#define CONFIG_INVALID_KEY 1\n+#define CONFIG_NO_SECTION_OR_NAME 2\n+/* git_config_set_gently(), git_config_set_multivar_gently() return the above or these: */\n+#define CONFIG_NO_LOCK -1\n+#define CONFIG_INVALID_FILE 3\n+#define CONFIG_NO_WRITE 4\n+#define CONFIG_NOTHING_SET 5\n+#define CONFIG_INVALID_PATTERN 6\n+#define CONFIG_GENERIC_ERROR 7\n+\n+#define CONFIG_REGEX_NONE ((void *)1)\n+\n+struct git_config_source {\n+\tunsigned int use_stdin:1;\n+\tconst char *file;\n+\tconst char *blob;\n+};\n+\n+enum config_origin_type {\n+\tCONFIG_ORIGIN_BLOB,\n+\tCONFIG_ORIGIN_FILE,\n+\tCONFIG_ORIGIN_STDIN,\n+\tCONFIG_ORIGIN_SUBMODULE_BLOB,\n+\tCONFIG_ORIGIN_CMDLINE\n+};\n+\n+struct config_options {\n+\tunsigned int respect_includes : 1;\n+\tconst char *git_dir;\n+};\n+\n+typedef int (*config_fn_t)(const char *, const char *, void *);\n+extern int git_default_config(const char *, const char *, void *);\n+extern int git_config_from_file(config_fn_t fn, const char *, void *);\n+extern int git_config_from_mem(config_fn_t fn, const enum config_origin_type,\n+\t\t\t\t\tconst char *name, const char *buf, size_t len, void *data);\n+extern int git_config_from_blob_sha1(config_fn_t fn, const char *name,\n+\t\t\t\t     const unsigned char *sha1, void *data);\n+extern void git_config_push_parameter(const char *text);\n+extern int git_config_from_parameters(config_fn_t fn, void *data);\n+extern void read_early_config(config_fn_t cb, void *data);\n+extern void git_config(config_fn_t fn, void *);\n+extern int git_config_with_options(config_fn_t fn, void *,\n+\t\t\t\t   struct git_config_source *config_source,\n+\t\t\t\t   const struct config_options *opts);\n+extern int git_parse_ulong(const char *, unsigned long *);\n+extern int git_parse_maybe_bool(const char *);\n+extern int git_config_int(const char *, const char *);\n+extern int64_t git_config_int64(const char *, const char *);\n+extern unsigned long git_config_ulong(const char *, const char *);\n+extern ssize_t git_config_ssize_t(const char *, const char *);\n+extern int git_config_bool_or_int(const char *, const char *, int *);\n+extern int git_config_bool(const char *, const char *);\n+extern int git_config_maybe_bool(const char *, const char *);\n+extern int git_config_string(const char **, const char *, const char *);\n+extern int git_config_pathname(const char **, const char *, const char *);\n+extern int git_config_set_in_file_gently(const char *, const char *, const char *);\n+extern void git_config_set_in_file(const char *, const char *, const char *);\n+extern int git_config_set_gently(const char *, const char *);\n+extern void git_config_set(const char *, const char *);\n+extern int git_config_parse_key(const char *, char **, int *);\n+extern int git_config_key_is_valid(const char *key);\n+extern int git_config_set_multivar_gently(const char *, const char *, const char *, int);\n+extern void git_config_set_multivar(const char *, const char *, const char *, int);\n+extern int git_config_set_multivar_in_file_gently(const char *, const char *, const char *, const char *, int);\n+extern void git_config_set_multivar_in_file(const char *, const char *, const char *, const char *, int);\n+extern int git_config_rename_section(const char *, const char *);\n+extern int git_config_rename_section_in_file(const char *, const char *, const char *);\n+extern const char *git_etc_gitconfig(void);\n+extern int git_env_bool(const char *, int);\n+extern unsigned long git_env_ulong(const char *, unsigned long);\n+extern int git_config_system(void);\n+extern int config_error_nonbool(const char *);\n+#if defined(__GNUC__)\n+#define config_error_nonbool(s) (config_error_nonbool(s), const_error())\n+#endif\n+\n+extern int git_config_parse_parameter(const char *, config_fn_t fn, void *data);\n+\n+enum config_scope {\n+\tCONFIG_SCOPE_UNKNOWN = 0,\n+\tCONFIG_SCOPE_SYSTEM,\n+\tCONFIG_SCOPE_GLOBAL,\n+\tCONFIG_SCOPE_REPO,\n+\tCONFIG_SCOPE_CMDLINE,\n+};\n+\n+extern enum config_scope current_config_scope(void);\n+extern const char *current_config_origin_type(void);\n+extern const char *current_config_name(void);\n+\n+struct config_include_data {\n+\tint depth;\n+\tconfig_fn_t fn;\n+\tvoid *data;\n+\tconst struct config_options *opts;\n+};\n+#define CONFIG_INCLUDE_INIT { 0 }\n+extern int git_config_include(const char *name, const char *value, void *data);\n+\n+/*\n+ * Match and parse a config key of the form:\n+ *\n+ *   section.(subsection.)?key\n+ *\n+ * (i.e., what gets handed to a config_fn_t). The caller provides the section;\n+ * we return -1 if it does not match, 0 otherwise. The subsection and key\n+ * out-parameters are filled by the function (and *subsection is NULL if it is\n+ * missing).\n+ *\n+ * If the subsection pointer-to-pointer passed in is NULL, returns 0 only if\n+ * there is no subsection at all.\n+ */\n+extern int parse_config_key(const char *var,\n+\t\t\t    const char *section,\n+\t\t\t    const char **subsection, int *subsection_len,\n+\t\t\t    const char **key);\n+\n+struct config_set_element {\n+\tstruct hashmap_entry ent;\n+\tchar *key;\n+\tstruct string_list value_list;\n+};\n+\n+struct configset_list_item {\n+\tstruct config_set_element *e;\n+\tint value_index;\n+};\n+\n+/*\n+ * the contents of the list are ordered according to their\n+ * position in the config files and order of parsing the files.\n+ * (i.e. key-value pair at the last position of .git/config will\n+ * be at the last item of the list)\n+ */\n+struct configset_list {\n+\tstruct configset_list_item *items;\n+\tunsigned int nr, alloc;\n+};\n+\n+struct config_set {\n+\tstruct hashmap config_hash;\n+\tint hash_initialized;\n+\tstruct configset_list list;\n+};\n+\n+extern void git_configset_init(struct config_set *cs);\n+extern int git_configset_add_file(struct config_set *cs, const char *filename);\n+extern int git_configset_get_value(struct config_set *cs, const char *key, const char **value);\n+extern const struct string_list *git_configset_get_value_multi(struct config_set *cs, const char *key);\n+extern void git_configset_clear(struct config_set *cs);\n+extern int git_configset_get_string_const(struct config_set *cs, const char *key, const char **dest);\n+extern int git_configset_get_string(struct config_set *cs, const char *key, char **dest);\n+extern int git_configset_get_int(struct config_set *cs, const char *key, int *dest);\n+extern int git_configset_get_ulong(struct config_set *cs, const char *key, unsigned long *dest);\n+extern int git_configset_get_bool(struct config_set *cs, const char *key, int *dest);\n+extern int git_configset_get_bool_or_int(struct config_set *cs, const char *key, int *is_bool, int *dest);\n+extern int git_configset_get_maybe_bool(struct config_set *cs, const char *key, int *dest);\n+extern int git_configset_get_pathname(struct config_set *cs, const char *key, const char **dest);\n+\n+extern int git_config_get_value(const char *key, const char **value);\n+extern const struct string_list *git_config_get_value_multi(const char *key);\n+extern void git_config_clear(void);\n+extern void git_config_iter(config_fn_t fn, void *data);\n+extern int git_config_get_string_const(const char *key, const char **dest);\n+extern int git_config_get_string(const char *key, char **dest);\n+extern int git_config_get_int(const char *key, int *dest);\n+extern int git_config_get_ulong(const char *key, unsigned long *dest);\n+extern int git_config_get_bool(const char *key, int *dest);\n+extern int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest);\n+extern int git_config_get_maybe_bool(const char *key, int *dest);\n+extern int git_config_get_pathname(const char *key, const char **dest);\n+extern int git_config_get_untracked_cache(void);\n+extern int git_config_get_split_index(void);\n+extern int git_config_get_max_percent_split_change(void);\n+\n+/* This dies if the configured or default date is in the future */\n+extern int git_config_get_expiry(const char *key, const char **output);\n+\n+struct key_value_info {\n+\tconst char *filename;\n+\tint linenr;\n+\tenum config_origin_type origin_type;\n+\tenum config_scope scope;\n+};\n+\n+extern NORETURN void git_die_config(const char *key, const char *err, ...) __attribute__((format(printf, 2, 3)));\n+extern NORETURN void git_die_config_linenr(const char *key, const char *filename, int linenr);\n+\n+#endif /* CONFIG_H */\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322141","messageId":"20170613210321.152978-3-bmwill@google.com","threadId":"46161","inReplyTo":"20170613210321.152978-1-bmwill@google.com","subject":"[PATCH v2 2/6] config: remove git_config_iter","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T21:03:17Z","receivedAt":"2017-06-13T21:03:42Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Since there is no implementation of the function 'git_config_iter' lets\nstop exporting it and remove the prototype from config.h.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n config.h | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/config.h b/config.h\nindex f7f8b66c5..c70599bd5 100644\n--- a/config.h\n+++ b/config.h\n@@ -165,7 +165,6 @@ extern int git_configset_get_pathname(struct config_set *cs, const char *key, co\n extern int git_config_get_value(const char *key, const char **value);\n extern const struct string_list *git_config_get_value_multi(const char *key);\n extern void git_config_clear(void);\n-extern void git_config_iter(config_fn_t fn, void *data);\n extern int git_config_get_string_const(const char *key, const char **dest);\n extern int git_config_get_string(const char *key, char **dest);\n extern int git_config_get_int(const char *key, int *dest);\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322142","messageId":"20170613210321.152978-6-bmwill@google.com","threadId":"46161","inReplyTo":"20170613210321.152978-1-bmwill@google.com","subject":"[PATCH v2 5/6] setup: teach discover_git_directory to respect the commondir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T21:03:20Z","receivedAt":"2017-06-13T21:03:44Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Currently 'discover_git_directory' only looks at the gitdir to determine\nif a git directory was discovered.  This causes a problem in the event\nthat the gitdir which was discovered was in fact a per-worktree git\ndirectory and not the common git directory.  This is because the\nrepository config, which is checked to verify the repository's format,\nis stored in the commondir and not in the per-worktree gitdir.  Correct\nthis behavior by checking the config stored in the commondir.\n\nIt will also be of use for callers to have access to the commondir, so\nlets also return that upon successfully discovering a git directory.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n cache.h  |  3 ++-\n config.c | 10 ++++++----\n setup.c  |  9 +++++++--\n 3 files changed, 15 insertions(+), 7 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex fd45b8c55..a4176436d 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -530,7 +530,8 @@ extern void setup_work_tree(void);\n  * appended to gitdir. The return value is either NULL if no repository was\n  * found, or pointing to the path inside gitdir's buffer.\n  */\n-extern const char *discover_git_directory(struct strbuf *gitdir);\n+extern const char *discover_git_directory(struct strbuf *commondir,\n+\t\t\t\t\t  struct strbuf *gitdir);\n extern const char *setup_git_directory_gently(int *);\n extern const char *setup_git_directory(void);\n extern char *prefix_path(const char *prefix, int len, const char *path);\ndiff --git a/config.c b/config.c\nindex 4e2842689..9aa9b9715 100644\n--- a/config.c\n+++ b/config.c\n@@ -1652,7 +1652,8 @@ static void configset_iter(struct config_set *cs, config_fn_t fn, void *data)\n void read_early_config(config_fn_t cb, void *data)\n {\n \tstruct config_options opts = {0};\n-\tstruct strbuf buf = STRBUF_INIT;\n+\tstruct strbuf commondir = STRBUF_INIT;\n+\tstruct strbuf gitdir = STRBUF_INIT;\n \n \topts.respect_includes = 1;\n \n@@ -1666,12 +1667,13 @@ void read_early_config(config_fn_t cb, void *data)\n \t * notably, the current working directory is still the same after the\n \t * call).\n \t */\n-\telse if (discover_git_directory(&buf))\n-\t\topts.git_dir = buf.buf;\n+\telse if (discover_git_directory(&commondir, &gitdir))\n+\t\topts.git_dir = gitdir.buf;\n \n \tgit_config_with_options(cb, data, NULL, &opts);\n \n-\tstrbuf_release(&buf);\n+\tstrbuf_release(&commondir);\n+\tstrbuf_release(&gitdir);\n }\n \n static void git_config_check_init(void);\ndiff --git a/setup.c b/setup.c\nindex e99a82cbe..7bbb8736f 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -946,10 +946,12 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,\n \t}\n }\n \n-const char *discover_git_directory(struct strbuf *gitdir)\n+const char *discover_git_directory(struct strbuf *commondir,\n+\t\t\t\t   struct strbuf *gitdir)\n {\n \tstruct strbuf dir = STRBUF_INIT, err = STRBUF_INIT;\n \tsize_t gitdir_offset = gitdir->len, cwd_len;\n+\tsize_t commondir_offset = commondir->len;\n \tstruct repository_format candidate;\n \n \tif (strbuf_getcwd(&dir))\n@@ -974,8 +976,10 @@ const char *discover_git_directory(struct strbuf *gitdir)\n \t\tstrbuf_insert(gitdir, gitdir_offset, dir.buf, dir.len);\n \t}\n \n+\tget_common_dir(commondir, gitdir->buf + gitdir_offset);\n+\n \tstrbuf_reset(&dir);\n-\tstrbuf_addf(&dir, \"%s/config\", gitdir->buf + gitdir_offset);\n+\tstrbuf_addf(&dir, \"%s/config\", commondir->buf + commondir_offset);\n \tread_repository_format(&candidate, dir.buf);\n \tstrbuf_release(&dir);\n \n@@ -983,6 +987,7 @@ const char *discover_git_directory(struct strbuf *gitdir)\n \t\twarning(\"ignoring git dir '%s': %s\",\n \t\t\tgitdir->buf + gitdir_offset, err.buf);\n \t\tstrbuf_release(&err);\n+\t\tstrbuf_setlen(commondir, commondir_offset);\n \t\treturn NULL;\n \t}\n \n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322143","messageId":"20170613210321.152978-7-bmwill@google.com","threadId":"46161","inReplyTo":"20170613210321.152978-1-bmwill@google.com","subject":"[PATCH v2 6/6] config: respect commondir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T21:03:21Z","receivedAt":"2017-06-13T21:03:45Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Worktrees present an interesting problem when it comes to the config.\nHistorically we could assume that the per-repository config lives at\n'gitdir/config', but since worktrees were introduced this isn't the case\nanymore.  There is currently no way to specify per-worktree\nconfiguration, and as such the repository config is shared with all\nworktrees and is located at 'commondir/config'.\n\nMany users of the config machinery correctly set\n'config_options.git_dir' with the repository's commondir, allowing the\nconfig to be properly loaded when operating in a worktree.  But other's,\nlike 'read_early_config()', set 'config_options.git_dir' with the\nrepository's gitdir which can be incorrect when using worktrees.\n\nTo fix this issue, and to make things less ambiguous, lets add a\n'commondir' field to the 'config_options' struct and have all callers\nproperly set both the 'git_dir' and 'commondir' fields so that the\nconfig machinery is able to properly find the repository's config.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/config.c |  6 ++++--\n config.c         | 18 ++++++++++++------\n config.h         |  1 +\n 3 files changed, 17 insertions(+), 8 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex f06a8dff2..8b6e227c5 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -539,8 +539,10 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\tconfig_options.respect_includes = !given_config_source.file;\n \telse\n \t\tconfig_options.respect_includes = respect_includes_opt;\n-\tif (!nongit)\n-\t\tconfig_options.git_dir = get_git_common_dir();\n+\tif (!nongit) {\n+\t\tconfig_options.commondir = get_git_common_dir();\n+\t\tconfig_options.git_dir = get_git_dir();\n+\t}\n \n \tif (end_null) {\n \t\tterm = '\\0';\ndiff --git a/config.c b/config.c\nindex 9aa9b9715..81151fb54 100644\n--- a/config.c\n+++ b/config.c\n@@ -1544,8 +1544,8 @@ static int do_git_config_sequence(const struct config_options *opts,\n \tchar *user_config = expand_user_path(\"~/.gitconfig\", 0);\n \tchar *repo_config;\n \n-\tif (opts->git_dir)\n-\t\trepo_config = mkpathdup(\"%s/config\", opts->git_dir);\n+\tif (opts->commondir)\n+\t\trepo_config = mkpathdup(\"%s/config\", opts->commondir);\n \telse\n \t\trepo_config = NULL;\n \n@@ -1609,8 +1609,11 @@ static void git_config_raw(config_fn_t fn, void *data)\n \tstruct config_options opts = {0};\n \n \topts.respect_includes = 1;\n-\tif (have_git_dir())\n-\t\topts.git_dir = get_git_common_dir();\n+\tif (have_git_dir()) {\n+\t\topts.commondir = get_git_common_dir();\n+\t\topts.git_dir = get_git_dir();\n+\t}\n+\n \tif (git_config_with_options(fn, data, NULL, &opts) < 0)\n \t\t/*\n \t\t * git_config_with_options() normally returns only\n@@ -1657,7 +1660,8 @@ void read_early_config(config_fn_t cb, void *data)\n \n \topts.respect_includes = 1;\n \n-\tif (have_git_dir())\n+\tif (have_git_dir()) {\n+\t\topts.commondir = get_git_common_dir();\n \t\topts.git_dir = get_git_dir();\n \t/*\n \t * When setup_git_directory() was not yet asked to discover the\n@@ -1667,8 +1671,10 @@ void read_early_config(config_fn_t cb, void *data)\n \t * notably, the current working directory is still the same after the\n \t * call).\n \t */\n-\telse if (discover_git_directory(&commondir, &gitdir))\n+\t} else if (discover_git_directory(&commondir, &gitdir)) {\n+\t\topts.commondir = commondir.buf;\n \t\topts.git_dir = gitdir.buf;\n+\t}\n \n \tgit_config_with_options(cb, data, NULL, &opts);\n \ndiff --git a/config.h b/config.h\nindex c70599bd5..63b92784c 100644\n--- a/config.h\n+++ b/config.h\n@@ -30,6 +30,7 @@ enum config_origin_type {\n \n struct config_options {\n \tunsigned int respect_includes : 1;\n+\tconst char *commondir;\n \tconst char *git_dir;\n };\n \n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322144","messageId":"20170613210321.152978-5-bmwill@google.com","threadId":"46161","inReplyTo":"20170613210321.152978-1-bmwill@google.com","subject":"[PATCH v2 4/6] config: don't implicitly use gitdir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T21:03:19Z","receivedAt":"2017-06-13T21:03:46Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Commit 2185fde56 (config: handle conditional include when $GIT_DIR is\nnot set up) added a 'git_dir' field to the config_options struct.  Let's\nuse this option field explicitly all the time instead of occasionally\nfalling back to calling 'git_pathdup(\"config\")' to get the path to the\nlocal repository configuration.  This allows 'do_git_config_sequence()'\nto not implicitly rely on global repository state.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/config.c | 2 ++\n config.c         | 6 ++----\n 2 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 753c40a5c..f06a8dff2 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -539,6 +539,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\tconfig_options.respect_includes = !given_config_source.file;\n \telse\n \t\tconfig_options.respect_includes = respect_includes_opt;\n+\tif (!nongit)\n+\t\tconfig_options.git_dir = get_git_common_dir();\n \n \tif (end_null) {\n \t\tterm = '\\0';\ndiff --git a/config.c b/config.c\nindex 2390f98e3..4e2842689 100644\n--- a/config.c\n+++ b/config.c\n@@ -219,8 +219,6 @@ static int include_by_gitdir(const struct config_options *opts,\n \n \tif (opts->git_dir)\n \t\tgit_dir = opts->git_dir;\n-\telse if (have_git_dir())\n-\t\tgit_dir = get_git_dir();\n \telse\n \t\tgoto done;\n \n@@ -1548,8 +1546,6 @@ static int do_git_config_sequence(const struct config_options *opts,\n \n \tif (opts->git_dir)\n \t\trepo_config = mkpathdup(\"%s/config\", opts->git_dir);\n-\telse if (have_git_dir())\n-\t\trepo_config = git_pathdup(\"config\");\n \telse\n \t\trepo_config = NULL;\n \n@@ -1613,6 +1609,8 @@ static void git_config_raw(config_fn_t fn, void *data)\n \tstruct config_options opts = {0};\n \n \topts.respect_includes = 1;\n+\tif (have_git_dir())\n+\t\topts.git_dir = get_git_common_dir();\n \tif (git_config_with_options(fn, data, NULL, &opts) < 0)\n \t\t/*\n \t\t * git_config_with_options() normally returns only\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322145","messageId":"20170613210321.152978-4-bmwill@google.com","threadId":"46161","inReplyTo":"20170613210321.152978-1-bmwill@google.com","subject":"[PATCH v2 3/6] config: don't include config.h by default","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T21:03:18Z","receivedAt":"2017-06-13T21:03:49Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Stop including config.h by default in cache.h.  Instead only include\nconfig.h in those files which require use of the config system.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n advice.c                         | 1 +\n alias.c                          | 1 +\n apply.c                          | 1 +\n archive-tar.c                    | 1 +\n archive-zip.c                    | 1 +\n archive.c                        | 1 +\n attr.c                           | 1 +\n bisect.c                         | 1 +\n branch.c                         | 1 +\n builtin/add.c                    | 1 +\n builtin/am.c                     | 1 +\n builtin/blame.c                  | 2 ++\n builtin/branch.c                 | 1 +\n builtin/cat-file.c               | 1 +\n builtin/check-attr.c             | 1 +\n builtin/check-ignore.c           | 1 +\n builtin/check-mailmap.c          | 1 +\n builtin/checkout-index.c         | 1 +\n builtin/checkout.c               | 1 +\n builtin/clean.c                  | 1 +\n builtin/clone.c                  | 1 +\n builtin/column.c                 | 1 +\n builtin/commit-tree.c            | 1 +\n builtin/commit.c                 | 1 +\n builtin/config.c                 | 1 +\n builtin/count-objects.c          | 1 +\n builtin/describe.c               | 1 +\n builtin/diff-files.c             | 1 +\n builtin/diff-index.c             | 1 +\n builtin/diff-tree.c              | 1 +\n builtin/diff.c                   | 1 +\n builtin/difftool.c               | 1 +\n builtin/fast-export.c            | 1 +\n builtin/fetch.c                  | 1 +\n builtin/fmt-merge-msg.c          | 1 +\n builtin/for-each-ref.c           | 1 +\n builtin/fsck.c                   | 1 +\n builtin/gc.c                     | 1 +\n builtin/grep.c                   | 1 +\n builtin/hash-object.c            | 1 +\n builtin/help.c                   | 1 +\n builtin/index-pack.c             | 1 +\n builtin/init-db.c                | 1 +\n builtin/log.c                    | 1 +\n builtin/ls-files.c               | 1 +\n builtin/ls-tree.c                | 1 +\n builtin/merge-base.c             | 1 +\n builtin/merge-file.c             | 1 +\n builtin/merge.c                  | 1 +\n builtin/mv.c                     | 1 +\n builtin/name-rev.c               | 1 +\n builtin/notes.c                  | 1 +\n builtin/pack-objects.c           | 1 +\n builtin/patch-id.c               | 1 +\n builtin/pull.c                   | 1 +\n builtin/push.c                   | 1 +\n builtin/read-tree.c              | 1 +\n builtin/rebase--helper.c         | 1 +\n builtin/receive-pack.c           | 1 +\n builtin/reflog.c                 | 1 +\n builtin/remote.c                 | 1 +\n builtin/repack.c                 | 1 +\n builtin/replace.c                | 1 +\n builtin/rerere.c                 | 1 +\n builtin/reset.c                  | 1 +\n builtin/rev-list.c               | 1 +\n builtin/rev-parse.c              | 1 +\n builtin/revert.c                 | 1 +\n builtin/rm.c                     | 1 +\n builtin/send-pack.c              | 1 +\n builtin/shortlog.c               | 1 +\n builtin/show-branch.c            | 1 +\n builtin/stripspace.c             | 1 +\n builtin/submodule--helper.c      | 1 +\n builtin/symbolic-ref.c           | 1 +\n builtin/tag.c                    | 1 +\n builtin/unpack-file.c            | 1 +\n builtin/unpack-objects.c         | 1 +\n builtin/update-index.c           | 1 +\n builtin/update-ref.c             | 1 +\n builtin/update-server-info.c     | 1 +\n builtin/var.c                    | 1 +\n builtin/verify-commit.c          | 1 +\n builtin/verify-pack.c            | 1 +\n builtin/verify-tag.c             | 1 +\n builtin/worktree.c               | 1 +\n builtin/write-tree.c             | 1 +\n cache.h                          | 1 -\n color.c                          | 1 +\n column.c                         | 1 +\n config.c                         | 1 +\n connect.c                        | 1 +\n convert.c                        | 1 +\n credential-cache--daemon.c       | 1 +\n credential.c                     | 1 +\n daemon.c                         | 1 +\n diff.c                           | 1 +\n dir.c                            | 1 +\n environment.c                    | 1 +\n fast-import.c                    | 1 +\n fetch-pack.c                     | 1 +\n git.c                            | 1 +\n gpg-interface.c                  | 1 +\n graph.c                          | 1 +\n grep.c                           | 1 +\n help.c                           | 1 +\n http-backend.c                   | 1 +\n http-fetch.c                     | 1 +\n http.c                           | 1 +\n ident.c                          | 1 +\n imap-send.c                      | 1 +\n ll-merge.c                       | 1 +\n log-tree.c                       | 1 +\n mailinfo.c                       | 1 +\n merge-recursive.c                | 1 +\n notes-utils.c                    | 1 +\n notes.c                          | 1 +\n pager.c                          | 1 +\n parse-options.c                  | 1 +\n pathspec.c                       | 1 +\n pretty.c                         | 1 +\n prompt.c                         | 1 +\n read-cache.c                     | 1 +\n refs.c                           | 1 +\n refs/files-backend.c             | 1 +\n remote-curl.c                    | 1 +\n remote.c                         | 1 +\n rerere.c                         | 1 +\n send-pack.c                      | 1 +\n sequencer.c                      | 1 +\n setup.c                          | 1 +\n sha1_file.c                      | 1 +\n sha1_name.c                      | 1 +\n submodule-config.c               | 1 +\n submodule.c                      | 1 +\n t/helper/test-config.c           | 1 +\n t/helper/test-submodule-config.c | 1 +\n trailer.c                        | 1 +\n transport.c                      | 1 +\n unpack-trees.c                   | 1 +\n upload-pack.c                    | 1 +\n userdiff.c                       | 1 +\n versioncmp.c                     | 1 +\n wrapper.c                        | 1 +\n xdiff-interface.c                | 1 +\n 145 files changed, 145 insertions(+), 1 deletion(-)\n\ndiff --git a/advice.c b/advice.c\nindex b84ae4960..3fa04fca0 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n \n int advice_push_update_rejected = 1;\n int advice_push_non_ff_current = 1;\ndiff --git a/alias.c b/alias.c\nindex 3b90397a9..052f34136 100644\n--- a/alias.c\n+++ b/alias.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n \n char *alias_lookup(const char *alias)\n {\ndiff --git a/apply.c b/apply.c\nindex c49cef063..87db9618d 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -8,6 +8,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"blob.h\"\n #include \"delta.h\"\n #include \"diff.h\"\ndiff --git a/archive-tar.c b/archive-tar.c\nindex 073e60ebd..c6ed96ee7 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -2,6 +2,7 @@\n  * Copyright (c) 2005, 2006 Rene Scharfe\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tar.h\"\n #include \"archive.h\"\n #include \"streaming.h\"\ndiff --git a/archive-zip.c b/archive-zip.c\nindex 27563e9e2..e8913e5a2 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -2,6 +2,7 @@\n  * Copyright (c) 2006 Rene Scharfe\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"archive.h\"\n #include \"streaming.h\"\n #include \"utf8.h\"\ndiff --git a/archive.c b/archive.c\nindex b15a922da..60b3035a7 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"tree-walk.h\"\ndiff --git a/attr.c b/attr.c\nindex 7e2134471..9f8b02936 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -9,6 +9,7 @@\n \n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"exec_cmd.h\"\n #include \"attr.h\"\n #include \"dir.h\"\ndiff --git a/bisect.c b/bisect.c\nindex c952df692..d8587d11c 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"revision.h\"\ndiff --git a/branch.c b/branch.c\nindex 985316eb7..a8a548ccf 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"branch.h\"\n #include \"refs.h\"\n #include \"remote.h\"\ndiff --git a/builtin/add.c b/builtin/add.c\nindex d9a2491e4..f2415e99f 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) 2006 Linus Torvalds\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 5ee146bfb..242d70361 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -4,6 +4,7 @@\n  * Based on git-am.sh by Junio C Hamano.\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex d7a2df3b4..381927920 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -6,6 +6,8 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n+#include \"refs.h\"\n #include \"builtin.h\"\n #include \"commit.h\"\n #include \"diff.h\"\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 83fcda43d..c958e9325 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -6,6 +6,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"color.h\"\n #include \"refs.h\"\n #include \"commit.h\"\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 4bffd7a2d..7efbc4019 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"diff.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex 4d01ca0c8..91444dc04 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"attr.h\"\n #include \"quote.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex c7b8c0889..3e280b9c7 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"quote.h\"\n #include \"pathspec.h\"\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex cf0f54f6b..cdce144f3 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"mailmap.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/checkout-index.c b/builtin/checkout-index.c\nindex 07631d0c9..39c8be05d 100644\n--- a/builtin/checkout-index.c\n+++ b/builtin/checkout-index.c\n@@ -5,6 +5,7 @@\n  *\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex a6b2af39d..45fab5a4d 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 142bf668c..ed954134d 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -8,6 +8,7 @@\n \n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 743f16ae2..4922a5496 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -9,6 +9,7 @@\n  */\n \n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\n #include \"fetch-pack.h\"\ndiff --git a/builtin/column.c b/builtin/column.c\nindex 33314b4d7..0c3223d64 100644\n--- a/builtin/column.c\n+++ b/builtin/column.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"strbuf.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex f39c2b273..a4a923d7c 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"tree.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex da1ba4c86..805da4915 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -6,6 +6,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"cache-tree.h\"\n #include \"color.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 7f6c25d4d..753c40a5c 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"color.h\"\n #include \"parse-options.h\"\n #include \"urlmatch.h\"\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex acb05940f..1d82e61f2 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -5,6 +5,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex 893c8789f..70eb14460 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"commit.h\"\n #include \"tag.h\"\ndiff --git a/builtin/diff-files.c b/builtin/diff-files.c\nindex a572da9d5..965f2fb76 100644\n--- a/builtin/diff-files.c\n+++ b/builtin/diff-files.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"revision.h\"\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex f084826a2..ad9971f64 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"revision.h\"\ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex e40111204..36c220f93 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"log-tree.h\"\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 0c8f86e40..0d59e99ef 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -4,6 +4,7 @@\n  * Copyright (c) 2006 Junio C Hamano\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"color.h\"\n #include \"commit.h\"\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex b9a892f26..9199227f6 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -12,6 +12,7 @@\n  * Copyright (C) 2016 Johannes Schindelin\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"run-command.h\"\n #include \"exec_cmd.h\"\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 24e29ad7e..0dfd980dd 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -5,6 +5,7 @@\n  */\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"object.h\"\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 47708451b..65317bd6c 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -2,6 +2,7 @@\n  * \"git fetch\"\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 70137b0b7..10cbb4341 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"diff.h\"\ndiff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c\nindex eca365bf8..52be99cba 100644\n--- a/builtin/for-each-ref.c\n+++ b/builtin/for-each-ref.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"object.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex cb2ba6cd1..90593491e 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"tree.h\"\n #include \"blob.h\"\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex f484eda43..bd91f136f 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -11,6 +11,7 @@\n  */\n \n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"tempfile.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 7df9c253e..7f720ca6c 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -4,6 +4,7 @@\n  * Copyright (c) 2006 Junio C Hamano\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"blob.h\"\n #include \"tree.h\"\n #include \"commit.h\"\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex bbeaf20bc..d04baf999 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -5,6 +5,7 @@\n  * Copyright (C) Junio C Hamano, 2005\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"blob.h\"\n #include \"quote.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 49f7a07f8..334a8494a 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -2,6 +2,7 @@\n  * Builtin help command\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 04b9dcaf0..edc1a91d8 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"delta.h\"\n #include \"pack.h\"\n #include \"csum-file.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex 8a6acb0ec..47823f9aa 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\ndiff --git a/builtin/log.c b/builtin/log.c\nindex e89ec941c..01d7213c1 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -5,6 +5,7 @@\n  *\t\t 2006 Junio Hamano\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"color.h\"\n #include \"commit.h\"\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex b376afc31..c4357dc30 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -6,6 +6,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"quote.h\"\n #include \"dir.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex ee7b293b1..ef965408e 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"blob.h\"\n #include \"tree.h\"\n #include \"commit.h\"\ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex 0c36a70ad..6dbd167d3 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"diff.h\"\ndiff --git a/builtin/merge-file.c b/builtin/merge-file.c\nindex 47dde7c39..b08803e61 100644\n--- a/builtin/merge-file.c\n+++ b/builtin/merge-file.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"xdiff/xdiff.h\"\n #include \"xdiff-interface.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex a4a098f40..2512370c1 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -7,6 +7,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"builtin.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex 61d20037a..dcf6736b5 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) 2006 Johannes Schindelin\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"pathspec.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 7fc7e66e8..e21715f1d 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"tag.h\"\n #include \"refs.h\"\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 7196bff0e..8d14f434a 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -8,6 +8,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"notes.h\"\n #include \"blob.h\"\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex f672225de..d5e96ed2d 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"attr.h\"\n #include \"object.h\"\n #include \"blob.h\"\ndiff --git a/builtin/patch-id.c b/builtin/patch-id.c\nindex 81552e02e..970d0d30b 100644\n--- a/builtin/patch-id.c\n+++ b/builtin/patch-id.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n \n static void flush_current_id(int patchlen, struct object_id *id, struct object_id *result)\n {\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex da8b60fc8..0c77381da 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -6,6 +6,7 @@\n  * Fetch one or more remote refs and merge it/them into the current HEAD.\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\n #include \"exec_cmd.h\"\ndiff --git a/builtin/push.c b/builtin/push.c\nindex a597759d8..76aa713d2 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -2,6 +2,7 @@\n  * \"git push\"\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"run-command.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex 78d319365..6eb2a0e57 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -5,6 +5,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"object.h\"\n #include \"tree.h\"\ndiff --git a/builtin/rebase--helper.c b/builtin/rebase--helper.c\nindex ca1ebb2fa..c82b4dce6 100644\n--- a/builtin/rebase--helper.c\n+++ b/builtin/rebase--helper.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"sequencer.h\"\n \ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex b1706a573..71c0c768d 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"pack.h\"\n #include \"refs.h\"\ndiff --git a/builtin/reflog.c b/builtin/reflog.c\nindex 920c16dac..44cdc2dbd 100644\n--- a/builtin/reflog.c\n+++ b/builtin/reflog.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"commit.h\"\n #include \"refs.h\"\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex f1a88fe26..6273c0c23 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"transport.h\"\n #include \"remote.h\"\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 38ba4ef82..f17a68a17 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"parse-options.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex c921bc976..80a15cf35 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -9,6 +9,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"refs.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/rerere.c b/builtin/rerere.c\nindex 1bf72423b..ffb66e290 100644\n--- a/builtin/rerere.c\n+++ b/builtin/rerere.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 430602d10..d0b604103 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -8,6 +8,7 @@\n  * Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"tag.h\"\n #include \"object.h\"\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 718c6059c..f8e2b7bf5 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"revision.h\"\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex efdc14473..c78b7b33d 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"quote.h\"\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 345d9586a..16028b9ea 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\n #include \"diff.h\"\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex 7c323d012..824d1de9e 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds 2006\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/send-pack.c b/builtin/send-pack.c\nindex b8e2e74fe..633e0c3cd 100644\n--- a/builtin/send-pack.c\n+++ b/builtin/send-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 7cff1839f..43c4799ea 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 4a6cc6f49..e4cf1b5bb 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/stripspace.c b/builtin/stripspace.c\nindex 1e62a008c..bdf032886 100644\n--- a/builtin/stripspace.c\n+++ b/builtin/stripspace.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\n \ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 8cc648d85..4dcbfb952 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"quote.h\"\n #include \"pathspec.h\"\ndiff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c\nindex 70addef15..df75cb9d4 100644\n--- a/builtin/symbolic-ref.c\n+++ b/builtin/symbolic-ref.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"cache.h\"\n #include \"refs.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 1f74a56db..01154ea8d 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -7,6 +7,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"refs.h\"\n #include \"tag.h\"\ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex 6fc6bcdf7..73f133419 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n \n static char *create_temp_file(unsigned char *sha1)\n {\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex 8bc999776..193f8b9d5 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"object.h\"\n #include \"delta.h\"\n #include \"pack.h\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex ebfc09faa..0a4c23648 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex 0b2ecf41a..40ccfc193 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/update-server-info.c b/builtin/update-server-info.c\nindex 6c8cc3edc..873070e51 100644\n--- a/builtin/update-server-info.c\n+++ b/builtin/update-server-info.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/var.c b/builtin/var.c\nindex aedbb53a2..6c6f46b4a 100644\n--- a/builtin/var.c\n+++ b/builtin/var.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Eric Biederman, 2005\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n \n static const char var_usage[] = \"git var (-l | <variable>)\";\n \ndiff --git a/builtin/verify-commit.c b/builtin/verify-commit.c\nindex 05b734e6d..ba38ac9b1 100644\n--- a/builtin/verify-commit.c\n+++ b/builtin/verify-commit.c\n@@ -6,6 +6,7 @@\n  * Based on git-verify-tag\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"commit.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex c94e15693..c2a1a5c50 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 5199553d9..f9a5f7535 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -6,6 +6,7 @@\n  * Based on git-verify-tag.sh\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"tag.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 793306ea5..0c5476ee9 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"dir.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/write-tree.c b/builtin/write-tree.c\nindex 084c0df78..bd0a78aa3 100644\n--- a/builtin/write-tree.c\n+++ b/builtin/write-tree.c\n@@ -5,6 +5,7 @@\n  */\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\n #include \"parse-options.h\"\ndiff --git a/cache.h b/cache.h\nindex ed56f8818..fd45b8c55 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -11,7 +11,6 @@\n #include \"string-list.h\"\n #include \"pack-revindex.h\"\n #include \"hash.h\"\n-#include \"config.h\"\n \n #ifndef platform_SHA_CTX\n /*\ndiff --git a/color.c b/color.c\nindex dee61557e..31b6207a0 100644\n--- a/color.c\n+++ b/color.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"color.h\"\n \n static int git_use_color_default = GIT_COLOR_AUTO;\ndiff --git a/column.c b/column.c\nindex d55ead18e..ff7bdab1a 100644\n--- a/column.c\n+++ b/column.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"column.h\"\n #include \"string-list.h\"\n #include \"parse-options.h\"\ndiff --git a/config.c b/config.c\nindex 146cb3452..2390f98e3 100644\n--- a/config.c\n+++ b/config.c\n@@ -6,6 +6,7 @@\n  *\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"exec_cmd.h\"\n #include \"strbuf.h\"\ndiff --git a/connect.c b/connect.c\nindex c72b1d115..e78d3f43d 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"pkt-line.h\"\n #include \"quote.h\"\n #include \"refs.h\"\ndiff --git a/convert.c b/convert.c\nindex f1e168bc3..5f4a4b1f5 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"attr.h\"\n #include \"run-command.h\"\n #include \"quote.h\"\ndiff --git a/credential-cache--daemon.c b/credential-cache--daemon.c\nindex f3814cc47..0d5c62509 100644\n--- a/credential-cache--daemon.c\n+++ b/credential-cache--daemon.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tempfile.h\"\n #include \"credential.h\"\n #include \"unix-socket.h\"\ndiff --git a/credential.c b/credential.c\nindex aa996669f..67a523353 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"credential.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\ndiff --git a/daemon.c b/daemon.c\nindex ac7181a48..30747075f 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"pkt-line.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\ndiff --git a/diff.c b/diff.c\nindex 5275c4b78..3458ec640 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2,6 +2,7 @@\n  * Copyright (C) 2005 Junio C Hamano\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tempfile.h\"\n #include \"quote.h\"\n #include \"diff.h\"\ndiff --git a/dir.c b/dir.c\nindex 9efcf1eab..d4e4258ea 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -9,6 +9,7 @@\n  */\n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"attr.h\"\n #include \"refs.h\"\ndiff --git a/environment.c b/environment.c\nindex aa478e71d..d40b21fb7 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -8,6 +8,7 @@\n  * are.\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"fmt-merge-msg.h\"\n #include \"commit.h\"\ndiff --git a/fast-import.c b/fast-import.c\nindex e69d21968..2881d4898 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -154,6 +154,7 @@ Format of STDIN stream:\n \n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"object.h\"\n #include \"blob.h\"\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex cd86865be..fbbc99c88 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\ndiff --git a/git.c b/git.c\nindex 8ff44f081..594436e43 100644\n--- a/git.c\n+++ b/git.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"exec_cmd.h\"\n #include \"help.h\"\n #include \"run-command.h\"\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex e44cc27da..8ab32df45 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"gpg-interface.h\"\ndiff --git a/graph.c b/graph.c\nindex 8b9049dd2..e7e20650d 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"color.h\"\n #include \"graph.h\"\ndiff --git a/grep.c b/grep.c\nindex d03d424e5..62c7cf970 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"grep.h\"\n #include \"userdiff.h\"\n #include \"xdiff-interface.h\"\ndiff --git a/help.c b/help.c\nindex db7f3d79a..5d44f811a 100644\n--- a/help.c\n+++ b/help.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\n #include \"run-command.h\"\ndiff --git a/http-backend.c b/http-backend.c\nindex ba5ff1aa2..519025d2c 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\n #include \"object.h\"\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 3b556d661..8af380050 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"exec_cmd.h\"\n #include \"http.h\"\n #include \"walker.h\"\ndiff --git a/http.c b/http.c\nindex d2e11ec6f..013bb0cc6 100644\n--- a/http.c\n+++ b/http.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"http.h\"\n+#include \"config.h\"\n #include \"pack.h\"\n #include \"sideband.h\"\n #include \"run-command.h\"\ndiff --git a/ident.c b/ident.c\nindex bea871c8e..d41fc9119 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -6,6 +6,7 @@\n  * Copyright (C) 2005 Linus Torvalds\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n \n static struct strbuf git_default_name = STRBUF_INIT;\n static struct strbuf git_default_email = STRBUF_INIT;\ndiff --git a/imap-send.c b/imap-send.c\nindex 857591660..59e9b12d2 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -23,6 +23,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"credential.h\"\n #include \"exec_cmd.h\"\n #include \"run-command.h\"\ndiff --git a/ll-merge.c b/ll-merge.c\nindex ac0d4a5d7..24ff94e1d 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -5,6 +5,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"attr.h\"\n #include \"xdiff-interface.h\"\n #include \"run-command.h\"\ndiff --git a/log-tree.c b/log-tree.c\nindex a4ec11c2b..7e1dfd749 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"tag.h\"\ndiff --git a/mailinfo.c b/mailinfo.c\nindex f92cb9f72..f59162453 100644\n--- a/mailinfo.c\n+++ b/mailinfo.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"utf8.h\"\n #include \"strbuf.h\"\n #include \"mailinfo.h\"\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex ae5238d82..c2494f34f 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -4,6 +4,7 @@\n  * The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"advice.h\"\n #include \"lockfile.h\"\n #include \"cache-tree.h\"\ndiff --git a/notes-utils.c b/notes-utils.c\nindex 031503d7b..3f6cbdc47 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"notes-utils.h\"\ndiff --git a/notes.c b/notes.c\nindex 542563b28..dbcfef4d7 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"notes.h\"\n #include \"blob.h\"\n #include \"tree.h\"\ndiff --git a/pager.c b/pager.c\nindex c113d898a..4dd9e1b26 100644\n--- a/pager.c\n+++ b/pager.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"run-command.h\"\n #include \"sigchain.h\"\n \ndiff --git a/parse-options.c b/parse-options.c\nindex e5ad34a2c..0dd9fc6a0 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"parse-options.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"color.h\"\n #include \"utf8.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex 828405021..ecc5331c2 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -1,5 +1,6 @@\n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"pathspec.h\"\n #include \"attr.h\"\ndiff --git a/pretty.c b/pretty.c\nindex 09701bd2f..9c9f81b5b 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"utf8.h\"\n #include \"diff.h\"\ndiff --git a/prompt.c b/prompt.c\nindex 75406390c..6d5885d00 100644\n--- a/prompt.c\n+++ b/prompt.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"prompt.h\"\ndiff --git a/read-cache.c b/read-cache.c\nindex bc156a133..c8c766dab 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -5,6 +5,7 @@\n  */\n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tempfile.h\"\n #include \"lockfile.h\"\n #include \"cache-tree.h\"\ndiff --git a/refs.c b/refs.c\nindex f0685c925..84112c88e 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -3,6 +3,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"hashmap.h\"\n #include \"lockfile.h\"\n #include \"iterator.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex d8b3f7314..621a4086c 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -1,4 +1,5 @@\n #include \"../cache.h\"\n+#include \"../config.h\"\n #include \"../refs.h\"\n #include \"refs-internal.h\"\n #include \"ref-cache.h\"\ndiff --git a/remote-curl.c b/remote-curl.c\nindex ece45993d..0053b0954 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"remote.h\"\n #include \"strbuf.h\"\n #include \"walker.h\"\ndiff --git a/remote.c b/remote.c\nindex 3649d60cd..68d20f650 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"remote.h\"\n #include \"refs.h\"\n #include \"commit.h\"\ndiff --git a/rerere.c b/rerere.c\nindex 3bd55caf3..344d6aa81 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"string-list.h\"\n #include \"rerere.h\"\ndiff --git a/send-pack.c b/send-pack.c\nindex 78bb34ebe..ed3cee321 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\ndiff --git a/sequencer.c b/sequencer.c\nindex 924fb1d0c..86b0640d2 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"sequencer.h\"\n #include \"dir.h\"\ndiff --git a/setup.c b/setup.c\nindex e3f7699a9..e99a82cbe 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"string-list.h\"\n \ndiff --git a/sha1_file.c b/sha1_file.c\nindex 59a4ed2ed..44561e0b9 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -7,6 +7,7 @@\n  * creation etc.\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"string-list.h\"\n #include \"lockfile.h\"\n #include \"delta.h\"\ndiff --git a/sha1_name.c b/sha1_name.c\nindex e9ffe685d..2875771ff 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tag.h\"\n #include \"commit.h\"\n #include \"tree.h\"\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 4f58491dd..d8f8d5ea3 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n #include \"strbuf.h\"\ndiff --git a/submodule.c b/submodule.c\nindex bf5a93d16..95328de61 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n #include \"dir.h\"\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 8e3ed6a76..1a7b8bd3d 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"string-list.h\"\n \n /*\ndiff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c\nindex 2f144d539..c6c57bba0 100644\n--- a/t/helper/test-submodule-config.c\n+++ b/t/helper/test-submodule-config.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n \ndiff --git a/trailer.c b/trailer.c\nindex 11f0b9fb4..751b56c00 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\n #include \"commit.h\"\ndiff --git a/transport.c b/transport.c\nindex 9bfcf870f..b9995306f 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"transport.h\"\n #include \"run-command.h\"\n #include \"pkt-line.h\"\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex d38c37e38..dd535bc84 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -1,5 +1,6 @@\n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"tree.h\"\n #include \"tree-walk.h\"\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 5330c02c1..7efff2fbf 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\n #include \"sideband.h\"\ndiff --git a/userdiff.c b/userdiff.c\nindex 8b732e40b..2c1502f71 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"userdiff.h\"\n #include \"attr.h\"\n \ndiff --git a/versioncmp.c b/versioncmp.c\nindex 9f81dc106..069ee94a4 100644\n--- a/versioncmp.c\n+++ b/versioncmp.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"string-list.h\"\n \n /*\ndiff --git a/wrapper.c b/wrapper.c\nindex d83741770..487a9f753 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -2,6 +2,7 @@\n  * Various trivial helper wrappers around standard functions\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n \n static void do_nothing(size_t size)\n {\ndiff --git a/xdiff-interface.c b/xdiff-interface.c\nindex 060038c2d..5ac07d734 100644\n--- a/xdiff-interface.c\n+++ b/xdiff-interface.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"xdiff-interface.h\"\n #include \"xdiff/xtypes.h\"\n #include \"xdiff/xdiffi.h\"\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322152","messageId":"20170613210806.GJ133952@aiede.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170613210321.152978-5-bmwill@google.com","subject":"Re: [PATCH v2 4/6] config: don't implicitly use gitdir","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-13T21:08:06Z","receivedAt":"2017-06-13T21:08:26Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Williams wrote:\n\n> Commit 2185fde56 (config: handle conditional include when $GIT_DIR is\n> not set up) added a 'git_dir' field to the config_options struct.  Let's\n> use this option field explicitly all the time instead of occasionally\n> falling back to calling 'git_pathdup(\"config\")' to get the path to the\n> local repository configuration.  This allows 'do_git_config_sequence()'\n> to not implicitly rely on global repository state.\n>\n> Signed-off-by: Brandon Williams <bmwill@google.com>\n> ---\n>  builtin/config.c | 2 ++\n>  config.c         | 6 ++----\n>  2 files changed, 4 insertions(+), 4 deletions(-)\n\nThe same comments as before still apply:\n\n- this changes API to make opts->git_dir mandatory, which is error prone\n  and easily avoidable, e.g. by making git_dir an argument to\n  git_config_with_options\n\n- the commit message doesn't say anything about to git dir vs common dir\n  change.  It needs to, or even better, the switch to use common dir\n  instead of git dir can happen as a separate patch.\n\nThanks,\nJonathan\n"},{"id":"322153","messageId":"20170613211305.GK133952@aiede.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170613210321.152978-2-bmwill@google.com","subject":"Re: [PATCH v2 1/6] config: create config.h","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-13T21:13:05Z","receivedAt":"2017-06-13T21:13:21Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nBrandon Williams wrote:\n\n> Move all config related declarations from cache.h to a new config.h\n> header file.  This makes cache.h smaller and allows for the opportunity\n> in a following patch to only include config.h when needed.\n>\n> Signed-off-by: Brandon Williams <bmwill@google.com>\n> ---\n>  cache.h  | 190 +------------------------------------------------------------\n>  config.h | 194 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n>  2 files changed, 195 insertions(+), 189 deletions(-)\n>  create mode 100644 config.h\n\n'git diff HEAD^:cache.h config.h' confirms that this is\nstraightforward code movement and didn't introduce any unintentional\nchanges along the way.  Thanks for writing it.\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"322154","messageId":"20170613211456.GL133952@aiede.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170613210321.152978-3-bmwill@google.com","subject":"Re: [PATCH v2 2/6] config: remove git_config_iter","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-13T21:14:56Z","receivedAt":"2017-06-13T21:15:07Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Williams wrote:\n\n> Since there is no implementation of the function 'git_config_iter' lets\n> stop exporting it and remove the prototype from config.h.\n>\n> Signed-off-by: Brandon Williams <bmwill@google.com>\n> ---\n>  config.h | 1 -\n>  1 file changed, 1 deletion(-)\n\nLanguage nit:\n\n\ts/' lets/', let's/\n\nThat is, there is a comma and an apostrophe missing.\n\nWith or without that tweak,\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"322156","messageId":"20170613213815.GP154599@google.com","threadId":"46161","inReplyTo":"20170613210806.GJ133952@aiede.mtv.corp.google.com","subject":"Re: [PATCH v2 4/6] config: don't implicitly use gitdir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-13T21:38:15Z","receivedAt":"2017-06-13T21:38:24Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/13, Jonathan Nieder wrote:\n> Brandon Williams wrote:\n> \n> > Commit 2185fde56 (config: handle conditional include when $GIT_DIR is\n> > not set up) added a 'git_dir' field to the config_options struct.  Let's\n> > use this option field explicitly all the time instead of occasionally\n> > falling back to calling 'git_pathdup(\"config\")' to get the path to the\n> > local repository configuration.  This allows 'do_git_config_sequence()'\n> > to not implicitly rely on global repository state.\n> >\n> > Signed-off-by: Brandon Williams <bmwill@google.com>\n> > ---\n> >  builtin/config.c | 2 ++\n> >  config.c         | 6 ++----\n> >  2 files changed, 4 insertions(+), 4 deletions(-)\n> \n> The same comments as before still apply:\n> \n> - this changes API to make opts->git_dir mandatory, which is error prone\n>   and easily avoidable, e.g. by making git_dir an argument to\n>   git_config_with_options\n\nI still don't agree with this.  I have looked at all callers and ensured\nthat 'git_dir' will be set when appropriate in the 'config_options'\nstruct.  I find the notion ridiculous that I would need to change a\nfunction's name or arguments every time the internals of the function\nare adjusted or when an options struct obtains a new field.  Plus, there\nis already an aptly named parameter of type 'config_options' with which\nto hold options for the config machinery.  This struct is also added to\nin a later patch to include commondir so that the gitdir vs commondir\nissue can be resolved.\n\n> - the commit message doesn't say anything about to git dir vs common dir\n>   change.  It needs to, or even better, the switch to use common dir\n>   instead of git dir can happen as a separate patch.\n\nThere really isn't any switching in this patch.  One of the following\npatches in this series addresses this problem in more detail though.\n\n-- \nBrandon Williams\n"},{"id":"322158","messageId":"20170613215138.GM133952@aiede.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170613213815.GP154599@google.com","subject":"Re: [PATCH v2 4/6] config: don't implicitly use gitdir","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-13T21:51:38Z","receivedAt":"2017-06-13T21:51:48Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Williams wrote:\n> On 06/13, Jonathan Nieder wrote:\n>> Brandon Williams wrote:\n\n>>> Commit 2185fde56 (config: handle conditional include when $GIT_DIR is\n>>> not set up) added a 'git_dir' field to the config_options struct.  Let's\n>>> use this option field explicitly all the time instead of occasionally\n>>> falling back to calling 'git_pathdup(\"config\")' to get the path to the\n>>> local repository configuration.  This allows 'do_git_config_sequence()'\n>>> to not implicitly rely on global repository state.\n>>>\n>>> Signed-off-by: Brandon Williams <bmwill@google.com>\n>>> ---\n>>>  builtin/config.c | 2 ++\n>>>  config.c         | 6 ++----\n>>>  2 files changed, 4 insertions(+), 4 deletions(-)\n>>\n>> The same comments as before still apply:\n>>\n>> - this changes API to make opts->git_dir mandatory, which is error prone\n>>   and easily avoidable, e.g. by making git_dir an argument to\n>>   git_config_with_options\n>\n> I still don't agree with this.  I have looked at all callers and ensured\n> that 'git_dir' will be set when appropriate in the 'config_options'\n> struct.  I find the notion ridiculous that I would need to change a\n> function's name or arguments every time the internals of the function\n> are adjusted or when an options struct obtains a new field.  Plus, there\n> is already an aptly named parameter of type 'config_options' with which\n> to hold options for the config machinery.  This struct is also added to\n> in a later patch to include commondir so that the gitdir vs commondir\n> issue can be resolved.\n\nWhat is the next step, then?  You can find the notion ridiculous but\nit's how this project has worked in my experience (and how other\nprojects with similar patch-based workflows work).\n\nI also don't really understand why it is so bad to have to care about\nAPI compatibility when it is so simple to do --- change the function\nsignature or change the function name.  That's all it takes.\n\n>> - the commit message doesn't say anything about to git dir vs common dir\n>>   change.  It needs to, or even better, the switch to use common dir\n>>   instead of git dir can happen as a separate patch.\n>\n> There really isn't any switching in this patch.  One of the following\n> patches in this series addresses this problem in more detail though.\n\nThere is, because of the gitdir: behavior change.\n\nJonathan\n"},{"id":"322160","messageId":"CAPc5daWpXnkNyuGNtFi4YTyB+Np5Yw8yZCGwu5VNzv+WON1u2Q@mail.gmail.com","threadId":"46161","inReplyTo":"20170613215138.GM133952@aiede.mtv.corp.google.com","subject":"Re: [PATCH v2 4/6] config: don't implicitly use gitdir","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-06-13T21:55:10Z","receivedAt":"2017-06-13T21:55:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"On Tue, Jun 13, 2017 at 2:51 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n>\n> What is the next step, then?  You can find the notion ridiculous but\n> it's how this project has worked in my experience (and how other\n> projects with similar patch-based workflows work).\n\nDoes \"patch-based\" have much to do with this? I agree that distributed\nnature of the development would bring this issue, but I tend to think that\nusing merge/pull based workflow would not alleviate it--am I mistaken?\n"},{"id":"322161","messageId":"20170613215818.GN133952@aiede.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170613210321.152978-4-bmwill@google.com","subject":"Re: [PATCH v2 3/6] config: don't include config.h by default","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-13T21:58:18Z","receivedAt":"2017-06-13T21:58:26Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Williams wrote:\n> Stop including config.h by default in cache.h.  Instead only include\n> config.h in those files which require use of the config system.\n>\n> Signed-off-by: Brandon Williams <bmwill@google.com>\n> ---\n[...]\n>  145 files changed, 145 insertions(+), 1 deletion(-)\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThanks.\n"},{"id":"322162","messageId":"20170613220532.GO133952@aiede.mtv.corp.google.com","threadId":"46161","inReplyTo":"CAPc5daWpXnkNyuGNtFi4YTyB+Np5Yw8yZCGwu5VNzv+WON1u2Q@mail.gmail.com","subject":"Re: [PATCH v2 4/6] config: don't implicitly use gitdir","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-06-13T22:05:32Z","receivedAt":"2017-06-13T22:05:41Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n> On Tue, Jun 13, 2017 at 2:51 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n\n>> What is the next step, then?  You can find the notion ridiculous but\n>> it's how this project has worked in my experience (and how other\n>> projects with similar patch-based workflows work).\n>\n> Does \"patch-based\" have much to do with this? I agree that distributed\n> nature of the development would bring this issue, but I tend to think that\n> using merge/pull based workflow would not alleviate it--am I mistaken?\n\nThanks, you're right.  Distributed is the relevant feature.\n\nThe same issue can even come up when using a centralized version\ncontrol system like Subversion or Perforce --- without attention to\nAPI compatibility, someone's change that was thoroughly reviewed and\nwell tested locally in a developer's working directory can introduce\nsubtle breakage once they run \"svn commit\", causing it to merge with\nthe latest upstream changes.  The problem becomes more likely the more\ndistributed a project is since each developer becomes less aware of\nthe other changes that their modifications need to be compatible with.\n\nJonathan\n"},{"id":"322186","messageId":"CA+P7+xrw_T7pqtKXcU_KZ+9NFV9rETdqFrKPK_nyXJg8Le_ZvA@mail.gmail.com","threadId":"46161","inReplyTo":"20170613220532.GO133952@aiede.mtv.corp.google.com","subject":"Re: [PATCH v2 4/6] config: don't implicitly use gitdir","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2017-06-14T04:40:21Z","receivedAt":"2017-06-14T04:40:48Z","isPatch":true,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Tue, Jun 13, 2017 at 3:05 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Junio C Hamano wrote:\n>> On Tue, Jun 13, 2017 at 2:51 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n>\n>>> What is the next step, then?  You can find the notion ridiculous but\n>>> it's how this project has worked in my experience (and how other\n>>> projects with similar patch-based workflows work).\n>>\n>> Does \"patch-based\" have much to do with this? I agree that distributed\n>> nature of the development would bring this issue, but I tend to think that\n>> using merge/pull based workflow would not alleviate it--am I mistaken?\n>\n> Thanks, you're right.  Distributed is the relevant feature.\n>\n> The same issue can even come up when using a centralized version\n> control system like Subversion or Perforce --- without attention to\n> API compatibility, someone's change that was thoroughly reviewed and\n> well tested locally in a developer's working directory can introduce\n> subtle breakage once they run \"svn commit\", causing it to merge with\n> the latest upstream changes.  The problem becomes more likely the more\n> distributed a project is since each developer becomes less aware of\n> the other changes that their modifications need to be compatible with.\n>\n> Jonathan\n\nWhich would be why early integration (pu) and a good test suite are\nfor. However, it's much easier to catch if you change the name when\nthe function no longer behaves the same. In this case I guess you\ncould argue that the part that changed wasn't part of the API...\nHowever, I think I'd lean towards \"we had code depending on it, so yes\nit was\".\n\nIt's ok to add new functionality only obtained by new flags or\nsimilar,  but not ok to break potentially existing callers.\n\nThanks,\nJake\n"},{"id":"322193","messageId":"20170614061548.uqxtbmwizfdyivv7@sigill.intra.peff.net","threadId":"46161","inReplyTo":"20170613210321.152978-6-bmwill@google.com","subject":"Re: [PATCH v2 5/6] setup: teach discover_git_directory to respect the commondir","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-06-14T06:15:48Z","receivedAt":"2017-06-14T06:15:55Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jun 13, 2017 at 02:03:20PM -0700, Brandon Williams wrote:\n\n> Currently 'discover_git_directory' only looks at the gitdir to determine\n> if a git directory was discovered.  This causes a problem in the event\n> that the gitdir which was discovered was in fact a per-worktree git\n> directory and not the common git directory.  This is because the\n> repository config, which is checked to verify the repository's format,\n> is stored in the commondir and not in the per-worktree gitdir.  Correct\n> this behavior by checking the config stored in the commondir.\n> \n> It will also be of use for callers to have access to the commondir, so\n> lets also return that upon successfully discovering a git directory.\n\nThis makes sense, and I agree is the correct path forward for handling\nthe config code's needs.\n\n> diff --git a/cache.h b/cache.h\n> index fd45b8c55..a4176436d 100644\n> --- a/cache.h\n> +++ b/cache.h\n> @@ -530,7 +530,8 @@ extern void setup_work_tree(void);\n>   * appended to gitdir. The return value is either NULL if no repository was\n>   * found, or pointing to the path inside gitdir's buffer.\n>   */\n> -extern const char *discover_git_directory(struct strbuf *gitdir);\n> +extern const char *discover_git_directory(struct strbuf *commondir,\n> +\t\t\t\t\t  struct strbuf *gitdir);\n\nDoes the docstring above the function need updating? What happens when\nyou are not in a worktree? Are both strbufs filled out with the same\nvalue?\n\nThat's what I'd assume (and what it looks like looking at the code), but\nit's probably worth being explicit.\n\nWe also return a pointer. I think this still points into the gitdir\nstrbuf. Which I guess is reasonable, though probably should be\ndocumented.\n\nGiven that the callers only ever look at whether it's non-NULL, it\nprobably would be better to just return a true/false value. This might\nbe a good time to do that, because the function signature is changing\nalready (so if we switch to the usual \"0 is success\", a newly added call\nwon't silently do the wrong thing).\n\n> @@ -983,6 +987,7 @@ const char *discover_git_directory(struct strbuf *gitdir)\n>  \t\twarning(\"ignoring git dir '%s': %s\",\n>  \t\t\tgitdir->buf + gitdir_offset, err.buf);\n>  \t\tstrbuf_release(&err);\n> +\t\tstrbuf_setlen(commondir, commondir_offset);\n>  \t\treturn NULL;\n>  \t}\n\nI'd have expected these resetting setlens to be paired between gitdir\nand commondir. And indeed, they should be; this is the same case that\nDscho fixed in the first patch of his series.\n\nI kind of wonder if one of you should take ownership and do a combined\nseries.\n\n-Peff\n"},{"id":"322194","messageId":"20170614062505.zojevt553sfhbt2h@sigill.intra.peff.net","threadId":"46161","inReplyTo":"20170613213815.GP154599@google.com","subject":"Re: [PATCH v2 4/6] config: don't implicitly use gitdir","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-06-14T06:25:05Z","receivedAt":"2017-06-14T06:25:12Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jun 13, 2017 at 02:38:15PM -0700, Brandon Williams wrote:\n\n> > The same comments as before still apply:\n> > \n> > - this changes API to make opts->git_dir mandatory, which is error prone\n> >   and easily avoidable, e.g. by making git_dir an argument to\n> >   git_config_with_options\n> \n> I still don't agree with this.  I have looked at all callers and ensured\n> that 'git_dir' will be set when appropriate in the 'config_options'\n> struct.  I find the notion ridiculous that I would need to change a\n> function's name or arguments every time the internals of the function\n> are adjusted or when an options struct obtains a new field.  Plus, there\n> is already an aptly named parameter of type 'config_options' with which\n> to hold options for the config machinery.  This struct is also added to\n> in a later patch to include commondir so that the gitdir vs commondir\n> issue can be resolved.\n\nI've already said \"I'm OK either way for this case\", but let me clarify\na bit.\n\nIt's not about changing a function's internals, or even the struct\nobtaining a new field. The key change here is that the _interface_\nchanged. Callers used to be able to pass NULL for the git_dir and have\nthe function behave one way, and now if they do so it behaves\ndifferently. That leads to spooky action at a distance. Code which you\ndidn't know about still compiles but does something subtly different.\n\nWe can catch that at the compile stage, or we can catch it at the test\nstage, or we can decide it's somebody else's problem to deal with if\nthey wrote code that the rest of the project hasn't seen.\n\nBut it is a real thing that comes up in a big, open project. There is no\n\"looked at all the callers\", because you can't see the whole universe of\ncode. I do think it's a much bigger deal in a project like the kernel,\nwhich has hundreds of long-lasting forks. Git has only a handful, and we\ndon't necessarily need to bend over backwards for people whose code\nhasn't been shared.\n\n> > - the commit message doesn't say anything about to git dir vs common dir\n> >   change.  It needs to, or even better, the switch to use common dir\n> >   instead of git dir can happen as a separate patch.\n> \n> There really isn't any switching in this patch.  One of the following\n> patches in this series addresses this problem in more detail though.\n\nI would have expected that patch to actually come earlier. That fixes\nthe bug there, and then this conversion patch becomes that much more\nstraightforward.\n\n-Peff\n"},{"id":"322265","messageId":"20170614171454.GA55677@google.com","threadId":"46161","inReplyTo":"20170614062505.zojevt553sfhbt2h@sigill.intra.peff.net","subject":"Re: [PATCH v2 4/6] config: don't implicitly use gitdir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-14T17:14:54Z","receivedAt":"2017-06-14T17:15:03Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/14, Jeff King wrote:\n> On Tue, Jun 13, 2017 at 02:38:15PM -0700, Brandon Williams wrote:\n> \n> > > The same comments as before still apply:\n> > > \n> > > - this changes API to make opts->git_dir mandatory, which is error prone\n> > >   and easily avoidable, e.g. by making git_dir an argument to\n> > >   git_config_with_options\n> > \n> > I still don't agree with this.  I have looked at all callers and ensured\n> > that 'git_dir' will be set when appropriate in the 'config_options'\n> > struct.  I find the notion ridiculous that I would need to change a\n> > function's name or arguments every time the internals of the function\n> > are adjusted or when an options struct obtains a new field.  Plus, there\n> > is already an aptly named parameter of type 'config_options' with which\n> > to hold options for the config machinery.  This struct is also added to\n> > in a later patch to include commondir so that the gitdir vs commondir\n> > issue can be resolved.\n> \n> I've already said \"I'm OK either way for this case\", but let me clarify\n> a bit.\n> \n> It's not about changing a function's internals, or even the struct\n> obtaining a new field. The key change here is that the _interface_\n> changed. Callers used to be able to pass NULL for the git_dir and have\n> the function behave one way, and now if they do so it behaves\n> differently. That leads to spooky action at a distance. Code which you\n> didn't know about still compiles but does something subtly different.\n> \n> We can catch that at the compile stage, or we can catch it at the test\n> stage, or we can decide it's somebody else's problem to deal with if\n> they wrote code that the rest of the project hasn't seen.\n> \n> But it is a real thing that comes up in a big, open project. There is no\n> \"looked at all the callers\", because you can't see the whole universe of\n> code. I do think it's a much bigger deal in a project like the kernel,\n> which has hundreds of long-lasting forks. Git has only a handful, and we\n> don't necessarily need to bend over backwards for people whose code\n> hasn't been shared.\n\nAt this point I'm done arguing, I'll rename the function and drop the\n'git' prefix as that's the only sensible name I can think of.\n\n> \n> > > - the commit message doesn't say anything about to git dir vs common dir\n> > >   change.  It needs to, or even better, the switch to use common dir\n> > >   instead of git dir can happen as a separate patch.\n> > \n> > There really isn't any switching in this patch.  One of the following\n> > patches in this series addresses this problem in more detail though.\n> \n> I would have expected that patch to actually come earlier. That fixes\n> the bug there, and then this conversion patch becomes that much more\n> straightforward.\n\nTrue, I can reorder the patches in v3 so that this change flows better.\n\n-- \nBrandon Williams\n"},{"id":"322266","messageId":"20170614171906.GB55677@google.com","threadId":"46161","inReplyTo":"20170614061548.uqxtbmwizfdyivv7@sigill.intra.peff.net","subject":"Re: [PATCH v2 5/6] setup: teach discover_git_directory to respect the commondir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-14T17:19:06Z","receivedAt":"2017-06-14T17:19:13Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/14, Jeff King wrote:\n> On Tue, Jun 13, 2017 at 02:03:20PM -0700, Brandon Williams wrote:\n> \n> > Currently 'discover_git_directory' only looks at the gitdir to determine\n> > if a git directory was discovered.  This causes a problem in the event\n> > that the gitdir which was discovered was in fact a per-worktree git\n> > directory and not the common git directory.  This is because the\n> > repository config, which is checked to verify the repository's format,\n> > is stored in the commondir and not in the per-worktree gitdir.  Correct\n> > this behavior by checking the config stored in the commondir.\n> > \n> > It will also be of use for callers to have access to the commondir, so\n> > lets also return that upon successfully discovering a git directory.\n> \n> This makes sense, and I agree is the correct path forward for handling\n> the config code's needs.\n> \n> > diff --git a/cache.h b/cache.h\n> > index fd45b8c55..a4176436d 100644\n> > --- a/cache.h\n> > +++ b/cache.h\n> > @@ -530,7 +530,8 @@ extern void setup_work_tree(void);\n> >   * appended to gitdir. The return value is either NULL if no repository was\n> >   * found, or pointing to the path inside gitdir's buffer.\n> >   */\n> > -extern const char *discover_git_directory(struct strbuf *gitdir);\n> > +extern const char *discover_git_directory(struct strbuf *commondir,\n> > +\t\t\t\t\t  struct strbuf *gitdir);\n> \n> Does the docstring above the function need updating? What happens when\n> you are not in a worktree? Are both strbufs filled out with the same\n> value?\n\nYes I'll update the docstring to reflect the change.  And yes if you\naren't in a worktree, then both strbufs would hold the same value.\n\n> That's what I'd assume (and what it looks like looking at the code), but\n> it's probably worth being explicit.\n> \n> We also return a pointer. I think this still points into the gitdir\n> strbuf. Which I guess is reasonable, though probably should be\n> documented.\n> \n> Given that the callers only ever look at whether it's non-NULL, it\n> probably would be better to just return a true/false value. This might\n> be a good time to do that, because the function signature is changing\n> already (so if we switch to the usual \"0 is success\", a newly added call\n> won't silently do the wrong thing).\n\nI agree with that.  I can tweak the return value to return a success\ncode.\n\n> \n> > @@ -983,6 +987,7 @@ const char *discover_git_directory(struct strbuf *gitdir)\n> >  \t\twarning(\"ignoring git dir '%s': %s\",\n> >  \t\t\tgitdir->buf + gitdir_offset, err.buf);\n> >  \t\tstrbuf_release(&err);\n> > +\t\tstrbuf_setlen(commondir, commondir_offset);\n> >  \t\treturn NULL;\n> >  \t}\n> \n> I'd have expected these resetting setlens to be paired between gitdir\n> and commondir. And indeed, they should be; this is the same case that\n> Dscho fixed in the first patch of his series.\n> \n> I kind of wonder if one of you should take ownership and do a combined\n> series.\n\nYeah I think that Dschos series has less review to still take place (as\nhe just sent out a v3) so I'll just rebase ontop of his series.\n\n-- \nBrandon Williams\n"},{"id":"322271","messageId":"20170614180739.72193-1-bmwill@google.com","threadId":"46161","inReplyTo":"20170613210321.152978-1-bmwill@google.com","subject":"[PATCH v3 0/6] config.h","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-14T18:07:33Z","receivedAt":"2017-06-14T18:07:51Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Changes in v3:\n\n* tweaked the discover_git_directory function's API based on Peff's feedback\n* reordered the last three patches so that they flowed a bit better\n* renamed 'git_config_with_options'\n* rebased ontop of v4 of Dscho's alias series\n  https://public-inbox.org/git/cover.1497440104.git.johannes.schindelin@gmx.de/\n\n\nBrandon Williams (6):\n  config: create config.h\n  config: remove git_config_iter\n  config: don't include config.h by default\n  setup: teach discover_git_directory to respect the commondir\n  config: respect commondir\n  config: don't implicitly use gitdir or commondir\n\n advice.c                         |   1 +\n alias.c                          |   1 +\n apply.c                          |   1 +\n archive-tar.c                    |   1 +\n archive-zip.c                    |   1 +\n archive.c                        |   1 +\n attr.c                           |   1 +\n bisect.c                         |   1 +\n branch.c                         |   1 +\n builtin/add.c                    |   1 +\n builtin/am.c                     |   1 +\n builtin/blame.c                  |   2 +\n builtin/branch.c                 |   1 +\n builtin/cat-file.c               |   1 +\n builtin/check-attr.c             |   1 +\n builtin/check-ignore.c           |   1 +\n builtin/check-mailmap.c          |   1 +\n builtin/checkout-index.c         |   1 +\n builtin/checkout.c               |   1 +\n builtin/clean.c                  |   1 +\n builtin/clone.c                  |   1 +\n builtin/column.c                 |   1 +\n builtin/commit-tree.c            |   1 +\n builtin/commit.c                 |   1 +\n builtin/config.c                 |  27 +++---\n builtin/count-objects.c          |   1 +\n builtin/describe.c               |   1 +\n builtin/diff-files.c             |   1 +\n builtin/diff-index.c             |   1 +\n builtin/diff-tree.c              |   1 +\n builtin/diff.c                   |   1 +\n builtin/difftool.c               |   1 +\n builtin/fast-export.c            |   1 +\n builtin/fetch.c                  |   1 +\n builtin/fmt-merge-msg.c          |   1 +\n builtin/for-each-ref.c           |   1 +\n builtin/fsck.c                   |   1 +\n builtin/gc.c                     |   1 +\n builtin/grep.c                   |   1 +\n builtin/hash-object.c            |   1 +\n builtin/help.c                   |   1 +\n builtin/index-pack.c             |   1 +\n builtin/init-db.c                |   1 +\n builtin/log.c                    |   1 +\n builtin/ls-files.c               |   1 +\n builtin/ls-tree.c                |   1 +\n builtin/merge-base.c             |   1 +\n builtin/merge-file.c             |   1 +\n builtin/merge.c                  |   1 +\n builtin/mv.c                     |   1 +\n builtin/name-rev.c               |   1 +\n builtin/notes.c                  |   1 +\n builtin/pack-objects.c           |   1 +\n builtin/patch-id.c               |   1 +\n builtin/pull.c                   |   1 +\n builtin/push.c                   |   1 +\n builtin/read-tree.c              |   1 +\n builtin/rebase--helper.c         |   1 +\n builtin/receive-pack.c           |   1 +\n builtin/reflog.c                 |   1 +\n builtin/remote.c                 |   1 +\n builtin/repack.c                 |   1 +\n builtin/replace.c                |   1 +\n builtin/rerere.c                 |   1 +\n builtin/reset.c                  |   1 +\n builtin/rev-list.c               |   1 +\n builtin/rev-parse.c              |   1 +\n builtin/revert.c                 |   1 +\n builtin/rm.c                     |   1 +\n builtin/send-pack.c              |   1 +\n builtin/shortlog.c               |   1 +\n builtin/show-branch.c            |   1 +\n builtin/stripspace.c             |   1 +\n builtin/submodule--helper.c      |   1 +\n builtin/symbolic-ref.c           |   1 +\n builtin/tag.c                    |   1 +\n builtin/unpack-file.c            |   1 +\n builtin/unpack-objects.c         |   1 +\n builtin/update-index.c           |   1 +\n builtin/update-ref.c             |   1 +\n builtin/update-server-info.c     |   1 +\n builtin/var.c                    |   1 +\n builtin/verify-commit.c          |   1 +\n builtin/verify-pack.c            |   1 +\n builtin/verify-tag.c             |   1 +\n builtin/worktree.c               |   1 +\n builtin/write-tree.c             |   1 +\n cache.h                          | 204 ++-------------------------------------\n color.c                          |   1 +\n column.c                         |   1 +\n compat/precompose_utf8.c         |   1 +\n config.c                         |  41 ++++----\n config.h                         | 194 +++++++++++++++++++++++++++++++++++++\n connect.c                        |   1 +\n convert.c                        |   1 +\n credential-cache--daemon.c       |   1 +\n credential.c                     |   1 +\n daemon.c                         |   1 +\n diff.c                           |   1 +\n dir.c                            |   1 +\n environment.c                    |   1 +\n fast-import.c                    |   1 +\n fetch-pack.c                     |   1 +\n git.c                            |   1 +\n gpg-interface.c                  |   1 +\n graph.c                          |   1 +\n grep.c                           |   1 +\n help.c                           |   1 +\n http-backend.c                   |   1 +\n http-fetch.c                     |   1 +\n http.c                           |   1 +\n ident.c                          |   1 +\n imap-send.c                      |   1 +\n ll-merge.c                       |   1 +\n log-tree.c                       |   1 +\n mailinfo.c                       |   1 +\n merge-recursive.c                |   1 +\n notes-utils.c                    |   1 +\n notes.c                          |   1 +\n pager.c                          |   1 +\n parse-options.c                  |   1 +\n pathspec.c                       |   1 +\n pretty.c                         |   1 +\n prompt.c                         |   1 +\n read-cache.c                     |   1 +\n refs.c                           |   1 +\n refs/files-backend.c             |   1 +\n remote-curl.c                    |   1 +\n remote.c                         |   1 +\n rerere.c                         |   1 +\n send-pack.c                      |   1 +\n sequencer.c                      |   1 +\n setup.c                          |  18 ++--\n sha1_file.c                      |   1 +\n sha1_name.c                      |   1 +\n submodule-config.c               |   1 +\n submodule.c                      |   1 +\n t/helper/test-config.c           |   1 +\n t/helper/test-submodule-config.c |   1 +\n trailer.c                        |   1 +\n transport.c                      |   1 +\n unpack-trees.c                   |   1 +\n upload-pack.c                    |   1 +\n userdiff.c                       |   1 +\n versioncmp.c                     |   1 +\n wrapper.c                        |   1 +\n xdiff-interface.c                |   1 +\n 147 files changed, 398 insertions(+), 229 deletions(-)\n create mode 100644 config.h\n\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322272","messageId":"20170614180739.72193-2-bmwill@google.com","threadId":"46161","inReplyTo":"20170614180739.72193-1-bmwill@google.com","subject":"[PATCH v3 1/6] config: create config.h","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-14T18:07:34Z","receivedAt":"2017-06-14T18:07:53Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Move all config related declarations from cache.h to a new config.h\nheader file.  This makes cache.h smaller and allows for the opportunity\nin a following patch to only include config.h when needed.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n cache.h  | 190 +------------------------------------------------------------\n config.h | 194 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 195 insertions(+), 189 deletions(-)\n create mode 100644 config.h\n\ndiff --git a/cache.h b/cache.h\nindex 4d92aae0e..ed56f8818 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -11,6 +11,7 @@\n #include \"string-list.h\"\n #include \"pack-revindex.h\"\n #include \"hash.h\"\n+#include \"config.h\"\n \n #ifndef platform_SHA_CTX\n /*\n@@ -1872,188 +1873,9 @@ extern int packed_object_info(struct packed_git *pack, off_t offset, struct obje\n /* Dumb servers support */\n extern int update_server_info(int);\n \n-/* git_config_parse_key() returns these negated: */\n-#define CONFIG_INVALID_KEY 1\n-#define CONFIG_NO_SECTION_OR_NAME 2\n-/* git_config_set_gently(), git_config_set_multivar_gently() return the above or these: */\n-#define CONFIG_NO_LOCK -1\n-#define CONFIG_INVALID_FILE 3\n-#define CONFIG_NO_WRITE 4\n-#define CONFIG_NOTHING_SET 5\n-#define CONFIG_INVALID_PATTERN 6\n-#define CONFIG_GENERIC_ERROR 7\n-\n-#define CONFIG_REGEX_NONE ((void *)1)\n-\n-struct git_config_source {\n-\tunsigned int use_stdin:1;\n-\tconst char *file;\n-\tconst char *blob;\n-};\n-\n-enum config_origin_type {\n-\tCONFIG_ORIGIN_BLOB,\n-\tCONFIG_ORIGIN_FILE,\n-\tCONFIG_ORIGIN_STDIN,\n-\tCONFIG_ORIGIN_SUBMODULE_BLOB,\n-\tCONFIG_ORIGIN_CMDLINE\n-};\n-\n-struct config_options {\n-\tunsigned int respect_includes : 1;\n-\tconst char *git_dir;\n-};\n-\n-typedef int (*config_fn_t)(const char *, const char *, void *);\n-extern int git_default_config(const char *, const char *, void *);\n-extern int git_config_from_file(config_fn_t fn, const char *, void *);\n-extern int git_config_from_mem(config_fn_t fn, const enum config_origin_type,\n-\t\t\t\t\tconst char *name, const char *buf, size_t len, void *data);\n-extern int git_config_from_blob_sha1(config_fn_t fn, const char *name,\n-\t\t\t\t     const unsigned char *sha1, void *data);\n-extern void git_config_push_parameter(const char *text);\n-extern int git_config_from_parameters(config_fn_t fn, void *data);\n-extern void read_early_config(config_fn_t cb, void *data);\n-extern void git_config(config_fn_t fn, void *);\n-extern int git_config_with_options(config_fn_t fn, void *,\n-\t\t\t\t   struct git_config_source *config_source,\n-\t\t\t\t   const struct config_options *opts);\n-extern int git_parse_ulong(const char *, unsigned long *);\n-extern int git_parse_maybe_bool(const char *);\n-extern int git_config_int(const char *, const char *);\n-extern int64_t git_config_int64(const char *, const char *);\n-extern unsigned long git_config_ulong(const char *, const char *);\n-extern ssize_t git_config_ssize_t(const char *, const char *);\n-extern int git_config_bool_or_int(const char *, const char *, int *);\n-extern int git_config_bool(const char *, const char *);\n-extern int git_config_maybe_bool(const char *, const char *);\n-extern int git_config_string(const char **, const char *, const char *);\n-extern int git_config_pathname(const char **, const char *, const char *);\n-extern int git_config_set_in_file_gently(const char *, const char *, const char *);\n-extern void git_config_set_in_file(const char *, const char *, const char *);\n-extern int git_config_set_gently(const char *, const char *);\n-extern void git_config_set(const char *, const char *);\n-extern int git_config_parse_key(const char *, char **, int *);\n-extern int git_config_key_is_valid(const char *key);\n-extern int git_config_set_multivar_gently(const char *, const char *, const char *, int);\n-extern void git_config_set_multivar(const char *, const char *, const char *, int);\n-extern int git_config_set_multivar_in_file_gently(const char *, const char *, const char *, const char *, int);\n-extern void git_config_set_multivar_in_file(const char *, const char *, const char *, const char *, int);\n-extern int git_config_rename_section(const char *, const char *);\n-extern int git_config_rename_section_in_file(const char *, const char *, const char *);\n-extern const char *git_etc_gitconfig(void);\n-extern int git_env_bool(const char *, int);\n-extern unsigned long git_env_ulong(const char *, unsigned long);\n-extern int git_config_system(void);\n-extern int config_error_nonbool(const char *);\n-#if defined(__GNUC__)\n-#define config_error_nonbool(s) (config_error_nonbool(s), const_error())\n-#endif\n extern const char *get_log_output_encoding(void);\n extern const char *get_commit_output_encoding(void);\n \n-extern int git_config_parse_parameter(const char *, config_fn_t fn, void *data);\n-\n-enum config_scope {\n-\tCONFIG_SCOPE_UNKNOWN = 0,\n-\tCONFIG_SCOPE_SYSTEM,\n-\tCONFIG_SCOPE_GLOBAL,\n-\tCONFIG_SCOPE_REPO,\n-\tCONFIG_SCOPE_CMDLINE,\n-};\n-\n-extern enum config_scope current_config_scope(void);\n-extern const char *current_config_origin_type(void);\n-extern const char *current_config_name(void);\n-\n-struct config_include_data {\n-\tint depth;\n-\tconfig_fn_t fn;\n-\tvoid *data;\n-\tconst struct config_options *opts;\n-};\n-#define CONFIG_INCLUDE_INIT { 0 }\n-extern int git_config_include(const char *name, const char *value, void *data);\n-\n-/*\n- * Match and parse a config key of the form:\n- *\n- *   section.(subsection.)?key\n- *\n- * (i.e., what gets handed to a config_fn_t). The caller provides the section;\n- * we return -1 if it does not match, 0 otherwise. The subsection and key\n- * out-parameters are filled by the function (and *subsection is NULL if it is\n- * missing).\n- *\n- * If the subsection pointer-to-pointer passed in is NULL, returns 0 only if\n- * there is no subsection at all.\n- */\n-extern int parse_config_key(const char *var,\n-\t\t\t    const char *section,\n-\t\t\t    const char **subsection, int *subsection_len,\n-\t\t\t    const char **key);\n-\n-struct config_set_element {\n-\tstruct hashmap_entry ent;\n-\tchar *key;\n-\tstruct string_list value_list;\n-};\n-\n-struct configset_list_item {\n-\tstruct config_set_element *e;\n-\tint value_index;\n-};\n-\n-/*\n- * the contents of the list are ordered according to their\n- * position in the config files and order of parsing the files.\n- * (i.e. key-value pair at the last position of .git/config will\n- * be at the last item of the list)\n- */\n-struct configset_list {\n-\tstruct configset_list_item *items;\n-\tunsigned int nr, alloc;\n-};\n-\n-struct config_set {\n-\tstruct hashmap config_hash;\n-\tint hash_initialized;\n-\tstruct configset_list list;\n-};\n-\n-extern void git_configset_init(struct config_set *cs);\n-extern int git_configset_add_file(struct config_set *cs, const char *filename);\n-extern int git_configset_get_value(struct config_set *cs, const char *key, const char **value);\n-extern const struct string_list *git_configset_get_value_multi(struct config_set *cs, const char *key);\n-extern void git_configset_clear(struct config_set *cs);\n-extern int git_configset_get_string_const(struct config_set *cs, const char *key, const char **dest);\n-extern int git_configset_get_string(struct config_set *cs, const char *key, char **dest);\n-extern int git_configset_get_int(struct config_set *cs, const char *key, int *dest);\n-extern int git_configset_get_ulong(struct config_set *cs, const char *key, unsigned long *dest);\n-extern int git_configset_get_bool(struct config_set *cs, const char *key, int *dest);\n-extern int git_configset_get_bool_or_int(struct config_set *cs, const char *key, int *is_bool, int *dest);\n-extern int git_configset_get_maybe_bool(struct config_set *cs, const char *key, int *dest);\n-extern int git_configset_get_pathname(struct config_set *cs, const char *key, const char **dest);\n-\n-extern int git_config_get_value(const char *key, const char **value);\n-extern const struct string_list *git_config_get_value_multi(const char *key);\n-extern void git_config_clear(void);\n-extern void git_config_iter(config_fn_t fn, void *data);\n-extern int git_config_get_string_const(const char *key, const char **dest);\n-extern int git_config_get_string(const char *key, char **dest);\n-extern int git_config_get_int(const char *key, int *dest);\n-extern int git_config_get_ulong(const char *key, unsigned long *dest);\n-extern int git_config_get_bool(const char *key, int *dest);\n-extern int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest);\n-extern int git_config_get_maybe_bool(const char *key, int *dest);\n-extern int git_config_get_pathname(const char *key, const char **dest);\n-extern int git_config_get_untracked_cache(void);\n-extern int git_config_get_split_index(void);\n-extern int git_config_get_max_percent_split_change(void);\n-\n-/* This dies if the configured or default date is in the future */\n-extern int git_config_get_expiry(const char *key, const char **output);\n-\n /*\n  * This is a hack for test programs like test-dump-untracked-cache to\n  * ensure that they do not modify the untracked cache when reading it.\n@@ -2061,16 +1883,6 @@ extern int git_config_get_expiry(const char *key, const char **output);\n  */\n extern int ignore_untracked_cache_config;\n \n-struct key_value_info {\n-\tconst char *filename;\n-\tint linenr;\n-\tenum config_origin_type origin_type;\n-\tenum config_scope scope;\n-};\n-\n-extern NORETURN void git_die_config(const char *key, const char *err, ...) __attribute__((format(printf, 2, 3)));\n-extern NORETURN void git_die_config_linenr(const char *key, const char *filename, int linenr);\n-\n extern int committer_ident_sufficiently_given(void);\n extern int author_ident_sufficiently_given(void);\n \ndiff --git a/config.h b/config.h\nnew file mode 100644\nindex 000000000..f7f8b66c5\n--- /dev/null\n+++ b/config.h\n@@ -0,0 +1,194 @@\n+#ifndef CONFIG_H\n+#define CONFIG_H\n+\n+/* git_config_parse_key() returns these negated: */\n+#define CONFIG_INVALID_KEY 1\n+#define CONFIG_NO_SECTION_OR_NAME 2\n+/* git_config_set_gently(), git_config_set_multivar_gently() return the above or these: */\n+#define CONFIG_NO_LOCK -1\n+#define CONFIG_INVALID_FILE 3\n+#define CONFIG_NO_WRITE 4\n+#define CONFIG_NOTHING_SET 5\n+#define CONFIG_INVALID_PATTERN 6\n+#define CONFIG_GENERIC_ERROR 7\n+\n+#define CONFIG_REGEX_NONE ((void *)1)\n+\n+struct git_config_source {\n+\tunsigned int use_stdin:1;\n+\tconst char *file;\n+\tconst char *blob;\n+};\n+\n+enum config_origin_type {\n+\tCONFIG_ORIGIN_BLOB,\n+\tCONFIG_ORIGIN_FILE,\n+\tCONFIG_ORIGIN_STDIN,\n+\tCONFIG_ORIGIN_SUBMODULE_BLOB,\n+\tCONFIG_ORIGIN_CMDLINE\n+};\n+\n+struct config_options {\n+\tunsigned int respect_includes : 1;\n+\tconst char *git_dir;\n+};\n+\n+typedef int (*config_fn_t)(const char *, const char *, void *);\n+extern int git_default_config(const char *, const char *, void *);\n+extern int git_config_from_file(config_fn_t fn, const char *, void *);\n+extern int git_config_from_mem(config_fn_t fn, const enum config_origin_type,\n+\t\t\t\t\tconst char *name, const char *buf, size_t len, void *data);\n+extern int git_config_from_blob_sha1(config_fn_t fn, const char *name,\n+\t\t\t\t     const unsigned char *sha1, void *data);\n+extern void git_config_push_parameter(const char *text);\n+extern int git_config_from_parameters(config_fn_t fn, void *data);\n+extern void read_early_config(config_fn_t cb, void *data);\n+extern void git_config(config_fn_t fn, void *);\n+extern int git_config_with_options(config_fn_t fn, void *,\n+\t\t\t\t   struct git_config_source *config_source,\n+\t\t\t\t   const struct config_options *opts);\n+extern int git_parse_ulong(const char *, unsigned long *);\n+extern int git_parse_maybe_bool(const char *);\n+extern int git_config_int(const char *, const char *);\n+extern int64_t git_config_int64(const char *, const char *);\n+extern unsigned long git_config_ulong(const char *, const char *);\n+extern ssize_t git_config_ssize_t(const char *, const char *);\n+extern int git_config_bool_or_int(const char *, const char *, int *);\n+extern int git_config_bool(const char *, const char *);\n+extern int git_config_maybe_bool(const char *, const char *);\n+extern int git_config_string(const char **, const char *, const char *);\n+extern int git_config_pathname(const char **, const char *, const char *);\n+extern int git_config_set_in_file_gently(const char *, const char *, const char *);\n+extern void git_config_set_in_file(const char *, const char *, const char *);\n+extern int git_config_set_gently(const char *, const char *);\n+extern void git_config_set(const char *, const char *);\n+extern int git_config_parse_key(const char *, char **, int *);\n+extern int git_config_key_is_valid(const char *key);\n+extern int git_config_set_multivar_gently(const char *, const char *, const char *, int);\n+extern void git_config_set_multivar(const char *, const char *, const char *, int);\n+extern int git_config_set_multivar_in_file_gently(const char *, const char *, const char *, const char *, int);\n+extern void git_config_set_multivar_in_file(const char *, const char *, const char *, const char *, int);\n+extern int git_config_rename_section(const char *, const char *);\n+extern int git_config_rename_section_in_file(const char *, const char *, const char *);\n+extern const char *git_etc_gitconfig(void);\n+extern int git_env_bool(const char *, int);\n+extern unsigned long git_env_ulong(const char *, unsigned long);\n+extern int git_config_system(void);\n+extern int config_error_nonbool(const char *);\n+#if defined(__GNUC__)\n+#define config_error_nonbool(s) (config_error_nonbool(s), const_error())\n+#endif\n+\n+extern int git_config_parse_parameter(const char *, config_fn_t fn, void *data);\n+\n+enum config_scope {\n+\tCONFIG_SCOPE_UNKNOWN = 0,\n+\tCONFIG_SCOPE_SYSTEM,\n+\tCONFIG_SCOPE_GLOBAL,\n+\tCONFIG_SCOPE_REPO,\n+\tCONFIG_SCOPE_CMDLINE,\n+};\n+\n+extern enum config_scope current_config_scope(void);\n+extern const char *current_config_origin_type(void);\n+extern const char *current_config_name(void);\n+\n+struct config_include_data {\n+\tint depth;\n+\tconfig_fn_t fn;\n+\tvoid *data;\n+\tconst struct config_options *opts;\n+};\n+#define CONFIG_INCLUDE_INIT { 0 }\n+extern int git_config_include(const char *name, const char *value, void *data);\n+\n+/*\n+ * Match and parse a config key of the form:\n+ *\n+ *   section.(subsection.)?key\n+ *\n+ * (i.e., what gets handed to a config_fn_t). The caller provides the section;\n+ * we return -1 if it does not match, 0 otherwise. The subsection and key\n+ * out-parameters are filled by the function (and *subsection is NULL if it is\n+ * missing).\n+ *\n+ * If the subsection pointer-to-pointer passed in is NULL, returns 0 only if\n+ * there is no subsection at all.\n+ */\n+extern int parse_config_key(const char *var,\n+\t\t\t    const char *section,\n+\t\t\t    const char **subsection, int *subsection_len,\n+\t\t\t    const char **key);\n+\n+struct config_set_element {\n+\tstruct hashmap_entry ent;\n+\tchar *key;\n+\tstruct string_list value_list;\n+};\n+\n+struct configset_list_item {\n+\tstruct config_set_element *e;\n+\tint value_index;\n+};\n+\n+/*\n+ * the contents of the list are ordered according to their\n+ * position in the config files and order of parsing the files.\n+ * (i.e. key-value pair at the last position of .git/config will\n+ * be at the last item of the list)\n+ */\n+struct configset_list {\n+\tstruct configset_list_item *items;\n+\tunsigned int nr, alloc;\n+};\n+\n+struct config_set {\n+\tstruct hashmap config_hash;\n+\tint hash_initialized;\n+\tstruct configset_list list;\n+};\n+\n+extern void git_configset_init(struct config_set *cs);\n+extern int git_configset_add_file(struct config_set *cs, const char *filename);\n+extern int git_configset_get_value(struct config_set *cs, const char *key, const char **value);\n+extern const struct string_list *git_configset_get_value_multi(struct config_set *cs, const char *key);\n+extern void git_configset_clear(struct config_set *cs);\n+extern int git_configset_get_string_const(struct config_set *cs, const char *key, const char **dest);\n+extern int git_configset_get_string(struct config_set *cs, const char *key, char **dest);\n+extern int git_configset_get_int(struct config_set *cs, const char *key, int *dest);\n+extern int git_configset_get_ulong(struct config_set *cs, const char *key, unsigned long *dest);\n+extern int git_configset_get_bool(struct config_set *cs, const char *key, int *dest);\n+extern int git_configset_get_bool_or_int(struct config_set *cs, const char *key, int *is_bool, int *dest);\n+extern int git_configset_get_maybe_bool(struct config_set *cs, const char *key, int *dest);\n+extern int git_configset_get_pathname(struct config_set *cs, const char *key, const char **dest);\n+\n+extern int git_config_get_value(const char *key, const char **value);\n+extern const struct string_list *git_config_get_value_multi(const char *key);\n+extern void git_config_clear(void);\n+extern void git_config_iter(config_fn_t fn, void *data);\n+extern int git_config_get_string_const(const char *key, const char **dest);\n+extern int git_config_get_string(const char *key, char **dest);\n+extern int git_config_get_int(const char *key, int *dest);\n+extern int git_config_get_ulong(const char *key, unsigned long *dest);\n+extern int git_config_get_bool(const char *key, int *dest);\n+extern int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest);\n+extern int git_config_get_maybe_bool(const char *key, int *dest);\n+extern int git_config_get_pathname(const char *key, const char **dest);\n+extern int git_config_get_untracked_cache(void);\n+extern int git_config_get_split_index(void);\n+extern int git_config_get_max_percent_split_change(void);\n+\n+/* This dies if the configured or default date is in the future */\n+extern int git_config_get_expiry(const char *key, const char **output);\n+\n+struct key_value_info {\n+\tconst char *filename;\n+\tint linenr;\n+\tenum config_origin_type origin_type;\n+\tenum config_scope scope;\n+};\n+\n+extern NORETURN void git_die_config(const char *key, const char *err, ...) __attribute__((format(printf, 2, 3)));\n+extern NORETURN void git_die_config_linenr(const char *key, const char *filename, int linenr);\n+\n+#endif /* CONFIG_H */\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322273","messageId":"20170614180739.72193-3-bmwill@google.com","threadId":"46161","inReplyTo":"20170614180739.72193-1-bmwill@google.com","subject":"[PATCH v3 2/6] config: remove git_config_iter","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-14T18:07:35Z","receivedAt":"2017-06-14T18:07:54Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Since there is no implementation of the function 'git_config_iter',\nlet's stop exporting it and remove the prototype from config.h.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n config.h | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/config.h b/config.h\nindex f7f8b66c5..c70599bd5 100644\n--- a/config.h\n+++ b/config.h\n@@ -165,7 +165,6 @@ extern int git_configset_get_pathname(struct config_set *cs, const char *key, co\n extern int git_config_get_value(const char *key, const char **value);\n extern const struct string_list *git_config_get_value_multi(const char *key);\n extern void git_config_clear(void);\n-extern void git_config_iter(config_fn_t fn, void *data);\n extern int git_config_get_string_const(const char *key, const char **dest);\n extern int git_config_get_string(const char *key, char **dest);\n extern int git_config_get_int(const char *key, int *dest);\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322274","messageId":"20170614180739.72193-5-bmwill@google.com","threadId":"46161","inReplyTo":"20170614180739.72193-1-bmwill@google.com","subject":"[PATCH v3 4/6] setup: teach discover_git_directory to respect the commondir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-14T18:07:37Z","receivedAt":"2017-06-14T18:08:00Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Currently 'discover_git_directory' only looks at the gitdir to determine\nif a git directory was discovered.  This causes a problem in the event\nthat the gitdir which was discovered was in fact a per-worktree git\ndirectory and not the common git directory.  This is because the\nrepository config, which is checked to verify the repository's format,\nis stored in the commondir and not in the per-worktree gitdir.  Correct\nthis behavior by checking the config stored in the commondir.\n\nIt will also be of use for callers to have access to the commondir, so\nlets also return that upon successfully discovering a git directory.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n cache.h  | 15 +++++++++------\n config.c | 10 ++++++----\n setup.c  | 17 +++++++++++------\n 3 files changed, 26 insertions(+), 16 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex fd45b8c55..8fb2dfd27 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -525,12 +525,15 @@ extern void set_git_work_tree(const char *tree);\n \n extern void setup_work_tree(void);\n /*\n- * Find GIT_DIR of the repository that contains the current working directory,\n- * without changing the working directory or other global state. The result is\n- * appended to gitdir. The return value is either NULL if no repository was\n- * found, or pointing to the path inside gitdir's buffer.\n- */\n-extern const char *discover_git_directory(struct strbuf *gitdir);\n+ * Find the commondir and gitdir of the repository that contains the current\n+ * working directory, without changing the working directory or other global\n+ * state. The result is appended to commondir and gitdir.  If the discovered\n+ * gitdir does not correspond to a worktree, then 'commondir' and 'gitdir' will\n+ * both have the same result appended to the buffer.  The return value is\n+ * either 0 upon success and non-zero if no repository was found.\n+ */\n+extern int discover_git_directory(struct strbuf *commondir,\n+\t\t\t\t  struct strbuf *gitdir);\n extern const char *setup_git_directory_gently(int *);\n extern const char *setup_git_directory(void);\n extern char *prefix_path(const char *prefix, int len, const char *path);\ndiff --git a/config.c b/config.c\nindex 990f15dc4..e82e1d987 100644\n--- a/config.c\n+++ b/config.c\n@@ -1655,7 +1655,8 @@ static void configset_iter(struct config_set *cs, config_fn_t fn, void *data)\n void read_early_config(config_fn_t cb, void *data)\n {\n \tstruct config_options opts = {0};\n-\tstruct strbuf buf = STRBUF_INIT;\n+\tstruct strbuf commondir = STRBUF_INIT;\n+\tstruct strbuf gitdir = STRBUF_INIT;\n \n \topts.respect_includes = 1;\n \n@@ -1669,12 +1670,13 @@ void read_early_config(config_fn_t cb, void *data)\n \t * notably, the current working directory is still the same after the\n \t * call).\n \t */\n-\telse if (discover_git_directory(&buf))\n-\t\topts.git_dir = buf.buf;\n+\telse if (!discover_git_directory(&commondir, &gitdir))\n+\t\topts.git_dir = gitdir.buf;\n \n \tgit_config_with_options(cb, data, NULL, &opts);\n \n-\tstrbuf_release(&buf);\n+\tstrbuf_release(&commondir);\n+\tstrbuf_release(&gitdir);\n }\n \n static void git_config_check_init(void);\ndiff --git a/setup.c b/setup.c\nindex c6c00463a..c26f1e0a3 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -946,19 +946,21 @@ static enum discovery_result setup_git_directory_gently_1(struct strbuf *dir,\n \t}\n }\n \n-const char *discover_git_directory(struct strbuf *gitdir)\n+int discover_git_directory(struct strbuf *commondir,\n+\t\t\t   struct strbuf *gitdir)\n {\n \tstruct strbuf dir = STRBUF_INIT, err = STRBUF_INIT;\n \tsize_t gitdir_offset = gitdir->len, cwd_len;\n+\tsize_t commondir_offset = commondir->len;\n \tstruct repository_format candidate;\n \n \tif (strbuf_getcwd(&dir))\n-\t\treturn NULL;\n+\t\treturn -1;\n \n \tcwd_len = dir.len;\n \tif (setup_git_directory_gently_1(&dir, gitdir, 0) <= 0) {\n \t\tstrbuf_release(&dir);\n-\t\treturn NULL;\n+\t\treturn -1;\n \t}\n \n \t/*\n@@ -974,8 +976,10 @@ const char *discover_git_directory(struct strbuf *gitdir)\n \t\tstrbuf_insert(gitdir, gitdir_offset, dir.buf, dir.len);\n \t}\n \n+\tget_common_dir(commondir, gitdir->buf + gitdir_offset);\n+\n \tstrbuf_reset(&dir);\n-\tstrbuf_addf(&dir, \"%s/config\", gitdir->buf + gitdir_offset);\n+\tstrbuf_addf(&dir, \"%s/config\", commondir->buf + commondir_offset);\n \tread_repository_format(&candidate, dir.buf);\n \tstrbuf_release(&dir);\n \n@@ -983,11 +987,12 @@ const char *discover_git_directory(struct strbuf *gitdir)\n \t\twarning(\"ignoring git dir '%s': %s\",\n \t\t\tgitdir->buf + gitdir_offset, err.buf);\n \t\tstrbuf_release(&err);\n+\t\tstrbuf_setlen(commondir, commondir_offset);\n \t\tstrbuf_setlen(gitdir, gitdir_offset);\n-\t\treturn NULL;\n+\t\treturn -1;\n \t}\n \n-\treturn gitdir->buf + gitdir_offset;\n+\treturn 0;\n }\n \n const char *setup_git_directory_gently(int *nongit_ok)\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322275","messageId":"20170614180739.72193-4-bmwill@google.com","threadId":"46161","inReplyTo":"20170614180739.72193-1-bmwill@google.com","subject":"[PATCH v3 3/6] config: don't include config.h by default","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-14T18:07:36Z","receivedAt":"2017-06-14T18:08:03Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Stop including config.h by default in cache.h.  Instead only include\nconfig.h in those files which require use of the config system.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n advice.c                         | 1 +\n alias.c                          | 1 +\n apply.c                          | 1 +\n archive-tar.c                    | 1 +\n archive-zip.c                    | 1 +\n archive.c                        | 1 +\n attr.c                           | 1 +\n bisect.c                         | 1 +\n branch.c                         | 1 +\n builtin/add.c                    | 1 +\n builtin/am.c                     | 1 +\n builtin/blame.c                  | 2 ++\n builtin/branch.c                 | 1 +\n builtin/cat-file.c               | 1 +\n builtin/check-attr.c             | 1 +\n builtin/check-ignore.c           | 1 +\n builtin/check-mailmap.c          | 1 +\n builtin/checkout-index.c         | 1 +\n builtin/checkout.c               | 1 +\n builtin/clean.c                  | 1 +\n builtin/clone.c                  | 1 +\n builtin/column.c                 | 1 +\n builtin/commit-tree.c            | 1 +\n builtin/commit.c                 | 1 +\n builtin/config.c                 | 1 +\n builtin/count-objects.c          | 1 +\n builtin/describe.c               | 1 +\n builtin/diff-files.c             | 1 +\n builtin/diff-index.c             | 1 +\n builtin/diff-tree.c              | 1 +\n builtin/diff.c                   | 1 +\n builtin/difftool.c               | 1 +\n builtin/fast-export.c            | 1 +\n builtin/fetch.c                  | 1 +\n builtin/fmt-merge-msg.c          | 1 +\n builtin/for-each-ref.c           | 1 +\n builtin/fsck.c                   | 1 +\n builtin/gc.c                     | 1 +\n builtin/grep.c                   | 1 +\n builtin/hash-object.c            | 1 +\n builtin/help.c                   | 1 +\n builtin/index-pack.c             | 1 +\n builtin/init-db.c                | 1 +\n builtin/log.c                    | 1 +\n builtin/ls-files.c               | 1 +\n builtin/ls-tree.c                | 1 +\n builtin/merge-base.c             | 1 +\n builtin/merge-file.c             | 1 +\n builtin/merge.c                  | 1 +\n builtin/mv.c                     | 1 +\n builtin/name-rev.c               | 1 +\n builtin/notes.c                  | 1 +\n builtin/pack-objects.c           | 1 +\n builtin/patch-id.c               | 1 +\n builtin/pull.c                   | 1 +\n builtin/push.c                   | 1 +\n builtin/read-tree.c              | 1 +\n builtin/rebase--helper.c         | 1 +\n builtin/receive-pack.c           | 1 +\n builtin/reflog.c                 | 1 +\n builtin/remote.c                 | 1 +\n builtin/repack.c                 | 1 +\n builtin/replace.c                | 1 +\n builtin/rerere.c                 | 1 +\n builtin/reset.c                  | 1 +\n builtin/rev-list.c               | 1 +\n builtin/rev-parse.c              | 1 +\n builtin/revert.c                 | 1 +\n builtin/rm.c                     | 1 +\n builtin/send-pack.c              | 1 +\n builtin/shortlog.c               | 1 +\n builtin/show-branch.c            | 1 +\n builtin/stripspace.c             | 1 +\n builtin/submodule--helper.c      | 1 +\n builtin/symbolic-ref.c           | 1 +\n builtin/tag.c                    | 1 +\n builtin/unpack-file.c            | 1 +\n builtin/unpack-objects.c         | 1 +\n builtin/update-index.c           | 1 +\n builtin/update-ref.c             | 1 +\n builtin/update-server-info.c     | 1 +\n builtin/var.c                    | 1 +\n builtin/verify-commit.c          | 1 +\n builtin/verify-pack.c            | 1 +\n builtin/verify-tag.c             | 1 +\n builtin/worktree.c               | 1 +\n builtin/write-tree.c             | 1 +\n cache.h                          | 1 -\n color.c                          | 1 +\n column.c                         | 1 +\n compat/precompose_utf8.c         | 1 +\n config.c                         | 1 +\n connect.c                        | 1 +\n convert.c                        | 1 +\n credential-cache--daemon.c       | 1 +\n credential.c                     | 1 +\n daemon.c                         | 1 +\n diff.c                           | 1 +\n dir.c                            | 1 +\n environment.c                    | 1 +\n fast-import.c                    | 1 +\n fetch-pack.c                     | 1 +\n git.c                            | 1 +\n gpg-interface.c                  | 1 +\n graph.c                          | 1 +\n grep.c                           | 1 +\n help.c                           | 1 +\n http-backend.c                   | 1 +\n http-fetch.c                     | 1 +\n http.c                           | 1 +\n ident.c                          | 1 +\n imap-send.c                      | 1 +\n ll-merge.c                       | 1 +\n log-tree.c                       | 1 +\n mailinfo.c                       | 1 +\n merge-recursive.c                | 1 +\n notes-utils.c                    | 1 +\n notes.c                          | 1 +\n pager.c                          | 1 +\n parse-options.c                  | 1 +\n pathspec.c                       | 1 +\n pretty.c                         | 1 +\n prompt.c                         | 1 +\n read-cache.c                     | 1 +\n refs.c                           | 1 +\n refs/files-backend.c             | 1 +\n remote-curl.c                    | 1 +\n remote.c                         | 1 +\n rerere.c                         | 1 +\n send-pack.c                      | 1 +\n sequencer.c                      | 1 +\n setup.c                          | 1 +\n sha1_file.c                      | 1 +\n sha1_name.c                      | 1 +\n submodule-config.c               | 1 +\n submodule.c                      | 1 +\n t/helper/test-config.c           | 1 +\n t/helper/test-submodule-config.c | 1 +\n trailer.c                        | 1 +\n transport.c                      | 1 +\n unpack-trees.c                   | 1 +\n upload-pack.c                    | 1 +\n userdiff.c                       | 1 +\n versioncmp.c                     | 1 +\n wrapper.c                        | 1 +\n xdiff-interface.c                | 1 +\n 146 files changed, 146 insertions(+), 1 deletion(-)\n\ndiff --git a/advice.c b/advice.c\nindex b84ae4960..3fa04fca0 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n \n int advice_push_update_rejected = 1;\n int advice_push_non_ff_current = 1;\ndiff --git a/alias.c b/alias.c\nindex 5df052ae4..f7bc0f72b 100644\n--- a/alias.c\n+++ b/alias.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n \n struct config_alias_data\n {\ndiff --git a/apply.c b/apply.c\nindex c49cef063..87db9618d 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -8,6 +8,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"blob.h\"\n #include \"delta.h\"\n #include \"diff.h\"\ndiff --git a/archive-tar.c b/archive-tar.c\nindex 073e60ebd..c6ed96ee7 100644\n--- a/archive-tar.c\n+++ b/archive-tar.c\n@@ -2,6 +2,7 @@\n  * Copyright (c) 2005, 2006 Rene Scharfe\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tar.h\"\n #include \"archive.h\"\n #include \"streaming.h\"\ndiff --git a/archive-zip.c b/archive-zip.c\nindex 27563e9e2..e8913e5a2 100644\n--- a/archive-zip.c\n+++ b/archive-zip.c\n@@ -2,6 +2,7 @@\n  * Copyright (c) 2006 Rene Scharfe\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"archive.h\"\n #include \"streaming.h\"\n #include \"utf8.h\"\ndiff --git a/archive.c b/archive.c\nindex b15a922da..60b3035a7 100644\n--- a/archive.c\n+++ b/archive.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"tree-walk.h\"\ndiff --git a/attr.c b/attr.c\nindex 7e2134471..9f8b02936 100644\n--- a/attr.c\n+++ b/attr.c\n@@ -9,6 +9,7 @@\n \n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"exec_cmd.h\"\n #include \"attr.h\"\n #include \"dir.h\"\ndiff --git a/bisect.c b/bisect.c\nindex c952df692..d8587d11c 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"revision.h\"\ndiff --git a/branch.c b/branch.c\nindex 985316eb7..a8a548ccf 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"branch.h\"\n #include \"refs.h\"\n #include \"remote.h\"\ndiff --git a/builtin/add.c b/builtin/add.c\nindex d9a2491e4..f2415e99f 100644\n--- a/builtin/add.c\n+++ b/builtin/add.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) 2006 Linus Torvalds\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\ndiff --git a/builtin/am.c b/builtin/am.c\nindex 5ee146bfb..242d70361 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -4,6 +4,7 @@\n  * Based on git-am.sh by Junio C Hamano.\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex d7a2df3b4..381927920 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -6,6 +6,8 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n+#include \"refs.h\"\n #include \"builtin.h\"\n #include \"commit.h\"\n #include \"diff.h\"\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 83fcda43d..c958e9325 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -6,6 +6,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"color.h\"\n #include \"refs.h\"\n #include \"commit.h\"\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex 4bffd7a2d..7efbc4019 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"diff.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/check-attr.c b/builtin/check-attr.c\nindex 4d01ca0c8..91444dc04 100644\n--- a/builtin/check-attr.c\n+++ b/builtin/check-attr.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"attr.h\"\n #include \"quote.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/check-ignore.c b/builtin/check-ignore.c\nindex c7b8c0889..3e280b9c7 100644\n--- a/builtin/check-ignore.c\n+++ b/builtin/check-ignore.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"quote.h\"\n #include \"pathspec.h\"\ndiff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c\nindex cf0f54f6b..cdce144f3 100644\n--- a/builtin/check-mailmap.c\n+++ b/builtin/check-mailmap.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"mailmap.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/checkout-index.c b/builtin/checkout-index.c\nindex 07631d0c9..39c8be05d 100644\n--- a/builtin/checkout-index.c\n+++ b/builtin/checkout-index.c\n@@ -5,6 +5,7 @@\n  *\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex a6b2af39d..45fab5a4d 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\n #include \"refs.h\"\ndiff --git a/builtin/clean.c b/builtin/clean.c\nindex 142bf668c..ed954134d 100644\n--- a/builtin/clean.c\n+++ b/builtin/clean.c\n@@ -8,6 +8,7 @@\n \n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 743f16ae2..4922a5496 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -9,6 +9,7 @@\n  */\n \n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\n #include \"fetch-pack.h\"\ndiff --git a/builtin/column.c b/builtin/column.c\nindex 33314b4d7..0c3223d64 100644\n--- a/builtin/column.c\n+++ b/builtin/column.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"strbuf.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/commit-tree.c b/builtin/commit-tree.c\nindex f39c2b273..a4a923d7c 100644\n--- a/builtin/commit-tree.c\n+++ b/builtin/commit-tree.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"tree.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex da1ba4c86..805da4915 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -6,6 +6,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"cache-tree.h\"\n #include \"color.h\"\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 7f6c25d4d..753c40a5c 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"color.h\"\n #include \"parse-options.h\"\n #include \"urlmatch.h\"\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex acb05940f..1d82e61f2 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -5,6 +5,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/describe.c b/builtin/describe.c\nindex 893c8789f..70eb14460 100644\n--- a/builtin/describe.c\n+++ b/builtin/describe.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"commit.h\"\n #include \"tag.h\"\ndiff --git a/builtin/diff-files.c b/builtin/diff-files.c\nindex a572da9d5..965f2fb76 100644\n--- a/builtin/diff-files.c\n+++ b/builtin/diff-files.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"revision.h\"\ndiff --git a/builtin/diff-index.c b/builtin/diff-index.c\nindex f084826a2..ad9971f64 100644\n--- a/builtin/diff-index.c\n+++ b/builtin/diff-index.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"revision.h\"\ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex e40111204..36c220f93 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"log-tree.h\"\ndiff --git a/builtin/diff.c b/builtin/diff.c\nindex 0c8f86e40..0d59e99ef 100644\n--- a/builtin/diff.c\n+++ b/builtin/diff.c\n@@ -4,6 +4,7 @@\n  * Copyright (c) 2006 Junio C Hamano\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"color.h\"\n #include \"commit.h\"\ndiff --git a/builtin/difftool.c b/builtin/difftool.c\nindex b9a892f26..9199227f6 100644\n--- a/builtin/difftool.c\n+++ b/builtin/difftool.c\n@@ -12,6 +12,7 @@\n  * Copyright (C) 2016 Johannes Schindelin\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"run-command.h\"\n #include \"exec_cmd.h\"\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex 24e29ad7e..0dfd980dd 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -5,6 +5,7 @@\n  */\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"object.h\"\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex 47708451b..65317bd6c 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -2,6 +2,7 @@\n  * \"git fetch\"\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c\nindex 70137b0b7..10cbb4341 100644\n--- a/builtin/fmt-merge-msg.c\n+++ b/builtin/fmt-merge-msg.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n #include \"diff.h\"\ndiff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c\nindex eca365bf8..52be99cba 100644\n--- a/builtin/for-each-ref.c\n+++ b/builtin/for-each-ref.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"object.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex cb2ba6cd1..90593491e 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"tree.h\"\n #include \"blob.h\"\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex f484eda43..bd91f136f 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -11,6 +11,7 @@\n  */\n \n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"tempfile.h\"\n #include \"lockfile.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 7df9c253e..7f720ca6c 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -4,6 +4,7 @@\n  * Copyright (c) 2006 Junio C Hamano\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"blob.h\"\n #include \"tree.h\"\n #include \"commit.h\"\ndiff --git a/builtin/hash-object.c b/builtin/hash-object.c\nindex bbeaf20bc..d04baf999 100644\n--- a/builtin/hash-object.c\n+++ b/builtin/hash-object.c\n@@ -5,6 +5,7 @@\n  * Copyright (C) Junio C Hamano, 2005\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"blob.h\"\n #include \"quote.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 49f7a07f8..334a8494a 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -2,6 +2,7 @@\n  * Builtin help command\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex 04b9dcaf0..edc1a91d8 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"delta.h\"\n #include \"pack.h\"\n #include \"csum-file.h\"\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex 8a6acb0ec..47823f9aa 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\ndiff --git a/builtin/log.c b/builtin/log.c\nindex e89ec941c..01d7213c1 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -5,6 +5,7 @@\n  *\t\t 2006 Junio Hamano\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"color.h\"\n #include \"commit.h\"\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex b376afc31..c4357dc30 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -6,6 +6,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"quote.h\"\n #include \"dir.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex ee7b293b1..ef965408e 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"blob.h\"\n #include \"tree.h\"\n #include \"commit.h\"\ndiff --git a/builtin/merge-base.c b/builtin/merge-base.c\nindex 0c36a70ad..6dbd167d3 100644\n--- a/builtin/merge-base.c\n+++ b/builtin/merge-base.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"diff.h\"\ndiff --git a/builtin/merge-file.c b/builtin/merge-file.c\nindex 47dde7c39..b08803e61 100644\n--- a/builtin/merge-file.c\n+++ b/builtin/merge-file.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"xdiff/xdiff.h\"\n #include \"xdiff-interface.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex a4a098f40..2512370c1 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -7,6 +7,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"builtin.h\"\n #include \"lockfile.h\"\ndiff --git a/builtin/mv.c b/builtin/mv.c\nindex 61d20037a..dcf6736b5 100644\n--- a/builtin/mv.c\n+++ b/builtin/mv.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) 2006 Johannes Schindelin\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"pathspec.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\ndiff --git a/builtin/name-rev.c b/builtin/name-rev.c\nindex 7fc7e66e8..e21715f1d 100644\n--- a/builtin/name-rev.c\n+++ b/builtin/name-rev.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"tag.h\"\n #include \"refs.h\"\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 7196bff0e..8d14f434a 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -8,6 +8,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"notes.h\"\n #include \"blob.h\"\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex f672225de..d5e96ed2d 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"attr.h\"\n #include \"object.h\"\n #include \"blob.h\"\ndiff --git a/builtin/patch-id.c b/builtin/patch-id.c\nindex 81552e02e..970d0d30b 100644\n--- a/builtin/patch-id.c\n+++ b/builtin/patch-id.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n \n static void flush_current_id(int patchlen, struct object_id *id, struct object_id *result)\n {\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex da8b60fc8..0c77381da 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -6,6 +6,7 @@\n  * Fetch one or more remote refs and merge it/them into the current HEAD.\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\n #include \"exec_cmd.h\"\ndiff --git a/builtin/push.c b/builtin/push.c\nindex a597759d8..76aa713d2 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -2,6 +2,7 @@\n  * \"git push\"\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"run-command.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/read-tree.c b/builtin/read-tree.c\nindex 78d319365..6eb2a0e57 100644\n--- a/builtin/read-tree.c\n+++ b/builtin/read-tree.c\n@@ -5,6 +5,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"object.h\"\n #include \"tree.h\"\ndiff --git a/builtin/rebase--helper.c b/builtin/rebase--helper.c\nindex ca1ebb2fa..c82b4dce6 100644\n--- a/builtin/rebase--helper.c\n+++ b/builtin/rebase--helper.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"sequencer.h\"\n \ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex b1706a573..71c0c768d 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"pack.h\"\n #include \"refs.h\"\ndiff --git a/builtin/reflog.c b/builtin/reflog.c\nindex 920c16dac..44cdc2dbd 100644\n--- a/builtin/reflog.c\n+++ b/builtin/reflog.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"commit.h\"\n #include \"refs.h\"\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex f1a88fe26..6273c0c23 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"transport.h\"\n #include \"remote.h\"\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 38ba4ef82..f17a68a17 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"parse-options.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex c921bc976..80a15cf35 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -9,6 +9,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"refs.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/rerere.c b/builtin/rerere.c\nindex 1bf72423b..ffb66e290 100644\n--- a/builtin/rerere.c\n+++ b/builtin/rerere.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"parse-options.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/reset.c b/builtin/reset.c\nindex 430602d10..d0b604103 100644\n--- a/builtin/reset.c\n+++ b/builtin/reset.c\n@@ -8,6 +8,7 @@\n  * Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"tag.h\"\n #include \"object.h\"\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 718c6059c..f8e2b7bf5 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"revision.h\"\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex efdc14473..c78b7b33d 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"quote.h\"\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex 345d9586a..16028b9ea 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\n #include \"diff.h\"\ndiff --git a/builtin/rm.c b/builtin/rm.c\nindex 7c323d012..824d1de9e 100644\n--- a/builtin/rm.c\n+++ b/builtin/rm.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds 2006\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"dir.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/send-pack.c b/builtin/send-pack.c\nindex b8e2e74fe..633e0c3cd 100644\n--- a/builtin/send-pack.c\n+++ b/builtin/send-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 7cff1839f..43c4799ea 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"diff.h\"\n #include \"string-list.h\"\ndiff --git a/builtin/show-branch.c b/builtin/show-branch.c\nindex 4a6cc6f49..e4cf1b5bb 100644\n--- a/builtin/show-branch.c\n+++ b/builtin/show-branch.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\ndiff --git a/builtin/stripspace.c b/builtin/stripspace.c\nindex 1e62a008c..bdf032886 100644\n--- a/builtin/stripspace.c\n+++ b/builtin/stripspace.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"strbuf.h\"\n \ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 8cc648d85..4dcbfb952 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"parse-options.h\"\n #include \"quote.h\"\n #include \"pathspec.h\"\ndiff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c\nindex 70addef15..df75cb9d4 100644\n--- a/builtin/symbolic-ref.c\n+++ b/builtin/symbolic-ref.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"cache.h\"\n #include \"refs.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 1f74a56db..01154ea8d 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -7,6 +7,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"refs.h\"\n #include \"tag.h\"\ndiff --git a/builtin/unpack-file.c b/builtin/unpack-file.c\nindex 6fc6bcdf7..73f133419 100644\n--- a/builtin/unpack-file.c\n+++ b/builtin/unpack-file.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n \n static char *create_temp_file(unsigned char *sha1)\n {\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex 8bc999776..193f8b9d5 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"object.h\"\n #include \"delta.h\"\n #include \"pack.h\"\ndiff --git a/builtin/update-index.c b/builtin/update-index.c\nindex ebfc09faa..0a4c23648 100644\n--- a/builtin/update-index.c\n+++ b/builtin/update-index.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Linus Torvalds, 2005\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"quote.h\"\n #include \"cache-tree.h\"\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex 0b2ecf41a..40ccfc193 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/update-server-info.c b/builtin/update-server-info.c\nindex 6c8cc3edc..873070e51 100644\n--- a/builtin/update-server-info.c\n+++ b/builtin/update-server-info.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/var.c b/builtin/var.c\nindex aedbb53a2..6c6f46b4a 100644\n--- a/builtin/var.c\n+++ b/builtin/var.c\n@@ -4,6 +4,7 @@\n  * Copyright (C) Eric Biederman, 2005\n  */\n #include \"builtin.h\"\n+#include \"config.h\"\n \n static const char var_usage[] = \"git var (-l | <variable>)\";\n \ndiff --git a/builtin/verify-commit.c b/builtin/verify-commit.c\nindex 05b734e6d..ba38ac9b1 100644\n--- a/builtin/verify-commit.c\n+++ b/builtin/verify-commit.c\n@@ -6,6 +6,7 @@\n  * Based on git-verify-tag\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"commit.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/verify-pack.c b/builtin/verify-pack.c\nindex c94e15693..c2a1a5c50 100644\n--- a/builtin/verify-pack.c\n+++ b/builtin/verify-pack.c\n@@ -1,5 +1,6 @@\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"run-command.h\"\n #include \"parse-options.h\"\n \ndiff --git a/builtin/verify-tag.c b/builtin/verify-tag.c\nindex 5199553d9..f9a5f7535 100644\n--- a/builtin/verify-tag.c\n+++ b/builtin/verify-tag.c\n@@ -6,6 +6,7 @@\n  * Based on git-verify-tag.sh\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"tag.h\"\n #include \"run-command.h\"\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 793306ea5..0c5476ee9 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"dir.h\"\n #include \"parse-options.h\"\ndiff --git a/builtin/write-tree.c b/builtin/write-tree.c\nindex 084c0df78..bd0a78aa3 100644\n--- a/builtin/write-tree.c\n+++ b/builtin/write-tree.c\n@@ -5,6 +5,7 @@\n  */\n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tree.h\"\n #include \"cache-tree.h\"\n #include \"parse-options.h\"\ndiff --git a/cache.h b/cache.h\nindex ed56f8818..fd45b8c55 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -11,7 +11,6 @@\n #include \"string-list.h\"\n #include \"pack-revindex.h\"\n #include \"hash.h\"\n-#include \"config.h\"\n \n #ifndef platform_SHA_CTX\n /*\ndiff --git a/color.c b/color.c\nindex dee61557e..31b6207a0 100644\n--- a/color.c\n+++ b/color.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"color.h\"\n \n static int git_use_color_default = GIT_COLOR_AUTO;\ndiff --git a/column.c b/column.c\nindex d55ead18e..ff7bdab1a 100644\n--- a/column.c\n+++ b/column.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"column.h\"\n #include \"string-list.h\"\n #include \"parse-options.h\"\ndiff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c\nindex 4293b53b1..de61c15d3 100644\n--- a/compat/precompose_utf8.c\n+++ b/compat/precompose_utf8.c\n@@ -6,6 +6,7 @@\n #define PRECOMPOSE_UNICODE_C\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"utf8.h\"\n #include \"precompose_utf8.h\"\n \ndiff --git a/config.c b/config.c\nindex 12c172e29..990f15dc4 100644\n--- a/config.c\n+++ b/config.c\n@@ -6,6 +6,7 @@\n  *\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"exec_cmd.h\"\n #include \"strbuf.h\"\ndiff --git a/connect.c b/connect.c\nindex c72b1d115..e78d3f43d 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"pkt-line.h\"\n #include \"quote.h\"\n #include \"refs.h\"\ndiff --git a/convert.c b/convert.c\nindex f1e168bc3..5f4a4b1f5 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"attr.h\"\n #include \"run-command.h\"\n #include \"quote.h\"\ndiff --git a/credential-cache--daemon.c b/credential-cache--daemon.c\nindex f3814cc47..0d5c62509 100644\n--- a/credential-cache--daemon.c\n+++ b/credential-cache--daemon.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tempfile.h\"\n #include \"credential.h\"\n #include \"unix-socket.h\"\ndiff --git a/credential.c b/credential.c\nindex aa996669f..67a523353 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"credential.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\ndiff --git a/daemon.c b/daemon.c\nindex ac7181a48..30747075f 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"pkt-line.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\ndiff --git a/diff.c b/diff.c\nindex 5275c4b78..3458ec640 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2,6 +2,7 @@\n  * Copyright (C) 2005 Junio C Hamano\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tempfile.h\"\n #include \"quote.h\"\n #include \"diff.h\"\ndiff --git a/dir.c b/dir.c\nindex 9efcf1eab..d4e4258ea 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -9,6 +9,7 @@\n  */\n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"attr.h\"\n #include \"refs.h\"\ndiff --git a/environment.c b/environment.c\nindex aa478e71d..d40b21fb7 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -8,6 +8,7 @@\n  * are.\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"fmt-merge-msg.h\"\n #include \"commit.h\"\ndiff --git a/fast-import.c b/fast-import.c\nindex e69d21968..2881d4898 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -154,6 +154,7 @@ Format of STDIN stream:\n \n #include \"builtin.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"object.h\"\n #include \"blob.h\"\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex cd86865be..fbbc99c88 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\ndiff --git a/git.c b/git.c\nindex 58ef57029..c03de2c09 100644\n--- a/git.c\n+++ b/git.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"exec_cmd.h\"\n #include \"help.h\"\n #include \"run-command.h\"\ndiff --git a/gpg-interface.c b/gpg-interface.c\nindex e44cc27da..8ab32df45 100644\n--- a/gpg-interface.c\n+++ b/gpg-interface.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"gpg-interface.h\"\ndiff --git a/graph.c b/graph.c\nindex 8b9049dd2..e7e20650d 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"color.h\"\n #include \"graph.h\"\ndiff --git a/grep.c b/grep.c\nindex d03d424e5..62c7cf970 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"grep.h\"\n #include \"userdiff.h\"\n #include \"xdiff-interface.h\"\ndiff --git a/help.c b/help.c\nindex b44c55ec2..328ecd339 100644\n--- a/help.c\n+++ b/help.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"builtin.h\"\n #include \"exec_cmd.h\"\n #include \"run-command.h\"\ndiff --git a/http-backend.c b/http-backend.c\nindex ba5ff1aa2..519025d2c 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\n #include \"object.h\"\ndiff --git a/http-fetch.c b/http-fetch.c\nindex 3b556d661..8af380050 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"exec_cmd.h\"\n #include \"http.h\"\n #include \"walker.h\"\ndiff --git a/http.c b/http.c\nindex d2e11ec6f..013bb0cc6 100644\n--- a/http.c\n+++ b/http.c\n@@ -1,5 +1,6 @@\n #include \"git-compat-util.h\"\n #include \"http.h\"\n+#include \"config.h\"\n #include \"pack.h\"\n #include \"sideband.h\"\n #include \"run-command.h\"\ndiff --git a/ident.c b/ident.c\nindex bea871c8e..d41fc9119 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -6,6 +6,7 @@\n  * Copyright (C) 2005 Linus Torvalds\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n \n static struct strbuf git_default_name = STRBUF_INIT;\n static struct strbuf git_default_email = STRBUF_INIT;\ndiff --git a/imap-send.c b/imap-send.c\nindex 857591660..59e9b12d2 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -23,6 +23,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"credential.h\"\n #include \"exec_cmd.h\"\n #include \"run-command.h\"\ndiff --git a/ll-merge.c b/ll-merge.c\nindex ac0d4a5d7..24ff94e1d 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -5,6 +5,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"attr.h\"\n #include \"xdiff-interface.h\"\n #include \"run-command.h\"\ndiff --git a/log-tree.c b/log-tree.c\nindex a4ec11c2b..7e1dfd749 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"diff.h\"\n #include \"commit.h\"\n #include \"tag.h\"\ndiff --git a/mailinfo.c b/mailinfo.c\nindex f92cb9f72..f59162453 100644\n--- a/mailinfo.c\n+++ b/mailinfo.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"utf8.h\"\n #include \"strbuf.h\"\n #include \"mailinfo.h\"\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex ae5238d82..c2494f34f 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -4,6 +4,7 @@\n  * The thieves were Alex Riesen and Johannes Schindelin, in June/July 2006\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"advice.h\"\n #include \"lockfile.h\"\n #include \"cache-tree.h\"\ndiff --git a/notes-utils.c b/notes-utils.c\nindex 031503d7b..3f6cbdc47 100644\n--- a/notes-utils.c\n+++ b/notes-utils.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"notes-utils.h\"\ndiff --git a/notes.c b/notes.c\nindex 542563b28..dbcfef4d7 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"notes.h\"\n #include \"blob.h\"\n #include \"tree.h\"\ndiff --git a/pager.c b/pager.c\nindex c113d898a..4dd9e1b26 100644\n--- a/pager.c\n+++ b/pager.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"run-command.h\"\n #include \"sigchain.h\"\n \ndiff --git a/parse-options.c b/parse-options.c\nindex e5ad34a2c..0dd9fc6a0 100644\n--- a/parse-options.c\n+++ b/parse-options.c\n@@ -1,6 +1,7 @@\n #include \"git-compat-util.h\"\n #include \"parse-options.h\"\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"color.h\"\n #include \"utf8.h\"\ndiff --git a/pathspec.c b/pathspec.c\nindex 828405021..ecc5331c2 100644\n--- a/pathspec.c\n+++ b/pathspec.c\n@@ -1,5 +1,6 @@\n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"pathspec.h\"\n #include \"attr.h\"\ndiff --git a/pretty.c b/pretty.c\nindex 09701bd2f..9c9f81b5b 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"utf8.h\"\n #include \"diff.h\"\ndiff --git a/prompt.c b/prompt.c\nindex 75406390c..6d5885d00 100644\n--- a/prompt.c\n+++ b/prompt.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"run-command.h\"\n #include \"strbuf.h\"\n #include \"prompt.h\"\ndiff --git a/read-cache.c b/read-cache.c\nindex bc156a133..c8c766dab 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -5,6 +5,7 @@\n  */\n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tempfile.h\"\n #include \"lockfile.h\"\n #include \"cache-tree.h\"\ndiff --git a/refs.c b/refs.c\nindex f0685c925..84112c88e 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -3,6 +3,7 @@\n  */\n \n #include \"cache.h\"\n+#include \"config.h\"\n #include \"hashmap.h\"\n #include \"lockfile.h\"\n #include \"iterator.h\"\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex d8b3f7314..621a4086c 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -1,4 +1,5 @@\n #include \"../cache.h\"\n+#include \"../config.h\"\n #include \"../refs.h\"\n #include \"refs-internal.h\"\n #include \"ref-cache.h\"\ndiff --git a/remote-curl.c b/remote-curl.c\nindex ece45993d..0053b0954 100644\n--- a/remote-curl.c\n+++ b/remote-curl.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"remote.h\"\n #include \"strbuf.h\"\n #include \"walker.h\"\ndiff --git a/remote.c b/remote.c\nindex 3649d60cd..68d20f650 100644\n--- a/remote.c\n+++ b/remote.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"remote.h\"\n #include \"refs.h\"\n #include \"commit.h\"\ndiff --git a/rerere.c b/rerere.c\nindex 3bd55caf3..344d6aa81 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"string-list.h\"\n #include \"rerere.h\"\ndiff --git a/send-pack.c b/send-pack.c\nindex 78bb34ebe..ed3cee321 100644\n--- a/send-pack.c\n+++ b/send-pack.c\n@@ -1,4 +1,5 @@\n #include \"builtin.h\"\n+#include \"config.h\"\n #include \"commit.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\ndiff --git a/sequencer.c b/sequencer.c\nindex 924fb1d0c..86b0640d2 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"lockfile.h\"\n #include \"sequencer.h\"\n #include \"dir.h\"\ndiff --git a/setup.c b/setup.c\nindex 2435186e4..c6c00463a 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"string-list.h\"\n \ndiff --git a/sha1_file.c b/sha1_file.c\nindex 59a4ed2ed..44561e0b9 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -7,6 +7,7 @@\n  * creation etc.\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"string-list.h\"\n #include \"lockfile.h\"\n #include \"delta.h\"\ndiff --git a/sha1_name.c b/sha1_name.c\nindex e9ffe685d..2875771ff 100644\n--- a/sha1_name.c\n+++ b/sha1_name.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"tag.h\"\n #include \"commit.h\"\n #include \"tree.h\"\ndiff --git a/submodule-config.c b/submodule-config.c\nindex 4f58491dd..d8f8d5ea3 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n #include \"strbuf.h\"\ndiff --git a/submodule.c b/submodule.c\nindex bf5a93d16..95328de61 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n #include \"dir.h\"\ndiff --git a/t/helper/test-config.c b/t/helper/test-config.c\nindex 8e3ed6a76..1a7b8bd3d 100644\n--- a/t/helper/test-config.c\n+++ b/t/helper/test-config.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"string-list.h\"\n \n /*\ndiff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c\nindex 2f144d539..c6c57bba0 100644\n--- a/t/helper/test-submodule-config.c\n+++ b/t/helper/test-submodule-config.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"submodule-config.h\"\n #include \"submodule.h\"\n \ndiff --git a/trailer.c b/trailer.c\nindex 11f0b9fb4..751b56c00 100644\n--- a/trailer.c\n+++ b/trailer.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"string-list.h\"\n #include \"run-command.h\"\n #include \"commit.h\"\ndiff --git a/transport.c b/transport.c\nindex 9bfcf870f..b9995306f 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"transport.h\"\n #include \"run-command.h\"\n #include \"pkt-line.h\"\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex d38c37e38..dd535bc84 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -1,5 +1,6 @@\n #define NO_THE_INDEX_COMPATIBILITY_MACROS\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"dir.h\"\n #include \"tree.h\"\n #include \"tree-walk.h\"\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 5330c02c1..7efff2fbf 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"refs.h\"\n #include \"pkt-line.h\"\n #include \"sideband.h\"\ndiff --git a/userdiff.c b/userdiff.c\nindex 8b732e40b..2c1502f71 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"userdiff.h\"\n #include \"attr.h\"\n \ndiff --git a/versioncmp.c b/versioncmp.c\nindex 9f81dc106..069ee94a4 100644\n--- a/versioncmp.c\n+++ b/versioncmp.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"string-list.h\"\n \n /*\ndiff --git a/wrapper.c b/wrapper.c\nindex d83741770..487a9f753 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -2,6 +2,7 @@\n  * Various trivial helper wrappers around standard functions\n  */\n #include \"cache.h\"\n+#include \"config.h\"\n \n static void do_nothing(size_t size)\n {\ndiff --git a/xdiff-interface.c b/xdiff-interface.c\nindex 060038c2d..5ac07d734 100644\n--- a/xdiff-interface.c\n+++ b/xdiff-interface.c\n@@ -1,4 +1,5 @@\n #include \"cache.h\"\n+#include \"config.h\"\n #include \"xdiff-interface.h\"\n #include \"xdiff/xtypes.h\"\n #include \"xdiff/xdiffi.h\"\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322276","messageId":"20170614180739.72193-6-bmwill@google.com","threadId":"46161","inReplyTo":"20170614180739.72193-1-bmwill@google.com","subject":"[PATCH v3 5/6] config: respect commondir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-14T18:07:38Z","receivedAt":"2017-06-14T18:08:04Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"Worktrees present an interesting problem when it comes to the config.\nHistorically we could assume that the per-repository config lives at\n'gitdir/config', but since worktrees were introduced this isn't the case\nanymore.  There is currently no way to specify per-worktree\nconfiguration, and as such the repository config is shared with all\nworktrees and is located at 'commondir/config'.\n\nMany users of the config machinery correctly set\n'config_options.git_dir' with the repository's commondir, allowing the\nconfig to be properly loaded when operating in a worktree.  But other's,\nlike 'read_early_config()', set 'config_options.git_dir' with the\nrepository's gitdir which can be incorrect when using worktrees.\n\nTo fix this issue, and to make things less ambiguous, lets add a\n'commondir' field to the 'config_options' struct and have all callers\nproperly set both the 'git_dir' and 'commondir' fields so that the\nconfig machinery is able to properly find the repository's config.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n config.c | 11 +++++++----\n config.h |  1 +\n 2 files changed, 8 insertions(+), 4 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex e82e1d987..dd7ad5e1e 100644\n--- a/config.c\n+++ b/config.c\n@@ -1547,8 +1547,8 @@ static int do_git_config_sequence(const struct config_options *opts,\n \tchar *user_config = expand_user_path(\"~/.gitconfig\", 0);\n \tchar *repo_config;\n \n-\tif (opts->git_dir)\n-\t\trepo_config = mkpathdup(\"%s/config\", opts->git_dir);\n+\tif (opts->commondir)\n+\t\trepo_config = mkpathdup(\"%s/config\", opts->commondir);\n \telse if (have_git_dir())\n \t\trepo_config = git_pathdup(\"config\");\n \telse\n@@ -1660,7 +1660,8 @@ void read_early_config(config_fn_t cb, void *data)\n \n \topts.respect_includes = 1;\n \n-\tif (have_git_dir())\n+\tif (have_git_dir()) {\n+\t\topts.commondir = get_git_common_dir();\n \t\topts.git_dir = get_git_dir();\n \t/*\n \t * When setup_git_directory() was not yet asked to discover the\n@@ -1670,8 +1671,10 @@ void read_early_config(config_fn_t cb, void *data)\n \t * notably, the current working directory is still the same after the\n \t * call).\n \t */\n-\telse if (!discover_git_directory(&commondir, &gitdir))\n+\t} else if (!discover_git_directory(&commondir, &gitdir)) {\n+\t\topts.commondir = commondir.buf;\n \t\topts.git_dir = gitdir.buf;\n+\t}\n \n \tgit_config_with_options(cb, data, NULL, &opts);\n \ndiff --git a/config.h b/config.h\nindex c70599bd5..63b92784c 100644\n--- a/config.h\n+++ b/config.h\n@@ -30,6 +30,7 @@ enum config_origin_type {\n \n struct config_options {\n \tunsigned int respect_includes : 1;\n+\tconst char *commondir;\n \tconst char *git_dir;\n };\n \n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322277","messageId":"20170614180739.72193-7-bmwill@google.com","threadId":"46161","inReplyTo":"20170614180739.72193-1-bmwill@google.com","subject":"[PATCH v3 6/6] config: don't implicitly use gitdir or commondir","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-14T18:07:39Z","receivedAt":"2017-06-14T18:08:06Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"'git_config_with_options()' takes a 'config_options' struct which\ncontains feilds for 'git_dir' and 'commondir'.  If those feilds happen\nto be NULL the config machinery falls back to querying global repository\nstate.  Let's change this and instead use these fields in the\n'config_options' struct explicilty all the time.  Since the API is\nslightly changing to require these two fields to be set if callers want\nthe config machinery to load the repository's config, let's change the\nname to 'config_with_optison()'.  This allows the config machinery to\nnot implicitly rely on any global repository state.\n\nSigned-off-by: Brandon Williams <bmwill@google.com>\n---\n builtin/config.c | 26 +++++++++++++++-----------\n config.c         | 21 +++++++++++----------\n config.h         |  6 +++---\n 3 files changed, 29 insertions(+), 24 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex 753c40a5c..82db29fae 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -243,8 +243,8 @@ static int get_value(const char *key_, const char *regex_)\n \t\t}\n \t}\n \n-\tgit_config_with_options(collect_config, &values,\n-\t\t\t\t&given_config_source, &config_options);\n+\tconfig_with_options(collect_config, &values,\n+\t\t\t    &given_config_source, &config_options);\n \n \tret = !values.nr;\n \n@@ -321,8 +321,8 @@ static void get_color(const char *var, const char *def_color)\n \tget_color_slot = var;\n \tget_color_found = 0;\n \tparsed_color[0] = '\\0';\n-\tgit_config_with_options(git_get_color_config, NULL,\n-\t\t\t\t&given_config_source, &config_options);\n+\tconfig_with_options(git_get_color_config, NULL,\n+\t\t\t    &given_config_source, &config_options);\n \n \tif (!get_color_found && def_color) {\n \t\tif (color_parse(def_color, parsed_color) < 0)\n@@ -353,8 +353,8 @@ static int get_colorbool(const char *var, int print)\n \tget_colorbool_found = -1;\n \tget_diff_color_found = -1;\n \tget_color_ui_found = -1;\n-\tgit_config_with_options(git_get_colorbool_config, NULL,\n-\t\t\t\t&given_config_source, &config_options);\n+\tconfig_with_options(git_get_colorbool_config, NULL,\n+\t\t\t    &given_config_source, &config_options);\n \n \tif (get_colorbool_found < 0) {\n \t\tif (!strcmp(get_colorbool_slot, \"color.diff\"))\n@@ -442,8 +442,8 @@ static int get_urlmatch(const char *var, const char *url)\n \t\tshow_keys = 1;\n \t}\n \n-\tgit_config_with_options(urlmatch_config_entry, &config,\n-\t\t\t\t&given_config_source, &config_options);\n+\tconfig_with_options(urlmatch_config_entry, &config,\n+\t\t\t    &given_config_source, &config_options);\n \n \tret = !values.nr;\n \n@@ -539,6 +539,10 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\tconfig_options.respect_includes = !given_config_source.file;\n \telse\n \t\tconfig_options.respect_includes = respect_includes_opt;\n+\tif (!nongit) {\n+\t\tconfig_options.commondir = get_git_common_dir();\n+\t\tconfig_options.git_dir = get_git_dir();\n+\t}\n \n \tif (end_null) {\n \t\tterm = '\\0';\n@@ -583,9 +587,9 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \n \tif (actions == ACTION_LIST) {\n \t\tcheck_argc(argc, 0, 0);\n-\t\tif (git_config_with_options(show_all_config, NULL,\n-\t\t\t\t\t    &given_config_source,\n-\t\t\t\t\t    &config_options) < 0) {\n+\t\tif (config_with_options(show_all_config, NULL,\n+\t\t\t\t\t&given_config_source,\n+\t\t\t\t\t&config_options) < 0) {\n \t\t\tif (given_config_source.file)\n \t\t\t\tdie_errno(\"unable to read config file '%s'\",\n \t\t\t\t\t  given_config_source.file);\ndiff --git a/config.c b/config.c\nindex dd7ad5e1e..822d63787 100644\n--- a/config.c\n+++ b/config.c\n@@ -219,8 +219,6 @@ static int include_by_gitdir(const struct config_options *opts,\n \n \tif (opts->git_dir)\n \t\tgit_dir = opts->git_dir;\n-\telse if (have_git_dir())\n-\t\tgit_dir = get_git_dir();\n \telse\n \t\tgoto done;\n \n@@ -1549,8 +1547,6 @@ static int do_git_config_sequence(const struct config_options *opts,\n \n \tif (opts->commondir)\n \t\trepo_config = mkpathdup(\"%s/config\", opts->commondir);\n-\telse if (have_git_dir())\n-\t\trepo_config = git_pathdup(\"config\");\n \telse\n \t\trepo_config = NULL;\n \n@@ -1581,9 +1577,9 @@ static int do_git_config_sequence(const struct config_options *opts,\n \treturn ret;\n }\n \n-int git_config_with_options(config_fn_t fn, void *data,\n-\t\t\t    struct git_config_source *config_source,\n-\t\t\t    const struct config_options *opts)\n+int config_with_options(config_fn_t fn, void *data,\n+\t\t\tstruct git_config_source *config_source,\n+\t\t\tconst struct config_options *opts)\n {\n \tstruct config_include_data inc = CONFIG_INCLUDE_INIT;\n \n@@ -1614,9 +1610,14 @@ static void git_config_raw(config_fn_t fn, void *data)\n \tstruct config_options opts = {0};\n \n \topts.respect_includes = 1;\n-\tif (git_config_with_options(fn, data, NULL, &opts) < 0)\n+\tif (have_git_dir()) {\n+\t\topts.commondir = get_git_common_dir();\n+\t\topts.git_dir = get_git_dir();\n+\t}\n+\n+\tif (config_with_options(fn, data, NULL, &opts) < 0)\n \t\t/*\n-\t\t * git_config_with_options() normally returns only\n+\t\t * config_with_options() normally returns only\n \t\t * zero, as most errors are fatal, and\n \t\t * non-fatal potential errors are guarded by \"if\"\n \t\t * statements that are entered only when no error is\n@@ -1676,7 +1677,7 @@ void read_early_config(config_fn_t cb, void *data)\n \t\topts.git_dir = gitdir.buf;\n \t}\n \n-\tgit_config_with_options(cb, data, NULL, &opts);\n+\tconfig_with_options(cb, data, NULL, &opts);\n \n \tstrbuf_release(&commondir);\n \tstrbuf_release(&gitdir);\ndiff --git a/config.h b/config.h\nindex 63b92784c..9e038cce2 100644\n--- a/config.h\n+++ b/config.h\n@@ -45,9 +45,9 @@ extern void git_config_push_parameter(const char *text);\n extern int git_config_from_parameters(config_fn_t fn, void *data);\n extern void read_early_config(config_fn_t cb, void *data);\n extern void git_config(config_fn_t fn, void *);\n-extern int git_config_with_options(config_fn_t fn, void *,\n-\t\t\t\t   struct git_config_source *config_source,\n-\t\t\t\t   const struct config_options *opts);\n+extern int config_with_options(config_fn_t fn, void *,\n+\t\t\t       struct git_config_source *config_source,\n+\t\t\t       const struct config_options *opts);\n extern int git_parse_ulong(const char *, unsigned long *);\n extern int git_parse_maybe_bool(const char *);\n extern int git_config_int(const char *, const char *);\n-- \n2.13.1.518.g3df882009-goog\n\n"},{"id":"322382","messageId":"xmqq8tkt10pt.fsf@gitster.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170614180739.72193-1-bmwill@google.com","subject":"Re: [PATCH v3 0/6] config.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-06-15T19:59:26Z","receivedAt":"2017-06-15T19:59:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brandon Williams <bmwill@google.com> writes:\n\n> Changes in v3:\n>\n> * tweaked the discover_git_directory function's API based on Peff's feedback\n> * reordered the last three patches so that they flowed a bit better\n> * renamed 'git_config_with_options'\n> * rebased ontop of v4 of Dscho's alias series\n>   https://public-inbox.org/git/cover.1497440104.git.johannes.schindelin@gmx.de/\n\nApplying this series was messier than necessary, I'd have to say, as\nthis series would not apply cleanly on top of the result of applying\nDscho's v4 on top of the same base as Dscho's v3 was applied (which\nis v2.13.0).  It applied cleanly only when Dscho's v4 and then this\nseries were applied on top of 02a2850a (\"Sync with maint\",\n2017-06-13), which is a much newer commit than v2.13.0.\n\nWhich in turn means these two fixes cannot be merged to 'maint' as\nyou two collaboratively prepared.\n\nI've applied Dscho's v4 on top of v2.13.0 (just like his v3 was\nqueued in my tree on the same base), and then tweaked this series to\napply on top of that, so that they can go to 'maint' if we chose to.\n\nBut it is possible that during this unnecessary patch shuffling, I\nmay have made some mistake, so please eyeball the resulting 12\npatches carefully when they are pushed out.\n\nThanks.\n>\n"},{"id":"322386","messageId":"20170615203332.GB176947@google.com","threadId":"46161","inReplyTo":"xmqq8tkt10pt.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 0/6] config.h","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-15T20:33:32Z","receivedAt":"2017-06-15T20:33:40Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/15, Junio C Hamano wrote:\n> Brandon Williams <bmwill@google.com> writes:\n> \n> > Changes in v3:\n> >\n> > * tweaked the discover_git_directory function's API based on Peff's feedback\n> > * reordered the last three patches so that they flowed a bit better\n> > * renamed 'git_config_with_options'\n> > * rebased ontop of v4 of Dscho's alias series\n> >   https://public-inbox.org/git/cover.1497440104.git.johannes.schindelin@gmx.de/\n> \n> Applying this series was messier than necessary, I'd have to say, as\n> this series would not apply cleanly on top of the result of applying\n> Dscho's v4 on top of the same base as Dscho's v3 was applied (which\n> is v2.13.0).  It applied cleanly only when Dscho's v4 and then this\n> series were applied on top of 02a2850a (\"Sync with maint\",\n> 2017-06-13), which is a much newer commit than v2.13.0.\n> \n> Which in turn means these two fixes cannot be merged to 'maint' as\n> you two collaboratively prepared.\n> \n> I've applied Dscho's v4 on top of v2.13.0 (just like his v3 was\n> queued in my tree on the same base), and then tweaked this series to\n> apply on top of that, so that they can go to 'maint' if we chose to.\n> \n> But it is possible that during this unnecessary patch shuffling, I\n> may have made some mistake, so please eyeball the resulting 12\n> patches carefully when they are pushed out.\n\nUgh, I'm terribly sorry.  Completely my bad as I didn't consider what\nyou would need to do on your end.  When I built my patches on top of his\nI naively just applied his v4 to what ever the current origin/master was\nat that point in time.  I'll be sure to be more careful with this\nnext time.\n\n-- \nBrandon Williams\n"},{"id":"322397","messageId":"xmqqzid9yn4a.fsf@gitster.mtv.corp.google.com","threadId":"46161","inReplyTo":"20170615203332.GB176947@google.com","subject":"Re: [PATCH v3 0/6] config.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-06-15T21:09:09Z","receivedAt":"2017-06-15T21:09:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brandon Williams <bmwill@google.com> writes:\n\n> On 06/15, Junio C Hamano wrote:\n>\n>> ... so please eyeball the resulting 12 patches carefully when\n>> they are pushed out.\n>\n> Ugh, I'm terribly sorry.  Completely my bad as I didn't consider what\n> you would need to do on your end.  When I built my patches on top of his\n> I naively just applied his v4 to what ever the current origin/master was\n> at that point in time.  I'll be sure to be more careful with this\n> next time.\n\nIt's no big deal (otherwise I would have insisted you to rebase so\nthat the end result can be merged to 'maint', instead of doing it\nmyself).\n\nBut quite honestly, I do not understand why you rebased this on top\nof the alias thing.  Help me make sure that I correctly undertand\nwhat these two topics want to do:\n\n - The primary point of js/alias-early-config is to fix reading of\n   pager config from a wrong place when alias expansion is involved,\n   and its solution has a nice property that it simplifies the alias\n   lookup and avoids the unpleasant save/restore-env dance by\n   switching to use the early-config mechanism.\n\n - Unfortunately, the early-config mechanism is broken with respect\n   to multi-worktree configuration because it does not pay attention\n   to the common-dir stuff.\n\n - The primary objective of bw/config-h was to separate out the\n   configuration related things out of the kitchen-sink cache.h, but\n   as a nice side effect, it also fixes the early-config mechanism.\n\nAssuming that the above reading of mine of these two topics are\ncorrect, we can conclude that even if we merge js/alias-early-config\nthat forks from v2.13.0 to 'maint', the result by itself would\nregress the use of alias in multi-worktree configuration.  For it to\nbe useful, it must be merged after bw/config-h gets merged.\n\nSo it looks to me that it would make more sense to build bw/config-h\non v2.13.0 and then base js/alias-early-config on top of the result.\nIf Dscho is too busy to rebase and you are volunteering to help,\nperhaps the right way to help would be for you to do that rebasing,\nnot rebase bw/config-h on top of js/alias-early-config, which is\nbackwards and does not buy us very much.  Of course, we could make\nthe result of such rebasing into a single topic, but even in that\ncase, the order of changes feel backwards if bw/config-h comes\nlater.\n\nAnyway, I think I have to tend to many more patches before I can\npush out today's integration result, so ...\n\n\n"},{"id":"322401","messageId":"20170615211850.GC176947@google.com","threadId":"46161","inReplyTo":"xmqqzid9yn4a.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 0/6] config.h","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-15T21:18:50Z","receivedAt":"2017-06-15T21:18:57Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/15, Junio C Hamano wrote:\n> Brandon Williams <bmwill@google.com> writes:\n> \n> > On 06/15, Junio C Hamano wrote:\n> >\n> >> ... so please eyeball the resulting 12 patches carefully when\n> >> they are pushed out.\n> >\n> > Ugh, I'm terribly sorry.  Completely my bad as I didn't consider what\n> > you would need to do on your end.  When I built my patches on top of his\n> > I naively just applied his v4 to what ever the current origin/master was\n> > at that point in time.  I'll be sure to be more careful with this\n> > next time.\n> \n> It's no big deal (otherwise I would have insisted you to rebase so\n> that the end result can be merged to 'maint', instead of doing it\n> myself).\n> \n> But quite honestly, I do not understand why you rebased this on top\n> of the alias thing.  Help me make sure that I correctly undertand\n> what these two topics want to do:\n> \n>  - The primary point of js/alias-early-config is to fix reading of\n>    pager config from a wrong place when alias expansion is involved,\n>    and its solution has a nice property that it simplifies the alias\n>    lookup and avoids the unpleasant save/restore-env dance by\n>    switching to use the early-config mechanism.\n> \n>  - Unfortunately, the early-config mechanism is broken with respect\n>    to multi-worktree configuration because it does not pay attention\n>    to the common-dir stuff.\n> \n>  - The primary objective of bw/config-h was to separate out the\n>    configuration related things out of the kitchen-sink cache.h, but\n>    as a nice side effect, it also fixes the early-config mechanism.\n> \n> Assuming that the above reading of mine of these two topics are\n> correct, we can conclude that even if we merge js/alias-early-config\n> that forks from v2.13.0 to 'maint', the result by itself would\n> regress the use of alias in multi-worktree configuration.  For it to\n> be useful, it must be merged after bw/config-h gets merged.\n> \n> So it looks to me that it would make more sense to build bw/config-h\n> on v2.13.0 and then base js/alias-early-config on top of the result.\n> If Dscho is too busy to rebase and you are volunteering to help,\n> perhaps the right way to help would be for you to do that rebasing,\n> not rebase bw/config-h on top of js/alias-early-config, which is\n> backwards and does not buy us very much.  Of course, we could make\n> the result of such rebasing into a single topic, but even in that\n> case, the order of changes feel backwards if bw/config-h comes\n> later.\n> \n> Anyway, I think I have to tend to many more patches before I can\n> push out today's integration result, so ...\n> \n> \n\nYeah I see that the order is probably backwards.  I think I just heard\nDscho say \"I'm too busy\" and went along with just rebasing on top of his\nseries.  If you do end up feeling like this should be done differently\n(like if another reroll is needed etc) then I wouldn't mind taking\nownership and making the order more sane.\n\n-- \nBrandon Williams\n"},{"id":"322427","messageId":"20170616001235.GD176947@google.com","threadId":"46161","inReplyTo":"20170615211850.GC176947@google.com","subject":"Re: [PATCH v3 0/6] config.h","fromName":"Brandon Williams","fromEmail":"bmwill@google.com","sentAt":"2017-06-16T00:12:35Z","receivedAt":"2017-06-16T00:12:43Z","isPatch":true,"sender":{"key":"bwilliams.eng@gmail.com","avatar":null},"body":"On 06/15, Brandon Williams wrote:\n> On 06/15, Junio C Hamano wrote:\n> > Brandon Williams <bmwill@google.com> writes:\n> > \n> > > On 06/15, Junio C Hamano wrote:\n> > >\n> > >> ... so please eyeball the resulting 12 patches carefully when\n> > >> they are pushed out.\n\nI just took a look at what you pushed out and they look good to me.\n\n-- \nBrandon Williams\n"}]}