aboutsummaryrefslogtreecommitdiff
path: root/lib/git/git_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-01-11 18:43:56 +0700
committerShulhan <ms@kilabit.info>2026-01-11 21:29:17 +0700
commitcdfebe3f55dc53872079a96a9a5dd6970bc2980e (patch)
tree271827433390beb3172f5058505abc21be281df7 /lib/git/git_test.go
parent34693c1b7ab126e1fbda3810eb46b735c350505c (diff)
downloadpakakeh.go-cdfebe3f55dc53872079a96a9a5dd6970bc2980e.tar.xz
lib/git: fix ignore pattern with single wildcard '*'
Single wildcard should ignore everything inside it.
Diffstat (limited to 'lib/git/git_test.go')
-rw-r--r--lib/git/git_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/git/git_test.go b/lib/git/git_test.go
index 65fe572d..2ea5aba4 100644
--- a/lib/git/git_test.go
+++ b/lib/git/git_test.go
@@ -163,6 +163,37 @@ func TestGit_Equal(t *testing.T) {
}
}
+func TestGit_IsIgnored(t *testing.T) {
+ agit, err := New(`testdata/IsIgnored/`)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ listCase := []struct {
+ path string
+ exp bool
+ }{{
+ path: `a/b/c/c1`,
+ exp: true,
+ }, {
+ path: `a/b/c`,
+ exp: true,
+ }, {
+ path: `a/b/b1`,
+ exp: true,
+ }, {
+ path: `a/b/.gitignore`,
+ }, {
+ path: `a/b`,
+ }, {
+ path: `a`,
+ }}
+ for _, tc := range listCase {
+ got := agit.IsIgnored(tc.path)
+ test.Assert(t, tc.path, tc.exp, got)
+ }
+}
+
func TestGetRemoteURL(t *testing.T) {
cases := []struct {
desc string