Commit 4258d483 by Sven Strickroth

Rename xdr to xdg

Signed-off-by: Sven Strickroth <email@cs-ware.de>
parent 8b3de0b6
...@@ -61,7 +61,7 @@ typedef struct { ...@@ -61,7 +61,7 @@ typedef struct {
* may be used on any `git_config` call to load the * may be used on any `git_config` call to load the
* global configuration file. * global configuration file.
* *
* This method will not guess the path to the xdr compatible * This method will not guess the path to the xdg compatible
* config file (.config/git/config). * config file (.config/git/config).
* *
* @param global_config_path Buffer of GIT_PATH_MAX length to store the path * @param global_config_path Buffer of GIT_PATH_MAX length to store the path
...@@ -71,21 +71,21 @@ typedef struct { ...@@ -71,21 +71,21 @@ typedef struct {
GIT_EXTERN(int) git_config_find_global(char *global_config_path, size_t length); GIT_EXTERN(int) git_config_find_global(char *global_config_path, size_t length);
/** /**
* Locate the path to the global xdr compatible configuration file * Locate the path to the global xdg compatible configuration file
* *
* The xdr compatible configuration file is usually * The xdg compatible configuration file is usually
* located in `$HOME/.config/git/config`. * located in `$HOME/.config/git/config`.
* *
* This method will try to guess the full path to that * This method will try to guess the full path to that
* file, if the file exists. The returned path * file, if the file exists. The returned path
* may be used on any `git_config` call to load the * may be used on any `git_config` call to load the
* global configuration file. * xdg compatible configuration file.
* *
* @param global_config_path Buffer of GIT_PATH_MAX length to store the path * @param xdg_config_path Buffer of GIT_PATH_MAX length to store the path
* @return 0 if a global configuration file has been * @return 0 if a xdg compatible configuration file has been
* found. Its path will be stored in `buffer`. * found. Its path will be stored in `buffer`.
*/ */
GIT_EXTERN(int) git_config_find_xdr(char *global_config_path, size_t length); GIT_EXTERN(int) git_config_find_xdg(char *xdg_config_path, size_t length);
/** /**
* Locate the path to the system configuration file * Locate the path to the system configuration file
......
...@@ -454,7 +454,7 @@ int git_config_find_global_r(git_buf *path) ...@@ -454,7 +454,7 @@ int git_config_find_global_r(git_buf *path)
return error; return error;
} }
int git_config_find_xdr_r(git_buf *path) int git_config_find_xdg_r(git_buf *path)
{ {
int error = git_futils_find_global_file(path, GIT_CONFIG_FILENAME_ALT); int error = git_futils_find_global_file(path, GIT_CONFIG_FILENAME_ALT);
...@@ -483,10 +483,10 @@ int git_config_find_global(char *global_config_path, size_t length) ...@@ -483,10 +483,10 @@ int git_config_find_global(char *global_config_path, size_t length)
return 0; return 0;
} }
int git_config_find_xdr(char *xdr_config_path, size_t length) int git_config_find_xdg(char *xdg_config_path, size_t length)
{ {
git_buf path = GIT_BUF_INIT; git_buf path = GIT_BUF_INIT;
int ret = git_config_find_xdr_r(&path); int ret = git_config_find_xdg_r(&path);
if (ret < 0) { if (ret < 0) {
git_buf_free(&path); git_buf_free(&path);
...@@ -500,7 +500,7 @@ int git_config_find_xdr(char *xdr_config_path, size_t length) ...@@ -500,7 +500,7 @@ int git_config_find_xdr(char *xdr_config_path, size_t length)
return -1; return -1;
} }
git_buf_copy_cstr(xdr_config_path, length, &path); git_buf_copy_cstr(xdg_config_path, length, &path);
git_buf_free(&path); git_buf_free(&path);
return 0; return 0;
} }
...@@ -543,7 +543,7 @@ int git_config_open_default(git_config **out) ...@@ -543,7 +543,7 @@ int git_config_open_default(git_config **out)
if (!error && !git_config_find_global_r(&buf)) if (!error && !git_config_find_global_r(&buf))
error = git_config_add_file_ondisk(cfg, buf.ptr, 3); error = git_config_add_file_ondisk(cfg, buf.ptr, 3);
if (!error && !git_config_find_xdr_r(&buf)) if (!error && !git_config_find_xdg_r(&buf))
error = git_config_add_file_ondisk(cfg, buf.ptr, 2); error = git_config_add_file_ondisk(cfg, buf.ptr, 2);
if (!error && !git_config_find_system_r(&buf)) if (!error && !git_config_find_system_r(&buf))
......
...@@ -24,7 +24,7 @@ struct git_config { ...@@ -24,7 +24,7 @@ struct git_config {
}; };
extern int git_config_find_global_r(git_buf *global_config_path); extern int git_config_find_global_r(git_buf *global_config_path);
extern int git_config_find_xdr_r(git_buf *system_config_path); extern int git_config_find_xdg_r(git_buf *system_config_path);
extern int git_config_find_system_r(git_buf *system_config_path); extern int git_config_find_system_r(git_buf *system_config_path);
extern int git_config_parse_bool(int *out, const char *bool_string); extern int git_config_parse_bool(int *out, const char *bool_string);
......
...@@ -445,7 +445,7 @@ static int load_config( ...@@ -445,7 +445,7 @@ static int load_config(
git_config **out, git_config **out,
git_repository *repo, git_repository *repo,
const char *global_config_path, const char *global_config_path,
const char *xdr_config_path, const char *xdg_config_path,
const char *system_config_path) const char *system_config_path)
{ {
git_buf config_path = GIT_BUF_INIT; git_buf config_path = GIT_BUF_INIT;
...@@ -470,8 +470,8 @@ static int load_config( ...@@ -470,8 +470,8 @@ static int load_config(
goto on_error; goto on_error;
} }
if (xdr_config_path != NULL) { if (xdg_config_path != NULL) {
if (git_config_add_file_ondisk(cfg, xdr_config_path, 2) < 0) if (git_config_add_file_ondisk(cfg, xdg_config_path, 2) < 0)
goto on_error; goto on_error;
} }
...@@ -493,23 +493,23 @@ on_error: ...@@ -493,23 +493,23 @@ on_error:
int git_repository_config__weakptr(git_config **out, git_repository *repo) int git_repository_config__weakptr(git_config **out, git_repository *repo)
{ {
if (repo->_config == NULL) { if (repo->_config == NULL) {
git_buf global_buf = GIT_BUF_INIT, xdr_buf = GIT_BUF_INIT, system_buf = GIT_BUF_INIT; git_buf global_buf = GIT_BUF_INIT, xdg_buf = GIT_BUF_INIT, system_buf = GIT_BUF_INIT;
int res; int res;
const char *global_config_path = NULL; const char *global_config_path = NULL;
const char *xdr_config_path = NULL; const char *xdg_config_path = NULL;
const char *system_config_path = NULL; const char *system_config_path = NULL;
if (git_config_find_global_r(&global_buf) == 0) if (git_config_find_global_r(&global_buf) == 0)
global_config_path = global_buf.ptr; global_config_path = global_buf.ptr;
if (git_config_find_xdr_r(&xdr_buf) == 0) if (git_config_find_xdg_r(&xdg_buf) == 0)
xdr_config_path = xdr_buf.ptr; xdg_config_path = xdg_buf.ptr;
if (git_config_find_system_r(&system_buf) == 0) if (git_config_find_system_r(&system_buf) == 0)
system_config_path = system_buf.ptr; system_config_path = system_buf.ptr;
res = load_config(&repo->_config, repo, global_config_path, xdr_config_path, system_config_path); res = load_config(&repo->_config, repo, global_config_path, xdg_config_path, system_config_path);
git_buf_free(&global_buf); git_buf_free(&global_buf);
git_buf_free(&system_buf); git_buf_free(&system_buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment