git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] http: expand http.cookieFile as a path

From
Brian Norris <computersforpeace@gmail.com>
Date
Apr 29, 2016, 06:23 UTC
Message-ID
<20160429062357.12647-2-computersforpeace@gmail.com>
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
Previous: Brian NorrisNext: Jeff King
Message 2 of 12 in “Documentation: config: improve word ordering for http.cookieFile”
  1. 1/2 Documentation: config: improve word ordering for http.cookieFileBrian Norris, Apr 29, 2016
  2. 2/2 http: expand http.cookieFile as a pathBrian Norris, Apr 29, 2016
  3. Jeff KingApr 29, 2016
  4. Brian NorrisApr 29, 2016
  5. Junio C HamanoApr 29, 2016
  6. Jeff KingApr 29, 2016
  7. Junio C HamanoApr 29, 2016
  8. Jeff KingApr 29, 2016
  9. Junio C HamanoApr 29, 2016
  10. Junio C HamanoApr 29, 2016
  11. Jeff KingApr 29, 2016
  12. Junio C HamanoApr 29, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.