Skip to content

Commit a2ba292

Browse files
committed
fix: resolve submodule path to name on checkout
1 parent 63343bf commit a2ba292

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

worktree.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -663,14 +663,20 @@ func (w *Worktree) checkoutChangeSubmodule(name string,
663663
) error {
664664
switch a {
665665
case merkletrie.Modify:
666-
sub, err := w.Submodule(name)
666+
subs, err := w.Submodules()
667667
if err != nil {
668668
return err
669669
}
670-
671-
if !sub.initialized {
672-
return nil
670+
for _, sub := range subs {
671+
if sub.Config().Path == name {
672+
if !sub.initialized {
673+
return nil
674+
}
675+
goto found
676+
}
673677
}
678+
return ErrSubmoduleNotFound
679+
found:
674680

675681
return w.addIndexFromTreeEntry(name, e, idx)
676682
case merkletrie.Insert:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy