Commit 91156a0f by Edward Thomson

diff: use git_repository_workdir_path

The new git_repository_workdir_path function does error checking on
working directory inputs on Windows; use it to construct paths within
working directories.
parent 578aeba9
...@@ -394,8 +394,7 @@ static int diff_file_content_load_workdir( ...@@ -394,8 +394,7 @@ static int diff_file_content_load_workdir(
if (fc->file->mode == GIT_FILEMODE_TREE) if (fc->file->mode == GIT_FILEMODE_TREE)
return 0; return 0;
if (git_buf_joinpath( if (git_repository_workdir_path(&path, fc->repo, fc->file->path) < 0)
&path, git_repository_workdir(fc->repo), fc->file->path) < 0)
return -1; return -1;
if (S_ISLNK(fc->file->mode)) if (S_ISLNK(fc->file->mode))
......
...@@ -596,8 +596,7 @@ int git_diff__oid_for_entry( ...@@ -596,8 +596,7 @@ int git_diff__oid_for_entry(
memset(out, 0, sizeof(*out)); memset(out, 0, sizeof(*out));
if (git_buf_joinpath(&full_path, if (git_repository_workdir_path(&full_path, diff->base.repo, entry.path) < 0)
git_repository_workdir(diff->base.repo), entry.path) < 0)
return -1; return -1;
if (!mode) { if (!mode) {
......
...@@ -476,8 +476,8 @@ static int similarity_sig( ...@@ -476,8 +476,8 @@ static int similarity_sig(
git_diff_file *file = info->file; git_diff_file *file = info->file;
if (info->src == GIT_ITERATOR_WORKDIR) { if (info->src == GIT_ITERATOR_WORKDIR) {
if ((error = git_buf_joinpath( if ((error = git_repository_workdir_path(
&info->data, git_repository_workdir(info->repo), file->path)) < 0) &info->data, info->repo, file->path)) < 0)
return error; return error;
/* if path is not a regular file, just skip this item */ /* if path is not a regular file, just skip this item */
......
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