diff options
author | Paulo Gomes <pjbgf@linux.com> | 2024-06-07 16:52:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-07 16:52:18 +0100 |
commit | dec5c8ade2def9ddb30972ddb7c58839e6bca06c (patch) | |
tree | d38367ec90d1df96516b1093bd4147a9a697f28b /plumbing/format | |
parent | fbcecb56c61180013aedc7b6d9beece8b45b7d71 (diff) | |
parent | ea3cfc94f9846f493e22d387eb22a135eb972807 (diff) | |
download | go-git-dec5c8ade2def9ddb30972ddb7c58839e6bca06c.tar.gz |
Merge pull request #1056 from pjbgf/fix-symlink
Bumps Go versions and go-billy
Diffstat (limited to 'plumbing/format')
-rw-r--r-- | plumbing/format/gitattributes/dir.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/plumbing/format/gitattributes/dir.go b/plumbing/format/gitattributes/dir.go index d3b0dbe..4238196 100644 --- a/plumbing/format/gitattributes/dir.go +++ b/plumbing/format/gitattributes/dir.go @@ -2,6 +2,8 @@ package gitattributes import ( "os" + "path/filepath" + "strings" "github.com/go-git/go-billy/v5" @@ -59,7 +61,14 @@ func walkDirectory(fs billy.Filesystem, root []string) (attributes []MatchAttrib continue } - path := append(root, fi.Name()) + p := fi.Name() + + // Handles the case whereby just the volume name ("C:") is appended, + // to root. Change it to "C:\", which is better handled by fs.Join(). + if filepath.VolumeName(p) != "" && !strings.HasSuffix(p, string(filepath.Separator)) { + p = p + string(filepath.Separator) + } + path := append(root, p) dirAttributes, err := ReadAttributesFile(fs, path, gitattributesFile, false) if err != nil { |