Skip to contentSkip to conversation

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

PATCH In review Øystein Walle 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 config: respect '~' and '~user' in mailmap.file

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

---
 config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
config.c +1 -1
index 314d8ee..ec7af5f 100644
@@ -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);
 
Signature · 1 line
2.0.0.rc4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Øystein Walle

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:

-Peff

#2 lore raw
Quoted 11 lines · Jeff King <peff <at> peff.net> writes:

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