Skip to content

Commit 7bf90de

Browse files
committed
fix: checkout submodule with custom name
1 parent b2aea86 commit 7bf90de

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

worktree.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -663,16 +663,19 @@ 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+
return w.addIndexFromTreeEntry(name, e, idx)
676+
}
673677
}
674-
675-
return w.addIndexFromTreeEntry(name, e, idx)
678+
return ErrSubmoduleNotFound
676679
case merkletrie.Insert:
677680
mode, err := e.Mode.ToOSFileMode()
678681
if err != nil {

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