sync: Try to handle new submodules on pull
This commit is contained in:
parent
5b102ad8ea
commit
edc5c25a29
@ -122,6 +122,28 @@ func (i GitImporter) Sync() error {
|
|||||||
log.Printf("Local git repository submodules clean failed: %s\n%s", err, stdout)
|
log.Printf("Local git repository submodules clean failed: %s\n%s", err, stdout)
|
||||||
return fmt.Errorf("%w:\n%s", err, stdout)
|
return fmt.Errorf("%w:\n%s", err, stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start by a light hard reset (without submodules, in order to init new ones)
|
||||||
|
cmdreset := exec.Command("git", "-C", i.li.Base, "reset", "--hard", "origin/"+i.Branch)
|
||||||
|
stdout, err = cmdreset.CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Local git repository reset failed: %s\n%s", err, stdout)
|
||||||
|
return fmt.Errorf("%w:\n%s", err, stdout)
|
||||||
|
}
|
||||||
|
|
||||||
|
cmdsubinit := exec.Command("git", "-C", i.li.Base, "submodule", "init")
|
||||||
|
stdout, err = cmdsubinit.CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Local git repository submodule init failed: %s\n%s", err, stdout)
|
||||||
|
return fmt.Errorf("%w:\n%s", err, stdout)
|
||||||
|
}
|
||||||
|
|
||||||
|
cmdsubupdate := exec.Command("git", "-C", i.li.Base, "submodule", "update")
|
||||||
|
stdout, err = cmdsubupdate.CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Local git repository submodule init failed: %s\n%s", err, stdout)
|
||||||
|
return fmt.Errorf("%w:\n%s", err, stdout)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdreset := exec.Command("git", "-C", i.li.Base, "reset", "--hard", "--recurse-submodule", "origin/"+i.Branch)
|
cmdreset := exec.Command("git", "-C", i.li.Base, "reset", "--hard", "--recurse-submodule", "origin/"+i.Branch)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user