Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bb15632

Browse filesBrowse files
committed
plumbing: transport, fsLoader: avoid mutation of Endpoint.Path
1 parent 4ded117 commit bb15632
Copy full SHA for bb15632

File tree

Expand file treeCollapse file tree

1 file changed

+7
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-6
lines changed

‎plumbing/transport/loader.go

Copy file name to clipboardExpand all lines: plumbing/transport/loader.go
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,24 @@ func NewFilesystemLoader(base billy.Filesystem, strict bool) Loader {
4141
// storer for it. Returns transport.ErrRepositoryNotFound if a repository does
4242
// not exist in the given path.
4343
func (l *FilesystemLoader) Load(ep *Endpoint) (storage.Storer, error) {
44-
return l.load(ep, false)
44+
return l.load(ep.Path, false)
4545
}
4646

47-
func (l *FilesystemLoader) load(ep *Endpoint, tried bool) (storage.Storer, error) {
48-
fs, err := l.base.Chroot(ep.Path)
47+
func (l *FilesystemLoader) load(path string, tried bool) (storage.Storer, error) {
48+
fs, err := l.base.Chroot(path)
4949
if err != nil {
5050
return nil, err
5151
}
5252

5353
if _, err := fs.Stat("config"); err != nil {
5454
if !l.strict && !tried {
55+
tried = true
5556
if fi, err := fs.Stat(".git"); err == nil && fi.IsDir() {
56-
ep.Path = filepath.Join(ep.Path, ".git")
57+
path = filepath.Join(path, ".git")
5758
} else {
58-
ep.Path = ep.Path + ".git"
59+
path = path + ".git"
5960
}
60-
return l.load(ep, true)
61+
return l.load(path, tried)
6162
}
6263
return nil, ErrRepositoryNotFound
6364
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.