#2442·go-git

Support exclude pathspecs (`:(exclude)` / `:!`)

Author: pjbgfCreated Sep 30, 2026Updated Sep 30, 2026
Labelsgood first issuehelp wanted

go-git has no equivalent of git's negative pathspec magic. LogOptions.PathSpecs is a []*regexp.Regexp matched positively only, internal/archive.MatchesPathFilter is positive prefix/glob matching, and Worktree.Excludes is a []gitignore.Pattern, that's the gitignore mechanism, a separate thing from git log -- . ':(exclude)vendor'. Callers who want "everything under here except that" have to filter the results themselves, which means we still pay to walk and diff the excluded paths.

If we implement this, t/t6132-pathspec-exclude.sh upstream is a good source of test cases.