{
const char *orig = path;
char *sanitized = xmalloc(len + strlen(path) + 1);
- if (*orig == '/')
+ if (is_absolute_path(orig))
strcpy(sanitized, path);
else {
if (len)
}
if (sanitary_path_copy(sanitized, sanitized))
goto error_out;
- if (*orig == '/') {
+ if (is_absolute_path(orig)) {
const char *work_tree = get_git_work_tree();
size_t len = strlen(work_tree);
size_t total = strlen(sanitized) + 1;
const char *p = prefix_path(prefix, prefixlen, *src);
if (p)
*(dst++) = p;
+ else
+ exit(128); /* error message already given */
src++;
}
*dst = NULL;
} else if (strcmp(var, "core.worktree") == 0) {
if (!value)
return config_error_nonbool(var);
- if (git_work_tree_cfg)
- free(git_work_tree_cfg);
+ free(git_work_tree_cfg);
git_work_tree_cfg = xstrdup(value);
inside_work_tree = -1;
}