Commit 6b0fc6ab by Edward Thomson

diff: on win32, treat fake "symlinks" specially

On platforms that lack `core.symlinks`, we should not go looking for
symbolic links and `p_readlink` their target.  Instead, we should
examine the file's contents.
parent f20480ab
......@@ -259,10 +259,35 @@ static int diff_file_content_load_blob(
return error;
}
static int diff_file_content_load_workdir_symlink_fake(
git_diff_file_content *fc, git_buf *path)
{
git_buf target = GIT_BUF_INIT;
int error;
if ((error = git_futils_readbuffer(&target, path->ptr)) < 0)
return error;
fc->map.len = git_buf_len(&target);
fc->map.data = git_buf_detach(&target);
fc->flags |= GIT_DIFF_FLAG__FREE_DATA;
git_buf_free(&target);
return error;
}
static int diff_file_content_load_workdir_symlink(
git_diff_file_content *fc, git_buf *path)
{
ssize_t alloc_len, read_len;
int symlink_supported, error;
if ((error = git_repository__cvar(
&symlink_supported, fc->repo, GIT_CVAR_SYMLINKS)) < 0)
return -1;
if (!symlink_supported)
return diff_file_content_load_workdir_symlink_fake(fc, path);
/* link path on disk could be UTF-16, so prepare a buffer that is
* big enough to handle some UTF-8 data expansion
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment