Explorar o código

[models_gin] Sync twice when uploading

On new repositories, the first sync doesn't upload the data and a second
one is required to initialise the remote annex and then upload.  This
should be fixed in a better way (e.g., by initialising the remote
explicitly) but for now we need this workaround.
Achilleas Koutsou %!s(int64=6) %!d(string=hai) anos
pai
achega
2c6fb2c87d
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      models/models_gin.go

+ 6 - 0
models/models_gin.go

@@ -137,5 +137,11 @@ func annexSync(path string) error {
 		log.Error(2, "Annex sync failed: %v (%s)", err, msg)
 		return fmt.Errorf("git annex sync --content [%s]", path)
 	}
+
+	// run twice; required if remote annex is not initialised
+	if msg, err := gannex.ASync(path, "--content"); err != nil {
+		log.Error(2, "Annex sync failed: %v (%s)", err, msg)
+		return fmt.Errorf("git annex sync --content [%s]", path)
+	}
 	return nil
 }