| 1 | package mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/ |
| 2 | |
| 3 | import ( |
| 4 | "errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 6 | "ioscip-go gomod github.com/golang/go/src go1.25.0 io/" |
| 7 | "io/fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/" |
| 8 | "osscip-go gomod github.com/golang/go/src go1.25.0 os/" |
| 9 | "path/filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/" |
| 10 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 11 | |
| 12 | "github.com/go-git/go-billy/v6scip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/" |
| 13 | "github.com/go-git/go-billy/v6/helper/polyfillscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/polyfill`/" |
| 14 | ) |
| 15 | |
| 16 | var separatorscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/separator. = string(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Separatorscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Separator.) |
| 17 | |
| 18 | // Mount is a helper that allows to emulate the behavior of mount in memory. |
| 19 | // Very useful to create a temporal dir, on filesystem where is a performance |
| 20 | // penalty in doing so. |
| 21 | type Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount# struct { |
| 22 | underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#underlying. billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filesystemscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Filesystem# |
| 23 | sourcescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#source. billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filesystemscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Filesystem# |
| 24 | mountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mountpoint. string |
| 25 | } |
| 26 | |
| 27 | // New creates a new filesystem wrapping up 'fs' the intercepts all the calls |
| 28 | // made to `mountpoint` path and redirecting it to `source` filesystem. |
| 29 | func Newscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/New().(fs billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Basicscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#, mountpoint string, source billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Basicscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#) *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount# { |
| 30 | return &Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#{ |
| 31 | underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#underlying.: polyfillscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/polyfill`/.Newscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/polyfill`/New().(fs), |
| 32 | sourcescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#source.: polyfillscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/polyfill`/.Newscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/polyfill`/New().(source), |
| 33 | mountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mountpoint.: cleanPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/cleanPath().(mountpoint), |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) Createscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#Create().(path string) (billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/File#, error) { |
| 38 | fs, fullpath := h.getBasicAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getBasicAndPath().(path) |
| 39 | if fullpath == "." { |
| 40 | return nil, osscip-go gomod github.com/golang/go/src go1.25.0 os/.ErrInvalidscip-go gomod github.com/golang/go/src go1.25.0 os/ErrInvalid. |
| 41 | } |
| 42 | |
| 43 | f, err := fs.Createscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Create.(fullpath) |
| 44 | return wrapFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/wrapFile().(f, path), err |
| 45 | } |
| 46 | |
| 47 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) Openscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#Open().(path string) (billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/File#, error) { |
| 48 | fs, fullpath := h.getBasicAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getBasicAndPath().(path) |
| 49 | if fullpath == "." { |
| 50 | return nil, osscip-go gomod github.com/golang/go/src go1.25.0 os/.ErrInvalidscip-go gomod github.com/golang/go/src go1.25.0 os/ErrInvalid. |
| 51 | } |
| 52 | |
| 53 | f, err := fs.Openscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Open.(fullpath) |
| 54 | return wrapFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/wrapFile().(f, path), err |
| 55 | } |
| 56 | |
| 57 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) OpenFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#OpenFile().(path string, flag int, mode fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.FileModescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileMode#) (billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/File#, error) { |
| 58 | fs, fullpath := h.getBasicAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getBasicAndPath().(path) |
| 59 | if fullpath == "." { |
| 60 | return nil, osscip-go gomod github.com/golang/go/src go1.25.0 os/.ErrInvalidscip-go gomod github.com/golang/go/src go1.25.0 os/ErrInvalid. |
| 61 | } |
| 62 | |
| 63 | f, err := fs.OpenFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#OpenFile.(fullpath, flag, mode) |
| 64 | return wrapFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/wrapFile().(f, path), err |
| 65 | } |
| 66 | |
| 67 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) Renamescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#Rename().(from, to string) error { |
| 68 | fromInSource := h.isMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#isMountpoint().(from) |
| 69 | toInSource := h.isMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#isMountpoint().(to) |
| 70 | |
| 71 | var fromFS, toFS billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Basicscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic# |
| 72 | |
| 73 | switch { |
| 74 | case fromInSource && toInSource: |
| 75 | from = h.mustRelToMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mustRelToMountpoint().(from) |
| 76 | to = h.mustRelToMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mustRelToMountpoint().(to) |
| 77 | return h.sourcescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#source..Renamescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Rename.(from, to) |
| 78 | case !fromInSource && !toInSource: |
| 79 | return h.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#underlying..Renamescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Rename.(from, to) |
| 80 | case fromInSource && !toInSource: |
| 81 | fromFS = h.sourcescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#source. |
| 82 | from = h.mustRelToMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mustRelToMountpoint().(from) |
| 83 | toFS = h.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#underlying. |
| 84 | to = cleanPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/cleanPath().(to) |
| 85 | case !fromInSource && toInSource: |
| 86 | fromFS = h.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#underlying. |
| 87 | from = cleanPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/cleanPath().(from) |
| 88 | toFS = h.sourcescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#source. |
| 89 | to = h.mustRelToMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mustRelToMountpoint().(to) |
| 90 | } |
| 91 | |
| 92 | if err := copyPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/copyPath().(fromFS, toFS, from, to); err != nil { |
| 93 | return err |
| 94 | } |
| 95 | |
| 96 | return fromFS.Removescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Remove.(from) |
| 97 | } |
| 98 | |
| 99 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) Statscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#Stat().(path string) (osscip-go gomod github.com/golang/go/src go1.25.0 os/.FileInfoscip-go gomod github.com/golang/go/src go1.25.0 os/FileInfo#, error) { |
| 100 | fs, fullpath := h.getBasicAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getBasicAndPath().(path) |
| 101 | return fs.Statscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Stat.(fullpath) |
| 102 | } |
| 103 | |
| 104 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) Removescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#Remove().(path string) error { |
| 105 | fs, fullpath := h.getBasicAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getBasicAndPath().(path) |
| 106 | if fullpath == "." { |
| 107 | return osscip-go gomod github.com/golang/go/src go1.25.0 os/.ErrInvalidscip-go gomod github.com/golang/go/src go1.25.0 os/ErrInvalid. |
| 108 | } |
| 109 | |
| 110 | return fs.Removescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Remove.(fullpath) |
| 111 | } |
| 112 | |
| 113 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) ReadDirscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#ReadDir().(path string) ([]fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.DirEntryscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/DirEntry#, error) { |
| 114 | fs, fullpath, err := h.getDirAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getDirAndPath().(path) |
| 115 | if err != nil { |
| 116 | return nil, err |
| 117 | } |
| 118 | |
| 119 | return fs.ReadDirscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Dir#ReadDir.(fullpath) |
| 120 | } |
| 121 | |
| 122 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) MkdirAllscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#MkdirAll().(filename string, perm fsscip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/.FileModescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/FileMode#) error { |
| 123 | fs, fullpath, err := h.getDirAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getDirAndPath().(filename) |
| 124 | if err != nil { |
| 125 | return err |
| 126 | } |
| 127 | |
| 128 | return fs.MkdirAllscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Dir#MkdirAll.(fullpath, perm) |
| 129 | } |
| 130 | |
| 131 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#Symlink().(target, link string) error { |
| 132 | fs, fullpath, err := h.getSymlinkAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getSymlinkAndPath().(link) |
| 133 | if err != nil { |
| 134 | return err |
| 135 | } |
| 136 | |
| 137 | resolved := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Join().(filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Dir().(link), target) |
| 138 | if h.isMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#isMountpoint().(resolved) != h.isMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#isMountpoint().(link) { |
| 139 | return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("invalid symlink, target is crossing filesystems") |
| 140 | } |
| 141 | |
| 142 | return fs.Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#Symlink.(target, fullpath) |
| 143 | } |
| 144 | |
| 145 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#Join().(elem ...string) string { |
| 146 | return h.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#underlying..Joinscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Join.(elem...) |
| 147 | } |
| 148 | |
| 149 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) Readlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#Readlink().(link string) (string, error) { |
| 150 | fs, fullpath, err := h.getSymlinkAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getSymlinkAndPath().(link) |
| 151 | if err != nil { |
| 152 | return "", err |
| 153 | } |
| 154 | |
| 155 | return fs.Readlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#Readlink.(fullpath) |
| 156 | } |
| 157 | |
| 158 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) Lstatscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#Lstat().(path string) (osscip-go gomod github.com/golang/go/src go1.25.0 os/.FileInfoscip-go gomod github.com/golang/go/src go1.25.0 os/FileInfo#, error) { |
| 159 | fs, fullpath, err := h.getSymlinkAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getSymlinkAndPath().(path) |
| 160 | if err != nil { |
| 161 | return nil, err |
| 162 | } |
| 163 | |
| 164 | return fs.Lstatscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#Lstat.(fullpath) |
| 165 | } |
| 166 | |
| 167 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) Underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#Underlying().() billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Basicscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic# { |
| 168 | return h.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#underlying. |
| 169 | } |
| 170 | |
| 171 | // Capabilities implements the Capable interface. |
| 172 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) Capabilitiesscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#Capabilities().() billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Capabilityscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Capability# { |
| 173 | return billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Capabilitiesscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Capabilities().(h.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#underlying.) & billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Capabilitiesscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Capabilities().(h.sourcescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#source.) |
| 174 | } |
| 175 | |
| 176 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) getBasicAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getBasicAndPath().(path string) (billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Basicscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#, string) { |
| 177 | path = cleanPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/cleanPath().(path) |
| 178 | if !h.isMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#isMountpoint().(path) { |
| 179 | return h.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#underlying., path |
| 180 | } |
| 181 | |
| 182 | return h.sourcescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#source., h.mustRelToMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mustRelToMountpoint().(path) |
| 183 | } |
| 184 | |
| 185 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) getDirAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getDirAndPath().(path string) (billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Dirscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Dir#, string, error) { |
| 186 | path = cleanPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/cleanPath().(path) |
| 187 | if !h.isMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#isMountpoint().(path) { |
| 188 | d, ok := h.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#underlying..(billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Dirscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Dir#) |
| 189 | if !ok { |
| 190 | return nil, "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("underlying fs does not implement billy.Dir") |
| 191 | } |
| 192 | return d, path, nil |
| 193 | } |
| 194 | |
| 195 | d, ok := h.sourcescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#source..(billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Dirscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Dir#) |
| 196 | if !ok { |
| 197 | return nil, "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("source fs does not implement billy.Dir") |
| 198 | } |
| 199 | return d, h.mustRelToMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mustRelToMountpoint().(path), nil |
| 200 | } |
| 201 | |
| 202 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) getSymlinkAndPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#getSymlinkAndPath().(path string) (billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#, string, error) { |
| 203 | path = cleanPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/cleanPath().(path) |
| 204 | if !h.isMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#isMountpoint().(path) { |
| 205 | sl, ok := h.underlyingscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#underlying..(billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#) |
| 206 | if !ok { |
| 207 | return nil, "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("underlying fs does not implement billy.Symlink") |
| 208 | } |
| 209 | |
| 210 | return sl, path, nil |
| 211 | } |
| 212 | |
| 213 | sl, ok := h.sourcescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#source..(billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Symlinkscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Symlink#) |
| 214 | if !ok { |
| 215 | return nil, "", errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("source fs does not implement billy.Symlink") |
| 216 | } |
| 217 | |
| 218 | return sl, h.mustRelToMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mustRelToMountpoint().(path), nil |
| 219 | } |
| 220 | |
| 221 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) mustRelToMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mustRelToMountpoint().(path string) string { |
| 222 | path = cleanPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/cleanPath().(path) |
| 223 | fullpath, err := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Relscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Rel().(h.mountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mountpoint., path) |
| 224 | if err != nil { |
| 225 | panic(err) |
| 226 | } |
| 227 | |
| 228 | return fullpath |
| 229 | } |
| 230 | |
| 231 | func (h *Mountscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#) isMountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#isMountpoint().(path string) bool { |
| 232 | path = cleanPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/cleanPath().(path) |
| 233 | return path == h.mountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mountpoint. || stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.25.0 strings/HasPrefix().(path, h.mountpointscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/Mount#mountpoint.+separatorscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/separator.) |
| 234 | } |
| 235 | |
| 236 | func cleanPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/cleanPath().(path string) string { |
| 237 | path = filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.FromSlashscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/FromSlash().(path) |
| 238 | rel, err := filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Relscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Rel().(separatorscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/separator., path) |
| 239 | if err == nil { |
| 240 | path = rel |
| 241 | } |
| 242 | |
| 243 | return filepathscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/.Cleanscip-go gomod github.com/golang/go/src go1.25.0 `path/filepath`/Clean().(path) |
| 244 | } |
| 245 | |
| 246 | // copyPath copies a file across filesystems. |
| 247 | func copyPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/copyPath().(src, dst billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Basicscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#, srcPath, dstPath string) error { |
| 248 | dstFile, err := dst.Createscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Create.(dstPath) |
| 249 | if err != nil { |
| 250 | return err |
| 251 | } |
| 252 | |
| 253 | srcFile, err := src.Openscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/Basic#Open.(srcPath) |
| 254 | if err != nil { |
| 255 | return err |
| 256 | } |
| 257 | |
| 258 | _, err = ioscip-go gomod github.com/golang/go/src go1.25.0 io/.Copyscip-go gomod github.com/golang/go/src go1.25.0 io/Copy().(dstFile, srcFile) |
| 259 | if err != nil { |
| 260 | return err |
| 261 | } |
| 262 | |
| 263 | err = dstFile.Closescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/File#Close().() |
| 264 | if err != nil { |
| 265 | _ = srcFile.Closescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/File#Close().() |
| 266 | return err |
| 267 | } |
| 268 | |
| 269 | return srcFile.Closescip-go gomod github.com/golang/go/src go1.25.0 `io/fs`/File#Close().() |
| 270 | } |
| 271 | |
| 272 | type filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/file# struct { |
| 273 | billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/file#File. |
| 274 | namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/file#name. string |
| 275 | } |
| 276 | |
| 277 | func wrapFilescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/wrapFile().(f billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/File#, filename string) billyscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/.Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6`/File# { |
| 278 | if f == nil { |
| 279 | return nil |
| 280 | } |
| 281 | |
| 282 | return &filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/file#{ |
| 283 | Filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/file#File.: f, |
| 284 | namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/file#name.: cleanPathscip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/cleanPath().(filename), |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | func (f *filescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/file#) Namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/file#Name().() string { |
| 289 | return f.namescip-go gomod github.com/go-git/go-billy/v6 . `github.com/go-git/go-billy/v6/helper/mount`/file#name. |
| 290 | } |