提交 18e051a3 编写于 作者: C Carlo Marcelo Arenas Belon 提交者: Junio C Hamano

setup: translate symlinks in filename when using absolute paths

otherwise, comparison to validate against work tree will fail when
the path includes a symlink and the name passed is not canonical.
Signed-off-by: NCarlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 0ed74813
......@@ -7,10 +7,13 @@ static int inside_work_tree = -1;
const char *prefix_path(const char *prefix, int len, const char *path)
{
const char *orig = path;
char *sanitized = xmalloc(len + strlen(path) + 1);
if (is_absolute_path(orig))
strcpy(sanitized, path);
else {
char *sanitized;
if (is_absolute_path(orig)) {
const char *temp = make_absolute_path(path);
sanitized = xmalloc(len + strlen(temp) + 1);
strcpy(sanitized, temp);
} else {
sanitized = xmalloc(len + strlen(path) + 1);
if (len)
memcpy(sanitized, prefix, len);
strcpy(sanitized + len, path);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册