From: Paul Tan <pyokagan@gmail.com>
To: git@vger.kernel.org
Cc: Paul Tan <pyokagan@gmail.com>
Subject: [PATCH 7/7] path.c: remove home_config_paths()
Date: Sun, 12 Apr 2015 15:46:12 +0800 [thread overview]
Message-ID: <1428824772-8736-7-git-send-email-pyokagan@gmail.com> (raw)
In-Reply-To: <1428824772-8736-1-git-send-email-pyokagan@gmail.com>
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>
---
cache.h | 1 -
path.c | 28 ----------------------------
2 files changed, 29 deletions(-)
diff --git a/cache.h b/cache.h
index 7f9bab0..19d75ef 100644
--- a/cache.h
+++ b/cache.h
@@ -816,7 +816,6 @@ enum scld_error safe_create_leading_directories(char *path);
enum scld_error safe_create_leading_directories_const(const char *path);
int mkdir_in_gitdir(const char *path);
-extern void home_config_paths(char **global, char **xdg, char *file);
extern char *expand_user_path(const char *path);
const char *enter_repo(const char *path, int strict);
static inline int is_absolute_path(const char *path)
diff --git a/path.c b/path.c
index 4c32d16..84ec589 100644
--- a/path.c
+++ b/path.c
@@ -130,34 +130,6 @@ char *git_path(const char *fmt, ...)
return ret;
}
-void home_config_paths(char **global, char **xdg, char *file)
-{
- char *xdg_home = getenv("XDG_CONFIG_HOME");
- char *home = getenv("HOME");
- char *to_free = NULL;
-
- if (!home) {
- if (global)
- *global = NULL;
- } else {
- if (!xdg_home) {
- to_free = mkpathdup("%s/.config", home);
- xdg_home = to_free;
- }
- if (global)
- *global = mkpathdup("%s/.gitconfig", home);
- }
-
- if (xdg) {
- if (!xdg_home)
- *xdg = NULL;
- else
- *xdg = mkpathdup("%s/git/%s", xdg_home, file);
- }
-
- free(to_free);
-}
-
char *git_path_submodule(const char *path, const char *fmt, ...)
{
char *pathname = get_pathname();
--
2.1.4
next prev parent reply other threads:[~2015-04-12 7:47 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-12 7:46 [PATCH 1/7] path.c: implement xdg_config_home() Paul Tan
2015-04-12 7:46 ` [PATCH 2/7] attr.c: replace home_config_paths() with xdg_config_home() Paul Tan
2015-04-12 7:46 ` [PATCH 3/7] dir.c: " Paul Tan
2015-04-12 7:46 ` [PATCH 4/7] credential-store.c: " Paul Tan
2015-04-12 7:46 ` [PATCH 5/7] git-commit: replace use of home_config_paths() Paul Tan
2015-04-12 7:46 ` [PATCH 6/7] git-config: " Paul Tan
2015-04-12 7:46 ` Paul Tan [this message]
2015-04-13 15:50 ` [PATCH 1/7] path.c: implement xdg_config_home() Johannes Schindelin
2015-04-14 17:28 ` [PATCH v2 " Paul Tan
2015-04-16 21:41 ` Eric Sunshine
2015-04-18 7:51 ` Paul Tan
2015-04-20 0:39 ` Eric Sunshine
2015-04-21 4:06 ` [PATCH v3 " Paul Tan
2015-05-06 8:00 ` [PATCH v3 2/7] attr.c: replace home_config_paths() with xdg_config_home() Paul Tan
2015-05-06 8:01 ` [PATCH v3 3/7] dir.c: " Paul Tan
2015-05-06 8:01 ` [PATCH v3 4/7] credential-store.c: " Paul Tan
2015-05-06 8:01 ` [PATCH v3 5/7] git-commit: replace use of home_config_paths() Paul Tan
2015-05-06 8:01 ` [PATCH v3 6/7] git-config: " Paul Tan
2015-05-06 8:01 ` [PATCH v3 7/7] path.c: remove home_config_paths() Paul Tan
2015-04-18 8:48 ` [PATCH v2 1/7] path.c: implement xdg_config_home() Paul Tan
2015-04-14 20:39 ` [PATCH " Junio C Hamano
2015-04-14 22:28 ` Stefan Beller
2015-04-14 22:30 ` Junio C Hamano
2015-04-14 22:34 ` Stefan Beller
2015-04-13 21:43 ` Matthieu Moy
2015-04-14 0:18 ` Stefan Beller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428824772-8736-7-git-send-email-pyokagan@gmail.com \
--to=pyokagan@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).