aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/gitignore/pattern.go
diff options
context:
space:
mode:
authorArieh Schneier <15041913+AriehSchneier@users.noreply.github.com>2023-05-29 12:47:53 +1000
committerArieh Schneier <15041913+AriehSchneier@users.noreply.github.com>2023-05-29 12:47:53 +1000
commit80d5f724674280d81f9163d9a33de9ef0c72c61c (patch)
tree5d18b53d5a97d6a17fa5dc187ddb95d90fabd383 /plumbing/format/gitignore/pattern.go
parent44feb6c8221525c1cf10c51a82551a754b5d7031 (diff)
downloadgo-git-80d5f724674280d81f9163d9a33de9ef0c72c61c.tar.gz
plumbing: gitignore, fix incorrect parsing. Fixes #500
Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
Diffstat (limited to 'plumbing/format/gitignore/pattern.go')
-rw-r--r--plumbing/format/gitignore/pattern.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/plumbing/format/gitignore/pattern.go b/plumbing/format/gitignore/pattern.go
index 098cb50..450b3cd 100644
--- a/plumbing/format/gitignore/pattern.go
+++ b/plumbing/format/gitignore/pattern.go
@@ -39,6 +39,8 @@ type pattern struct {
// ParsePattern parses a gitignore pattern string into the Pattern structure.
func ParsePattern(p string, domain []string) Pattern {
+ // storing domain, copy it to ensure it isn't changed externally
+ domain = append([]string(nil), domain...)
res := pattern{domain: domain}
if strings.HasPrefix(p, inclusionPrefix) {