aboutsummaryrefslogtreecommitdiff
path: root/lib/git/testdata
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2026-01-02 00:40:21 +0700
committerShulhan <ms@kilabit.info>2026-01-06 14:56:07 +0700
commit18be916ab6f8911fd23d8f0a91f5a26f3c07f636 (patch)
treeac6d36924c851e81cd539c4b7b3ee0d307c5df74 /lib/git/testdata
parent988ff4596d6fb600d0c94aeed41b5b17f1677032 (diff)
downloadpakakeh.go-18be916ab6f8911fd23d8f0a91f5a26f3c07f636.tar.xz
lib/git: add Git type with method IsIgnored
The Git type is for working with single git repository. The [Git.IsIgnored] method is to check if the `path` is ignored by git. This is processed by matching it with all of the pattern in the ".gitignore" file from the path directory and its parent until the root of Git repository.
Diffstat (limited to 'lib/git/testdata')
-rw-r--r--lib/git/testdata/IsIgnored/.gitignore8
-rw-r--r--lib/git/testdata/IsIgnored/foo/hello.go4
-rw-r--r--lib/git/testdata/IsIgnored/vendor/empty2
-rw-r--r--lib/git/testdata/New/fail_no_git/.gitignore2
4 files changed, 16 insertions, 0 deletions
diff --git a/lib/git/testdata/IsIgnored/.gitignore b/lib/git/testdata/IsIgnored/.gitignore
new file mode 100644
index 00000000..15989de8
--- /dev/null
+++ b/lib/git/testdata/IsIgnored/.gitignore
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>
+
+# comment
+ # comment
+ vendor/ # ignore vendor directory, but not vendor file.
+/hello.* # ignore hello at root, but not foo/hello.go.
+!hello.go
diff --git a/lib/git/testdata/IsIgnored/foo/hello.go b/lib/git/testdata/IsIgnored/foo/hello.go
new file mode 100644
index 00000000..b61e7105
--- /dev/null
+++ b/lib/git/testdata/IsIgnored/foo/hello.go
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: BSD-3-Clause
+// SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>
+
+package foo
diff --git a/lib/git/testdata/IsIgnored/vendor/empty b/lib/git/testdata/IsIgnored/vendor/empty
new file mode 100644
index 00000000..62f13a9e
--- /dev/null
+++ b/lib/git/testdata/IsIgnored/vendor/empty
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: BSD-3-Clause
+// SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>
diff --git a/lib/git/testdata/New/fail_no_git/.gitignore b/lib/git/testdata/New/fail_no_git/.gitignore
new file mode 100644
index 00000000..62f13a9e
--- /dev/null
+++ b/lib/git/testdata/New/fail_no_git/.gitignore
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: BSD-3-Clause
+// SPDX-FileCopyrightText: 2025 M. Shulhan <ms@kilabit.info>