Skip to content

Commit 301dc26

Browse files
Sim Domingoethomson
authored andcommitted
fix error when including a missing config file relative to the home directory
1 parent 047fe29 commit 301dc26

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
@@ -1254,8 +1254,16 @@ static int strip_comments(char *line, int in_quotes)
12541254
static int included_path(git_buf *out, const char *dir, const char *path)
12551255
{
12561256
/* From the user's home */
1257-
if (path[0] == '~' && path[1] == '/')
1258-
return git_sysdir_find_global_file(out, &path[1]);
1257+
int result;
1258+
if (path[0] == '~' && path[1] == '/') {
1259+
result = git_sysdir_find_global_file(out, &path[1]);
1260+
if (result == GIT_ENOTFOUND) {
1261+
git_buf_sets(out, &path[1]);
1262+
return 0;
1263+
}
1264+
1265+
return result;
1266+
}
12591267

12601268
return git_path_join_unrooted(out, path, dir, NULL);
12611269
}

0 commit comments

Comments
 (0)