aboutsummaryrefslogtreecommitdiff
path: root/lib/git/git.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.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.go')
-rw-r--r--lib/git/git.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/git/git.go b/lib/git/git.go
index 1fc5fde3..43a27bf5 100644
--- a/lib/git/git.go
+++ b/lib/git/git.go
@@ -244,15 +244,15 @@ func GetTag(repoDir, revision string) (tag string, err error) {
// ".gitignore" file inside the path directory and its parent, until the root
// of Git repository.
func (git *Git) IsIgnored(path string) (b bool) {
- path = strings.TrimSpace(path)
+ path = strings.TrimSpace(path) // a/b/b1
if path == `` {
return true
}
// Traverse each directory from bottom to the top of git directory to
// load ".gitignore" file and match it with path.
- var absPath = filepath.Join(git.absDir, path)
- var dirGitignore = filepath.Dir(absPath)
- var name = strings.TrimPrefix(absPath, dirGitignore)
+ var absPath = filepath.Join(git.absDir, path) // $git/a/b/b1
+ var dirGitignore = filepath.Dir(absPath) // $git/a/b/
+ var name = strings.TrimPrefix(absPath, dirGitignore) // b1
name = strings.TrimLeft(name, `/`)
for strings.HasPrefix(dirGitignore, git.absDir) {
var ign *Gitignore