From 948b20a6d272a3638b7c77fe3fa9416507edf880 Mon Sep 17 00:00:00 2001 From: ultimania Date: Wed, 31 May 2023 08:54:45 +0900 Subject: [PATCH] fixed conditions of migration --- Makefile | 2 +- README.md | 2 +- docs/index.md | 2 +- examples/provider.tf | 2 +- examples/provider/provider.tf | 2 +- gitea/resource_gitea_repository.go | 14 +++++++------- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 486f45c..803227b 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ KERNEL?=$$(uname -s | tr '[:upper:]' '[:lower:]') GOFMT ?= gofmt -s -VERSION = 0.13.0 +VERSION = 0.14.0 test: fmt-check go test -i $(TEST) || exit 1 diff --git a/README.md b/README.md index 17d15ca..1e929aa 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ terraform { required_providers { gitea = { source = "Lerentis/gitea" - version = "0.13.0" + version = "0.14.0" } } } diff --git a/docs/index.md b/docs/index.md index 4a70051..72724de 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,7 +17,7 @@ terraform { required_providers { gitea = { source = "Lerentis/gitea" - version = "0.13.0" + version = "0.14.0" } } } diff --git a/examples/provider.tf b/examples/provider.tf index 7a3b3e0..35341ec 100644 --- a/examples/provider.tf +++ b/examples/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { gitea = { source = "terraform.local/lerentis/gitea" - version = "0.13.0" + version = "0.14.0" } } } diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index fd96593..9a8409a 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -2,7 +2,7 @@ terraform { required_providers { gitea = { source = "Lerentis/gitea" - version = "0.13.0" + version = "0.14.0" } } } diff --git a/gitea/resource_gitea_repository.go b/gitea/resource_gitea_repository.go index 01f0212..065112e 100644 --- a/gitea/resource_gitea_repository.go +++ b/gitea/resource_gitea_repository.go @@ -131,14 +131,14 @@ func resourceRepoCreate(d *schema.ResourceData, meta interface{}) (err error) { orgRepo = true } - if (d.Get(repoMirror)).(bool) { + var cloneAddr string + if d.Get(migrationCloneAddresse).(string) != "" { + cloneAddr = d.Get(migrationCloneAddresse).(string) + } else { + cloneAddr = d.Get(migrationCloneAddress).(string) + } - var cloneAddr string - if d.Get(migrationCloneAddresse).(string) != "" { - cloneAddr = d.Get(migrationCloneAddresse).(string) - } else { - cloneAddr = d.Get(migrationCloneAddress).(string) - } + if cloneAddr != "" { opts := gitea.MigrateRepoOption{ RepoName: d.Get(repoName).(string),