summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-09-24 16:07:17 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2021-09-25 14:39:01 +0100
commit3d8749d323380d47aad7afaa64bf0999dd3992b3 (patch)
treefc332e0b3e749611047b3ddf058bcab74770f231
parent848bd0098a0dfa2c0502691bf76d3dbb0a00526d (diff)
downloadlibgit2-3d8749d323380d47aad7afaa64bf0999dd3992b3.tar.gz
checkout: always provide a path for attribute lookup
Always pass a working-directory relative path to attribute lookups during checkout.
-rw-r--r--src/checkout.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/checkout.c b/src/checkout.c
index 713159152..3a171066b 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -1520,8 +1520,7 @@ static int blob_content_to_file(
int fd;
int error = 0;
- if (hint_path == NULL)
- hint_path = path;
+ GIT_ASSERT(hint_path != NULL);
if ((error = mkpath2file(data, path, data->opts.dir_mode)) < 0)
return error;
@@ -1789,7 +1788,7 @@ static int checkout_blob(
}
error = checkout_write_content(
- data, &file->id, fullpath->ptr, NULL, file->mode, &st);
+ data, &file->id, fullpath->ptr, file->path, file->mode, &st);
/* update the index unless prevented */
if (!error && (data->strategy & GIT_CHECKOUT_DONT_UPDATE_INDEX) == 0)
@@ -1975,7 +1974,7 @@ static int checkout_write_entry(
checkout_conflictdata *conflict,
const git_index_entry *side)
{
- const char *hint_path = NULL, *suffix;
+ const char *hint_path, *suffix;
git_buf *fullpath;
struct stat st;
int error;
@@ -1998,10 +1997,10 @@ static int checkout_write_entry(
if (checkout_path_suffixed(fullpath, suffix) < 0)
return -1;
-
- hint_path = side->path;
}
+ hint_path = side->path;
+
if ((data->strategy & GIT_CHECKOUT_UPDATE_ONLY) != 0 &&
(error = checkout_safe_for_update_only(data, fullpath->ptr, side->mode)) <= 0)
return error;
@@ -2118,7 +2117,7 @@ static int checkout_write_merge(
filter_session.temp_buf = &data->tmp;
if ((error = git_filter_list__load(
- &fl, data->repo, NULL, git_buf_cstr(&path_workdir),
+ &fl, data->repo, NULL, result.path,
GIT_FILTER_TO_WORKTREE, &filter_session)) < 0 ||
(error = git_filter_list__convert_buf(&out_data, fl, &in_data)) < 0)
goto done;