commit - 4d8f0a30e6d88e2585349d482dbc3e4a03c5e599
commit + 65aa7d1c9275be69e0e931210e7e09b8bcb5c143
blob - 158483e7592b870d9c2e3ac5e44abea57616549f
blob + 1f4bef491b17397337b2521fb72f2a60b7bb777a
--- lib/repository.c
+++ lib/repository.c
goto done;
}
} else {
- int is_repo_child = 0;
-
path = realpath(canonpath, NULL);
if (path == NULL) {
if (errno != ENOENT) {
repolen = strlen(repo_abspath);
len = strlen(path);
- if (len > repolen && strncmp(path, repo_abspath, repolen) == 0)
- is_repo_child = 1;
if (strcmp(path, repo_abspath) == 0) {
free(path);
err = got_error_from_errno("strdup");
goto done;
}
- } else if (is_repo_child) {
+ } else if (len > repolen &&
+ got_path_is_child(path, repo_abspath, repolen)) {
/* Matched an on-disk path inside repository. */
if (got_repo_is_bare(repo)) {
/*