|
|
@ -89,8 +89,8 @@ func AddressNoCredentials(m *models.Mirror) string { |
|
|
|
return u.String() |
|
|
|
return u.String() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SaveAddress writes new address to Git repository config.
|
|
|
|
// UpdateAddress writes new address to Git repository and database
|
|
|
|
func SaveAddress(m *models.Mirror, addr string) error { |
|
|
|
func UpdateAddress(m *models.Mirror, addr string) error { |
|
|
|
repoPath := m.Repo.RepoPath() |
|
|
|
repoPath := m.Repo.RepoPath() |
|
|
|
// Remove old origin
|
|
|
|
// Remove old origin
|
|
|
|
_, err := git.NewCommand("remote", "rm", "origin").RunInDir(repoPath) |
|
|
|
_, err := git.NewCommand("remote", "rm", "origin").RunInDir(repoPath) |
|
|
@ -117,7 +117,9 @@ func SaveAddress(m *models.Mirror, addr string) error { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return nil |
|
|
|
|
|
|
|
|
|
|
|
m.Repo.OriginalURL = addr |
|
|
|
|
|
|
|
return models.UpdateRepositoryCols(m.Repo, "original_url") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// gitShortEmptySha Git short empty SHA
|
|
|
|
// gitShortEmptySha Git short empty SHA
|
|
|
|