Skip to content

Commit b6449de

Browse files
author
Edward Thomson
authored
Merge pull request libgit2#6075 from libgit2/ethomson/attr_longpaths
2 parents 853ba20 + 46508fe commit b6449de

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

src/attr.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int git_attr_get_ext(
6868
if (git_repository_is_bare(repo))
6969
dir_flag = GIT_DIR_FLAG_FALSE;
7070

71-
if (git_attr_path__init(&path, repo, pathname, git_repository_workdir(repo), dir_flag) < 0)
71+
if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), dir_flag) < 0)
7272
return -1;
7373

7474
if ((error = collect_attr_files(repo, NULL, opts, pathname, &files)) < 0)
@@ -149,7 +149,7 @@ int git_attr_get_many_with_session(
149149
if (git_repository_is_bare(repo))
150150
dir_flag = GIT_DIR_FLAG_FALSE;
151151

152-
if (git_attr_path__init(&path, repo, pathname, git_repository_workdir(repo), dir_flag) < 0)
152+
if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), dir_flag) < 0)
153153
return -1;
154154

155155
if ((error = collect_attr_files(repo, attr_session, opts, pathname, &files)) < 0)
@@ -264,7 +264,7 @@ int git_attr_foreach_ext(
264264
if (git_repository_is_bare(repo))
265265
dir_flag = GIT_DIR_FLAG_FALSE;
266266

267-
if (git_attr_path__init(&path, repo, pathname, git_repository_workdir(repo), dir_flag) < 0)
267+
if (git_attr_path__init(&path, pathname, git_repository_workdir(repo), dir_flag) < 0)
268268
return -1;
269269

270270
if ((error = collect_attr_files(repo, NULL, opts, pathname, &files)) < 0 ||

src/attr_file.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ git_attr_assignment *git_attr_rule__lookup_assignment(
551551

552552
int git_attr_path__init(
553553
git_attr_path *info,
554-
git_repository *repo,
555554
const char *path,
556555
const char *base,
557556
git_dir_flag dir_flag)
@@ -561,8 +560,7 @@ int git_attr_path__init(
561560
/* build full path as best we can */
562561
git_buf_init(&info->full, 0);
563562

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

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

src/attr_file.h

-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ typedef enum { GIT_DIR_FLAG_TRUE = 1, GIT_DIR_FLAG_FALSE = 0, GIT_DIR_FLAG_UNKNO
227227

228228
extern int git_attr_path__init(
229229
git_attr_path *out,
230-
git_repository *repo,
231230
const char *path,
232231
const char *base,
233232
git_dir_flag is_dir);

src/ignore.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ int git_ignore__lookup(
468468
*out = GIT_IGNORE_NOTFOUND;
469469

470470
if (git_attr_path__init(
471-
&path, ignores->repo, pathname, git_repository_workdir(ignores->repo), dir_flag) < 0)
471+
&path, pathname, git_repository_workdir(ignores->repo), dir_flag) < 0)
472472
return -1;
473473

474474
/* first process builtins - success means path was found */
@@ -552,7 +552,7 @@ int git_ignore_path_is_ignored(
552552
else if (git_repository_is_bare(repo))
553553
dir_flag = GIT_DIR_FLAG_FALSE;
554554

555-
if ((error = git_attr_path__init(&path, repo, pathname, workdir, dir_flag)) < 0 ||
555+
if ((error = git_attr_path__init(&path, pathname, workdir, dir_flag)) < 0 ||
556556
(error = git_ignore__for_path(repo, path.path, &ignores)) < 0)
557557
goto cleanup;
558558

tests/attr/lookup.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void test_attr_lookup__simple(void)
1313
cl_assert_equal_s(cl_fixture("attr/attr0"), file->entry->path);
1414
cl_assert(file->rules.length == 1);
1515

16-
cl_git_pass(git_attr_path__init(&path, NULL, "test", NULL, GIT_DIR_FLAG_UNKNOWN));
16+
cl_git_pass(git_attr_path__init(&path, "test", NULL, GIT_DIR_FLAG_UNKNOWN));
1717
cl_assert_equal_s("test", path.path);
1818
cl_assert_equal_s("test", path.basename);
1919
cl_assert(!path.is_dir);
@@ -36,7 +36,7 @@ static void run_test_cases(git_attr_file *file, struct attr_expected *cases, int
3636
int error;
3737

3838
for (c = cases; c->path != NULL; c++) {
39-
cl_git_pass(git_attr_path__init(&path, NULL, c->path, NULL, GIT_DIR_FLAG_UNKNOWN));
39+
cl_git_pass(git_attr_path__init(&path, c->path, NULL, GIT_DIR_FLAG_UNKNOWN));
4040

4141
if (force_dir)
4242
path.is_dir = 1;
@@ -133,7 +133,7 @@ void test_attr_lookup__match_variants(void)
133133
cl_assert_equal_s(cl_fixture("attr/attr1"), file->entry->path);
134134
cl_assert(file->rules.length == 10);
135135

136-
cl_git_pass(git_attr_path__init(&path, NULL, "/testing/for/pat0", NULL, GIT_DIR_FLAG_UNKNOWN));
136+
cl_git_pass(git_attr_path__init(&path, "/testing/for/pat0", NULL, GIT_DIR_FLAG_UNKNOWN));
137137
cl_assert_equal_s("pat0", path.basename);
138138

139139
run_test_cases(file, cases, 0);

0 commit comments

Comments
 (0)