if (strncmp(sanitized, work_tree, len) ||
(sanitized[len] != '\0' && sanitized[len] != '/')) {
error_out:
- error("'%s' is outside repository", orig);
- free(sanitized);
- return NULL;
+ die("'%s' is outside repository", orig);
}
if (sanitized[len] == '/')
len++;
prefixlen = prefix ? strlen(prefix) : 0;
while (*src) {
const char *p = prefix_path(prefix, prefixlen, *src);
- if (p)
- *(dst++) = p;
- else
- exit(128); /* error message already given */
+ *(dst++) = p;
src++;
}
*dst = NULL;
}
die("Not a git repository");
}
- chdir("..");
+ if (chdir(".."))
+ die("Cannot change to %s/..: %s", cwd, strerror(errno));
}
inside_git_dir = 0;