path.c: and an option to call real_path() in expand_user_path()

In the next patch we need the ability to expand '~' to
real_path($HOME). But we can't do that from outside because '~' is part
of a pattern, not a true path. Add an option to expand_user_path() to do
so.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2017-04-05 17:24:38 +07:00
committed by Junio C Hamano
parent 3efd0bedc6
commit 4aad2f1627
7 changed files with 17 additions and 12 deletions

View File

@ -168,7 +168,7 @@ int cmd_main(int argc, const char **argv)
if (file) {
string_list_append(&fns, file);
} else {
if ((file = expand_user_path("~/.git-credentials")))
if ((file = expand_user_path("~/.git-credentials", 0)))
string_list_append_nodup(&fns, file);
file = xdg_config_home("credentials");
if (file)