diff options
author | 6543 <6543@obermui.de> | 2020-09-28 21:00:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-28 15:00:52 -0400 |
commit | 4a654a8d44bf4b0dc9ab1bf850be68f73b25e5cd (patch) | |
tree | 275810fd57012920f583eaadb2281283683576bd /services/mirror | |
parent | 14e718695a999be199b61b57d60e9760d70ef439 (diff) | |
download | gitea-4a654a8d44bf4b0dc9ab1bf850be68f73b25e5cd.tar.gz gitea-4a654a8d44bf4b0dc9ab1bf850be68f73b25e5cd.zip |
Mirror: Update DB on Address-Update too (#12964)
* Mirror: Update DB on Address-Update too
* new name for function to better describe
Diffstat (limited to 'services/mirror')
-rw-r--r-- | services/mirror/mirror.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/services/mirror/mirror.go b/services/mirror/mirror.go index da794ea585..5eafdab38d 100644 --- a/services/mirror/mirror.go +++ b/services/mirror/mirror.go @@ -89,8 +89,8 @@ func AddressNoCredentials(m *models.Mirror) string { return u.String() } -// SaveAddress writes new address to Git repository config. -func SaveAddress(m *models.Mirror, addr string) error { +// UpdateAddress writes new address to Git repository and database +func UpdateAddress(m *models.Mirror, addr string) error { repoPath := m.Repo.RepoPath() // Remove old origin _, err := git.NewCommand("remote", "rm", "origin").RunInDir(repoPath) @@ -117,7 +117,9 @@ func SaveAddress(m *models.Mirror, addr string) error { return err } } - return nil + + m.Repo.OriginalURL = addr + return models.UpdateRepositoryCols(m.Repo, "original_url") } // gitShortEmptySha Git short empty SHA |