All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH v2 2/3] home_config_path: allow NULL xdg parameter
Date: Fri, 25 Jul 2014 20:00:06 +0200	[thread overview]
Message-ID: <1406311207-8276-2-git-send-email-Matthieu.Moy@imag.fr> (raw)
In-Reply-To: <1406311207-8276-1-git-send-email-Matthieu.Moy@imag.fr>

This allows a caller to request the global config file without requesting
the XDG one.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 path.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/path.c b/path.c
index 3afcdb4..f68df0c 100644
--- a/path.c
+++ b/path.c
@@ -148,10 +148,12 @@ void home_config_paths(char **global, char **xdg, char *file)
 			*global = mkpathdup("%s/.gitconfig", home);
 	}
 
-	if (!xdg_home)
-		*xdg = NULL;
-	else
-		*xdg = mkpathdup("%s/git/%s", xdg_home, file);
+	if (xdg) {
+		if (!xdg_home)
+			*xdg = NULL;
+		else
+			*xdg = mkpathdup("%s/git/%s", xdg_home, file);
+	}
 
 	free(to_free);
 }
-- 
2.0.2.737.gfb43bde

  reply	other threads:[~2014-07-25 18:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 18:00 [PATCH v2 1/3] config --global --edit: create a template file if needed Matthieu Moy
2014-07-25 18:00 ` Matthieu Moy [this message]
2014-07-25 19:09   ` [PATCH v2 2/3] home_config_path: allow NULL xdg parameter Junio C Hamano
2014-07-25 18:00 ` [PATCH v2 3/3] commit: advertise config --global --edit on guessed identity Matthieu Moy
2014-07-25 19:05 ` [PATCH v2 1/3] config --global --edit: create a template file if needed Junio C Hamano
2014-07-25 19:11   ` [PATCH v3 " Matthieu Moy
2014-07-25 19:11     ` [PATCH v3 2/3] home_config_paths(): let the caller ignore xdg path Matthieu Moy
2014-07-25 19:11     ` [PATCH v3 3/3] commit: advertise config --global --edit on guessed identity Matthieu Moy
2014-07-25 19:38       ` Junio C Hamano
2014-07-25 19:24     ` [PATCH v3 1/3] config --global --edit: create a template file if needed Junio C Hamano

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=1406311207-8276-2-git-send-email-Matthieu.Moy@imag.fr \
    --to=matthieu.moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.