From 25b3836418cda78be79c17c4fa58571f7fbd5a8d Mon Sep 17 00:00:00 2001
From: lstahlman <luke.stahlman@gmail.com>
Date: Sat, 16 Jul 2016 18:30:43 -0700
Subject: [PATCH] Refresh repository mirror from database when the repository's
 name has changed. (#3276)

---
 routers/repo/setting.go | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index c9236a5331..c5772dca52 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -105,6 +105,15 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
 		}
 
 		if repo.IsMirror {
+			if isNameChanged {
+				var err error
+				ctx.Repo.Mirror, err = models.GetMirror(repo.ID)
+				if err != nil {
+					ctx.Handle(500, "RefreshRepositoryMirror", err)
+					return
+				}
+			}
+
 			if form.Interval > 0 {
 				ctx.Repo.Mirror.EnablePrune = form.EnablePrune
 				ctx.Repo.Mirror.Interval = form.Interval