aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format
diff options
context:
space:
mode:
authorPaulo Gomes <pjbgf@linux.com>2024-06-07 16:52:18 +0100
committerGitHub <noreply@github.com>2024-06-07 16:52:18 +0100
commitdec5c8ade2def9ddb30972ddb7c58839e6bca06c (patch)
treed38367ec90d1df96516b1093bd4147a9a697f28b /plumbing/format
parentfbcecb56c61180013aedc7b6d9beece8b45b7d71 (diff)
parentea3cfc94f9846f493e22d387eb22a135eb972807 (diff)
downloadgo-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.go11
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 {