diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-04-04 10:44:29 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-04-28 13:03:34 +0100 |
commit | 91156a0f2ebfd5bc674d5825c45bce0efb225754 (patch) | |
tree | 37a11ce875d92bf9c8006de069f9e9d274ab6dff | |
parent | 578aeba97502df26a47255618baa27976bdd0d7f (diff) | |
download | libgit2-91156a0f2ebfd5bc674d5825c45bce0efb225754.tar.gz |
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.
-rw-r--r-- | src/diff_file.c | 3 | ||||
-rw-r--r-- | src/diff_generate.c | 3 | ||||
-rw-r--r-- | src/diff_tform.c | 4 |
3 files changed, 4 insertions, 6 deletions
diff --git a/src/diff_file.c b/src/diff_file.c index 015e0706b..2116f0021 100644 --- a/src/diff_file.c +++ b/src/diff_file.c @@ -394,8 +394,7 @@ static int diff_file_content_load_workdir( if (fc->file->mode == GIT_FILEMODE_TREE) return 0; - if (git_buf_joinpath( - &path, git_repository_workdir(fc->repo), fc->file->path) < 0) + if (git_repository_workdir_path(&path, fc->repo, fc->file->path) < 0) return -1; if (S_ISLNK(fc->file->mode)) diff --git a/src/diff_generate.c b/src/diff_generate.c index f05ae3713..aba9e52ba 100644 --- a/src/diff_generate.c +++ b/src/diff_generate.c @@ -596,8 +596,7 @@ int git_diff__oid_for_entry( memset(out, 0, sizeof(*out)); - if (git_buf_joinpath(&full_path, - git_repository_workdir(diff->base.repo), entry.path) < 0) + if (git_repository_workdir_path(&full_path, diff->base.repo, entry.path) < 0) return -1; if (!mode) { diff --git a/src/diff_tform.c b/src/diff_tform.c index 03fc2b0a6..409142081 100644 --- a/src/diff_tform.c +++ b/src/diff_tform.c @@ -476,8 +476,8 @@ static int similarity_sig( git_diff_file *file = info->file; if (info->src == GIT_ITERATOR_WORKDIR) { - if ((error = git_buf_joinpath( - &info->data, git_repository_workdir(info->repo), file->path)) < 0) + if ((error = git_repository_workdir_path( + &info->data, info->repo, file->path)) < 0) return error; /* if path is not a regular file, just skip this item */ |