Skip to content

Commit 91156a0

Browse files
committed
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.
1 parent 578aeba commit 91156a0

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/diff_file.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,7 @@ static int diff_file_content_load_workdir(
394394
if (fc->file->mode == GIT_FILEMODE_TREE)
395395
return 0;
396396

397-
if (git_buf_joinpath(
398-
&path, git_repository_workdir(fc->repo), fc->file->path) < 0)
397+
if (git_repository_workdir_path(&path, fc->repo, fc->file->path) < 0)
399398
return -1;
400399

401400
if (S_ISLNK(fc->file->mode))

src/diff_generate.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,7 @@ int git_diff__oid_for_entry(
596596

597597
memset(out, 0, sizeof(*out));
598598

599-
if (git_buf_joinpath(&full_path,
600-
git_repository_workdir(diff->base.repo), entry.path) < 0)
599+
if (git_repository_workdir_path(&full_path, diff->base.repo, entry.path) < 0)
601600
return -1;
602601

603602
if (!mode) {

src/diff_tform.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,8 @@ static int similarity_sig(
476476
git_diff_file *file = info->file;
477477

478478
if (info->src == GIT_ITERATOR_WORKDIR) {
479-
if ((error = git_buf_joinpath(
480-
&info->data, git_repository_workdir(info->repo), file->path)) < 0)
479+
if ((error = git_repository_workdir_path(
480+
&info->data, info->repo, file->path)) < 0)
481481
return error;
482482

483483
/* if path is not a regular file, just skip this item */

0 commit comments

Comments
 (0)