git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: <git@vger.kernel.org>
Cc: Brian Norris <computersforpeace@gmail.com>
Subject: [PATCH 2/2] http: expand http.cookieFile as a path
Date: Fri, 29 Apr 2016 00:23:57 -0600	[thread overview]
Message-ID: <20160429062357.12647-2-computersforpeace@gmail.com> (raw)
In-Reply-To: <20160429062357.12647-1-computersforpeace@gmail.com>

This should handle .gitconfig files that specify things like:

[http]
	cookieFile = "~/.gitcookies"

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 Documentation/config.txt | 3 +++
 http.c                   | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index a775ad885a76..d3ef2d3b5d13 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1660,6 +1660,9 @@ http.cookieFile::
 	in the Git http session, if they match the server. The file format
 	of the file to read cookies from should be plain HTTP headers or
 	the Netscape/Mozilla cookie file format (see linkgit:curl[1]).
+	The value of `http.cookieFile` is subject to tilde expansion: `~/` is
+	expanded to the value of `$HOME`, and `~user/` to the specified user's
+	home directory.
 	NOTE that the file specified with http.cookieFile is used only as
 	input unless http.saveCookies is set.
 
diff --git a/http.c b/http.c
index 4304b80ad3ac..1044f9ba0e28 100644
--- a/http.c
+++ b/http.c
@@ -293,7 +293,7 @@ static int http_options(const char *var, const char *value, void *cb)
 		return git_config_string(&http_proxy_authmethod, var, value);
 
 	if (!strcmp("http.cookiefile", var))
-		return git_config_string(&curl_cookie_file, var, value);
+		return git_config_pathname(&curl_cookie_file, var, value);
 	if (!strcmp("http.savecookies", var)) {
 		curl_save_cookies = git_config_bool(var, value);
 		return 0;
-- 
2.8.1.340.g018a5d0.dirty

  reply	other threads:[~2016-04-29  6:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29  6:23 [PATCH 1/2] Documentation: config: improve word ordering for http.cookieFile Brian Norris
2016-04-29  6:23 ` Brian Norris [this message]
2016-04-29 14:12   ` [PATCH 2/2] http: expand http.cookieFile as a path Jeff King
2016-04-29 15:55     ` Brian Norris
2016-04-29 17:48       ` Junio C Hamano
2016-04-29 17:49         ` Jeff King
2016-04-29 17:55           ` Junio C Hamano
2016-04-29 17:56             ` Jeff King
2016-04-29 17:52         ` Junio C Hamano
2016-04-29 17:11     ` Junio C Hamano
2016-04-29 17:16       ` Jeff King
2016-04-29 17:27         ` 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=20160429062357.12647-2-computersforpeace@gmail.com \
    --to=computersforpeace@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).