path.c: remove home_config_paths()
home_config_paths() combines distinct functionality already implemented by expand_user_path() and xdg_config_home(), and it also hard-codes the path ~/.gitconfig, which makes it unsuitable to use for other home config file paths. Since its use will just add unnecessary complexity to the code, remove it. Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Paul Tan committed
May 6, 2015 at 16:01 UTC
846e5dfbab5d5a0a85252c1400dc0371e02e75a8
2 files changed
-29
cache.h
-1
@@ -808,7 +808,6 @@ enum scld_error safe_create_leading_directories(char *path);
808
enum scld_error safe_create_leading_directories_const(const char *path);
809
810
int mkdir_in_gitdir(const char *path);
811
-extern void home_config_paths(char **global, char **xdg, char *file);
811
extern char *expand_user_path(const char *path);
812
const char *enter_repo(const char *path, int strict);
813
static inline int is_absolute_path(const char *path)
path.c
-28
@@ -130,34 +130,6 @@ char *git_path(const char *fmt, ...)
130
return ret;
131
}
132
133
-void home_config_paths(char **global, char **xdg, char *file)
134
-{
135
- char *xdg_home = getenv("XDG_CONFIG_HOME");
136
- char *home = getenv("HOME");
137
- char *to_free = NULL;
138
-
139
- if (!home) {
140
- if (global)
141
- *global = NULL;
142
- } else {
143
- if (!xdg_home) {
144
- to_free = mkpathdup("%s/.config", home);
145
- xdg_home = to_free;
146
- }
147
- if (global)
148
- *global = mkpathdup("%s/.gitconfig", home);
149
- }
150
-
151
- if (xdg) {
152
- if (!xdg_home)
153
- *xdg = NULL;
154
- else
155
- *xdg = mkpathdup("%s/git/%s", xdg_home, file);
156
- }
157
-
158
- free(to_free);
159
-}
160
-
133
char *git_path_submodule(const char *path, const char *fmt, ...)
134
{
135
char *pathname = get_pathname();