Skip to content

Commit 3d8749d

Browse files
committed
checkout: always provide a path for attribute lookup
Always pass a working-directory relative path to attribute lookups during checkout.
1 parent 848bd00 commit 3d8749d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/checkout.c

+6-7
Original file line numberDiff line numberDiff line change
@@ -1520,8 +1520,7 @@ static int blob_content_to_file(
15201520
int fd;
15211521
int error = 0;
15221522

1523-
if (hint_path == NULL)
1524-
hint_path = path;
1523+
GIT_ASSERT(hint_path != NULL);
15251524

15261525
if ((error = mkpath2file(data, path, data->opts.dir_mode)) < 0)
15271526
return error;
@@ -1789,7 +1788,7 @@ static int checkout_blob(
17891788
}
17901789

17911790
error = checkout_write_content(
1792-
data, &file->id, fullpath->ptr, NULL, file->mode, &st);
1791+
data, &file->id, fullpath->ptr, file->path, file->mode, &st);
17931792

17941793
/* update the index unless prevented */
17951794
if (!error && (data->strategy & GIT_CHECKOUT_DONT_UPDATE_INDEX) == 0)
@@ -1975,7 +1974,7 @@ static int checkout_write_entry(
19751974
checkout_conflictdata *conflict,
19761975
const git_index_entry *side)
19771976
{
1978-
const char *hint_path = NULL, *suffix;
1977+
const char *hint_path, *suffix;
19791978
git_buf *fullpath;
19801979
struct stat st;
19811980
int error;
@@ -1998,10 +1997,10 @@ static int checkout_write_entry(
19981997

19991998
if (checkout_path_suffixed(fullpath, suffix) < 0)
20001999
return -1;
2001-
2002-
hint_path = side->path;
20032000
}
20042001

2002+
hint_path = side->path;
2003+
20052004
if ((data->strategy & GIT_CHECKOUT_UPDATE_ONLY) != 0 &&
20062005
(error = checkout_safe_for_update_only(data, fullpath->ptr, side->mode)) <= 0)
20072006
return error;
@@ -2118,7 +2117,7 @@ static int checkout_write_merge(
21182117
filter_session.temp_buf = &data->tmp;
21192118

21202119
if ((error = git_filter_list__load(
2121-
&fl, data->repo, NULL, git_buf_cstr(&path_workdir),
2120+
&fl, data->repo, NULL, result.path,
21222121
GIT_FILTER_TO_WORKTREE, &filter_session)) < 0 ||
21232122
(error = git_filter_list__convert_buf(&out_data, fl, &in_data)) < 0)
21242123
goto done;

0 commit comments

Comments
 (0)