summaryrefslogtreecommitdiff
path: root/reload.go
diff options
context:
space:
mode:
Diffstat (limited to 'reload.go')
-rw-r--r--reload.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/reload.go b/reload.go
index 60f3e7e..3ec5eca 100644
--- a/reload.go
+++ b/reload.go
@@ -21,6 +21,15 @@ func (repo *Repo) ReloadCheck() error {
// TODO: clean this up more, but it is working now more or less
func (repo *Repo) Reload() error {
+ // sometimes, on new repos, if .git/HEAD does not exist
+ // defective git daemons or badly configured repos, 'git clone' can fail
+ // if so, 'git fetch origin' can repair the state
+ if !repo.Exists(".git/HEAD") {
+ cmd := []string{"git", "fetch", "origin"}
+ repo.RunVerbose(cmd)
+ cmd = []string{"git", "checkout", "main"} // todo: figure out main
+ repo.RunVerbose(cmd)
+ }
// log.Info("in reload", repo.FullPath)
repo.Tags = new(GitTags)
repo.reloadGitTags()