-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Description
Reproduction steps
--- a/tests/libgit2/repo/pathspec.c
+++ b/tests/libgit2/repo/pathspec.c
@@ -383,3 +383,16 @@ void test_repo_pathspec__in_memory(void)
git_pathspec_free(ps);
}
+
+void test_repo_pathspec__foo(void)
+{
+ static char *strings[] = { "**/foo" };
+ git_strarray s = { strings, ARRAY_SIZE(strings) };
+ git_pathspec *ps;
+
+ cl_git_pass(git_pathspec_new(&ps, &s));
+
+ cl_assert(git_pathspec_matches_path(ps, 0, "foo"));
+
+ git_pathspec_free(ps);
+}Expected behavior
According to the git documentation:
A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo".
Actual behavior
git_pathspec_matches_path returns no matches
$ ./libgit2_tests -srepo::pathspec
Loaded 384 suites:
Started (test status codes: OK='.' FAILURE='F' SKIPPED='S')
..........F
1) Failure:
repo::pathspec::foo [/home/kip/Documents/libgit2/tests/libgit2/repo/pathspec.c:395]
Expression is not true: git_pathspec_matches_path(ps, 0, "foo")
Version of libgit2 (release number or SHA1)
Both 1.7.2 and latest main (0a6051c624fc3403e89a6a6679526126e587a401)
Operating system(s) tested
Linux (NixOS 24.05)
Metadata
Metadata
Assignees
Labels
No labels