Skip to content

Commit f5a9f0a

Browse files
committed
attr_file: don't validate workdir paths in attr lookups
When looking up attributes for a file, we construct an absolute path to the queried file within the working directory so that we can accept both absolute paths and working directory relative paths. We then trim the leading working directory path to give us an in-repo path. Since we only want the in-repo path to look up attributes - and not to read it from disk - we don't need to validate its length.
1 parent 1369010 commit f5a9f0a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/attr_file.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,7 @@ int git_attr_path__init(
561561
/* build full path as best we can */
562562
git_buf_init(&info->full, 0);
563563

564-
if (git_path_join_unrooted(&info->full, path, base, &root) < 0 ||
565-
git_path_validate_workdir_buf(repo, &info->full) < 0)
564+
if (git_path_join_unrooted(&info->full, path, base, &root) < 0)
566565
return -1;
567566

568567
info->path = info->full.ptr + root;

0 commit comments

Comments
 (0)