sync: Use git reset --hard --recurse-submodule
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d4a81aa660
commit
86748b36c8
@ -104,7 +104,7 @@ func (i GitImporter) Sync() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdreset := exec.Command("git", "-C", i.li.Base, "reset", "--hard", "origin/master")
|
cmdreset := exec.Command("git", "-C", i.li.Base, "reset", "--hard", "--recurse-submodule", "origin/master")
|
||||||
stdout, err = cmdreset.CombinedOutput()
|
stdout, err = cmdreset.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Local git repository reset failed: %s\n%s", err, stdout)
|
log.Printf("Local git repository reset failed: %s\n%s", err, stdout)
|
||||||
@ -113,20 +113,6 @@ func (i GitImporter) Sync() error {
|
|||||||
|
|
||||||
if _, err := os.Stat(path.Join(i.li.Base, ".gitmodules")); !errors.Is(err, os.ErrNotExist) {
|
if _, err := os.Stat(path.Join(i.li.Base, ".gitmodules")); !errors.Is(err, os.ErrNotExist) {
|
||||||
// Treat submodules
|
// Treat submodules
|
||||||
cmdsubreset := exec.Command("git", "-C", i.li.Base, "submodule", "foreach", "--recursive", "git", "reset", "--hard")
|
|
||||||
stdout, err = cmdsubreset.CombinedOutput()
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("Local git repository submodule reset failed: %s\n%s", err, stdout)
|
|
||||||
return fmt.Errorf("%w:\n%s", err, stdout)
|
|
||||||
}
|
|
||||||
|
|
||||||
cmdsubupdate := exec.Command("git", "-C", i.li.Base, "submodule", "update", "--init", "--recursive")
|
|
||||||
stdout, err = cmdsubupdate.CombinedOutput()
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("Local git repository submodule update failed: %s\n%s", err, stdout)
|
|
||||||
return fmt.Errorf("%w:\n%s", err, stdout)
|
|
||||||
}
|
|
||||||
|
|
||||||
cmdsublfs := exec.Command("git", "-C", i.li.Base, "submodule", "foreach", "--recursive", "git", "lfs", "pull")
|
cmdsublfs := exec.Command("git", "-C", i.li.Base, "submodule", "foreach", "--recursive", "git", "lfs", "pull")
|
||||||
stdout, err = cmdsublfs.CombinedOutput()
|
stdout, err = cmdsublfs.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user