diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2020-10-30 11:34:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-30 11:34:24 +0100 |
commit | e9c56de2575147bbd38576e94f6e677917d208be (patch) | |
tree | 93e5f22e678d9d417f89d8fe0d9b4d15a699a298 /worktree.go | |
parent | 15aedd2ff43c25e0d54d6b488114725a266c79d0 (diff) | |
parent | 81d429bc0f13d05770fa5a824202e07f6f80c001 (diff) | |
download | go-git-e9c56de2575147bbd38576e94f6e677917d208be.tar.gz |
Merge pull request #195 from adracus/fix.relative-submodules
Fix relative submodule resolution
Diffstat (limited to 'worktree.go')
-rw-r--r-- | worktree.go | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/worktree.go b/worktree.go index c79e715..1c89a02 100644 --- a/worktree.go +++ b/worktree.go @@ -720,31 +720,9 @@ func (w *Worktree) readGitmodulesFile() (*config.Modules, error) { return m, err } - w.resolveRelativeSubmodulePaths(m) - return m, nil } - -// resolveRelativeSubmodulePaths is to replace any relative submodule URL (../foobar.git) in .gitmodules -// to the accessible repository URL -func (w *Worktree) resolveRelativeSubmodulePaths(m *config.Modules) { - origin, err := w.r.Remotes() - // remote is not associated with this worktree. we don't need to process any futher more - if err != nil { - return - } - - parentURL := filepath.Dir(origin[0].c.URLs[0]) - - for i := range m.Submodules { - if strings.HasPrefix(m.Submodules[i].URL, "../") { - child := strings.Replace(m.Submodules[i].URL, "../", "", 1) - m.Submodules[i].URL = fmt.Sprintf("%s/%s", parentURL, child) - } - } -} - // Clean the worktree by removing untracked files. // An empty dir could be removed - this is what `git clean -f -d .` does. func (w *Worktree) Clean(opts *CleanOptions) error { |