Skip to contentSkip to conversation

config: describe 'pathname' value type

PATCH In review Brian Norris 3 participants 6 messages Jun 16, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 config: describe 'pathname' value type

From: Junio C Hamano <[email protected]>

We have a dedicated section for various value-types used in the configuration variables already, because we needed to describe how booleans and scaled integers can be spelled, and the pathname type would fit there.

Adjust the description of include.path, core.excludesFile, and commit.template variables to clarify that the variables are of this type.

---
v2: new

 Documentation/config.txt | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)
Documentation/config.txt +19 -11
index 42d2b50477b2..7264abf7f85e 100644
@@ -81,13 +81,16 @@ Includes
 
 You can include one config file from another by setting the special
 `include.path` variable to the name of the file to be included. The
+variable takes a pathname as its value, and is subject to tilde
+expansion.
+
+The
 included file is expanded immediately, as if its contents had been
 found at the location of the include directive. If the value of the
 `include.path` variable is a relative path, the path is considered to be
 relative to the configuration file in which the include directive was
-found. The value of `include.path` is subject to tilde expansion: `~/`
-is expanded to the value of `$HOME`, and `~user/` to the specified
-user's home directory. See below for examples.
+found.  See below for examples.
+
 
 Example
 ~~~~~~~
@@ -169,6 +172,13 @@ thing on the same output line (e.g. opening parenthesis before the
 list of branch names in `log --decorate` output) is set to be
 painted with `bold` or some other attribute.
 
+pathname::
+	A variable that takes a pathname value can be given a
+	string that begins with "`~/`" or "`~user/`", and the usual
+	tilde expansion happens to such a string: `~/`
+	is expanded to the value of `$HOME`, and `~user/` to the
+	specified user's home directory.
+
 
 Variables
 ~~~~~~~~~
@@ -593,11 +603,10 @@ be delta compressed, but larger binary media files won't be.
 Common unit suffixes of 'k', 'm', or 'g' are supported.
 
 core.excludesFile::
-	In addition to '.gitignore' (per-directory) and
-	'.git/info/exclude', Git looks into this file for patterns
-	of files which are not meant to be tracked.  "`~/`" is expanded
-	to the value of `$HOME` and "`~user/`" to the specified user's
-	home directory. Its default value is $XDG_CONFIG_HOME/git/ignore.
+	Specifies the pathname to the file that contains patterns to
+	describe paths that are not meant to be tracked, in addition
+	to '.gitignore' (per-directory) and '.git/info/exclude'.
+	Defaults to $XDG_CONFIG_HOME/git/ignore.
 	If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/ignore
 	is used instead. See linkgit:gitignore[5].
 
@@ -1106,9 +1115,8 @@ commit.status::
 	message.  Defaults to true.
 
 commit.template::
-	Specify a file to use as the template for new commit messages.
-	"`~/`" is expanded to the value of `$HOME` and "`~user/`" to the
-	specified user's home directory.
+	Specify the pathname of a file to use as the template for
+	new commit messages.
 
 credential.helper::
 	Specify an external helper to be called when a username or
Signature · 1 line
2.8.0.rc3.226.g39d4020
#1 lore raw

PATCH v2 2/3 Documentation: config: improve word ordering for http.cookieFile

---
v2: no change

 Documentation/config.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/config.txt +1 -1
index 7264abf7f85e..e655b9729a7d 100644
@@ -1668,7 +1668,7 @@ 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]).
-	NOTE that the file specified with http.cookieFile is only used as
+	NOTE that the file specified with http.cookieFile is used only as
 	input unless http.saveCookies is set.
 
 http.saveCookies::
Signature · 1 line
2.8.0.rc3.226.g39d4020
#2 lore raw

PATCH v2 3/3 http: expand http.cookieFile as a path

In reply to Brian Norris

This should handle .gitconfig files that specify things like:

[http]
cookieFile = "~/.gitcookies"

---
v2: rework documentation now that 'pathname' is documented centrally

 Documentation/config.txt | 3 ++-
 http.c                   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
Documentation/config.txt +2 -1
index e655b9729a7d..4c3cd7621ad0 100644
@@ -1664,7 +1664,8 @@ http.emptyAuth::
 	authentication.
 
 http.cookieFile::
-	File containing previously stored cookie lines which should be used
+	The pathname of a file containing previously stored cookie lines,
+	which should be used
 	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]).
http.c +1 -1
index 4304b80ad3ac..1044f9ba0e28 100644
@@ -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;
Signature · 1 line
2.8.0.rc3.226.g39d4020
#3 lore raw

Re: [PATCH v2 3/3] http: expand http.cookieFile as a path

Quoted 5 lines · Brian Norris
Documentation/config.txt +0 -0
index e655b9729a7d..4c3cd7621ad0 100644

Documentation/config.txt http.emptyAuth:: · line 1671

Quoted 9 lines
Documentation/config.txt +2 -1
@@ -1664,7 +1664,8 @@ http.emptyAuth::
 	authentication.
 
 http.cookieFile::
-	File containing previously stored cookie lines which should be used
+	The pathname of a file containing previously stored cookie lines,
+	which should be used
 	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]).

I think we usually re-wrap paragraphs when adding to the documentation, but I do not have a strong opinion (and certainly understand the reasons for not doing so).

The whole series looks fine to me. Thanks.

-Peff

#4 lore raw

Re: [PATCH v2 3/3] http: expand http.cookieFile as a path

Quoted 9 lines · Jeff King
Quoted 7 lines · Brian Norris
Documentation/config.txt +0 -0
index e655b9729a7d..4c3cd7621ad0 100644
@@ -1664,7 +1664,8 @@ http.emptyAuth::
 	authentication.
 
Quoted 11 lines

Documentation/config.txt http.emptyAuth:: · line 1671

Quoted 7 lines
Documentation/config.txt +2 -1
 http.cookieFile::
-	File containing previously stored cookie lines which should be used
+	The pathname of a file containing previously stored cookie lines,
+	which should be used
 	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]).

I think we usually re-wrap paragraphs when adding to the documentation, but I do not have a strong opinion (and certainly understand the reasons for not doing so).

I chose the wrapping mostly based on the diff suggestions y'all kindly provided :)

I can rewrap and resend if necessary.

Quoted 1 line

The whole series looks fine to me. Thanks.

Thanks,
Brian

#5 lore raw

Re: [PATCH v2 3/3] http: expand http.cookieFile as a path

Quoted 22 lines · Brian Norris
Quoted 9 lines · Jeff King
Quoted 7 lines · Brian Norris
Documentation/config.txt +0 -0
index e655b9729a7d..4c3cd7621ad0 100644
@@ -1664,7 +1664,8 @@ http.emptyAuth::
 	authentication.
 
Quoted 11 lines

Documentation/config.txt http.emptyAuth:: · line 1671

Quoted 7 lines
Documentation/config.txt +2 -1
 http.cookieFile::
-	File containing previously stored cookie lines which should be used
+	The pathname of a file containing previously stored cookie lines,
+	which should be used
 	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]).

I think we usually re-wrap paragraphs when adding to the documentation, but I do not have a strong opinion (and certainly understand the reasons for not doing so).

Quoted 6 lines

I chose the wrapping mostly based on the diff suggestions y'all kindly provided :)

I can rewrap and resend if necessary.

Quoted 1 line

The whole series looks fine to me. Thanks.

If the rewrite were a lot more extensive, then it no longer would make sense to refrain from rewrapping (which reduces the number of lines eyes have to scan), but doing this without rewrapping I think strikes a good balance.