threads / patch / 36758

patchconfig: respect '~' and '~user' in mailmap.file

Subject: [PATCH] config: respect '~' and '~user' in mailmap.file

## tl;dr

3 messages between May 27, 2014 and May 27, 2014. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Øystein Walle· May 27, 2014, 08:45 UTC · lore

git_config_string() does not handle '~' and '~user' as part of the value. Using git_config_pathname() fixes this.

Signed-off-by: Øystein Walle <oystwa@gmail.com>
---
 config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to config.c +1 −1
diff --git a/config.c b/config.c
index 314d8ee..ec7af5f 100644
--- a/config.c
+++ b/config.c
@@ -963,7 +963,7 @@ static int git_default_push_config(const char *var, const char *value)
 static int git_default_mailmap_config(const char *var, const char *value)
 {
 	if (!strcmp(var, "mailmap.file"))
-		return git_config_string(&git_mailmap_file, var, value);
+		return git_config_pathname(&git_mailmap_file, var, value);
 	if (!strcmp(var, "mailmap.blob"))
 		return git_config_string(&git_mailmap_blob, var, value);
 
-- 
2.0.0.rc4
Jeff King· May 27, 2014, 16:09 UTC · re: Øystein Walle · lore

Re: [PATCH] config: respect '~' and '~user' in mailmap.file

On Tue, May 27, 2014 at 10:45:58AM +0200, Øystein Walle wrote:
> git_config_string() does not handle '~' and '~user' as part of the
> value. Using git_config_pathname() fixes this.

Makes sense. Curious if there was a reason we did not use it in the first place, I looked at the history. The reason is that mailmap.file was added in d551a48 (2009-02-08) and git_config_pathname came months later in 395de25 (2009-11-17). Retro-fitting it now should not cause a problem for any sane paths. So:

Reviewed-by: Jeff King <peff@peff.net>
-Peff
Øystein Walle· May 27, 2014, 23:28 UTC · re: Jeff King · lore

Re: [PATCH] config: respect '~' and '~user' in mailmap.file

Jeff King <peff <at> peff.net> writes:
Show 11 quoted lines
> 
> Makes sense. Curious if there was a reason we did not use it in the
> first place, I looked at the history. The reason is that mailmap.file
> was added in d551a48 (2009-02-08) and git_config_pathname came months
> later in 395de25 (2009-11-17). Retro-fitting it now should not cause a
> problem for any sane paths. So:
> 
> Reviewed-by: Jeff King <peff <at> peff.net>
> 
> -Peff
>
 
Thanks for the review. 

I saw it was added back in 2009 but didn't give it much thought other than "Oh, that bug has been there for a long time!" :) (Not that this is a serious bug as such, more than a slight inconsistency in how the path is handled compared to other config values expected to be paths)

Øsse

← back to recent threads