Skip to content

Commit 846e5df

Browse files
pyokagangitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 509adc3 commit 846e5df

File tree

2 files changed

+0
-29
lines changed

2 files changed

+0
-29
lines changed

cache.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,6 @@ enum scld_error safe_create_leading_directories(char *path);
808808
enum scld_error safe_create_leading_directories_const(const char *path);
809809

810810
int mkdir_in_gitdir(const char *path);
811-
extern void home_config_paths(char **global, char **xdg, char *file);
812811
extern char *expand_user_path(const char *path);
813812
const char *enter_repo(const char *path, int strict);
814813
static inline int is_absolute_path(const char *path)

path.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -130,34 +130,6 @@ char *git_path(const char *fmt, ...)
130130
return ret;
131131
}
132132

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-
161133
char *git_path_submodule(const char *path, const char *fmt, ...)
162134
{
163135
char *pathname = get_pathname();

0 commit comments

Comments
 (0)