Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6fc22fa

Browse files
author
Sim Domingo
committed
fix error when including a missing config file relative to the home directory
1 parent 95a52c7 commit 6fc22fa

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/config_file.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,8 +1250,16 @@ static int strip_comments(char *line, int in_quotes)
12501250
static int included_path(git_buf *out, const char *dir, const char *path)
12511251
{
12521252
/* From the user's home */
1253-
if (path[0] == '~' && path[1] == '/')
1254-
return git_sysdir_find_global_file(out, &path[1]);
1253+
int result;
1254+
if (path[0] == '~' && path[1] == '/') {
1255+
result = git_sysdir_find_global_file(out, &path[1]);
1256+
if (result == GIT_ENOTFOUND) {
1257+
git_buf_sets(out, &path[1]);
1258+
return 0;
1259+
}
1260+
1261+
return result;
1262+
}
12551263

12561264
return git_path_join_unrooted(out, path, dir, NULL);
12571265
}

0 commit comments

Comments
 (0)