MCPcopy Create free account
hub / github.com/gogs/gogs / cleanUpMigrateGitConfig

Function cleanUpMigrateGitConfig

internal/database/repo.go:889–899  ·  view source on GitHub ↗

cleanUpMigrateGitConfig removes mirror info which prevents "push --all". This also removes possible user credentials.

(configPath string)

Source from the content-addressed store, hash-verified

887// cleanUpMigrateGitConfig removes mirror info which prevents "push --all".
888// This also removes possible user credentials.
889func cleanUpMigrateGitConfig(configPath string) error {
890 cfg, err := ini.Load(configPath)
891 if err != nil {
892 return errors.Newf("open config file: %v", err)
893 }
894 cfg.DeleteSection("remote \"origin\"")
895 if err = cfg.SaveToIndent(configPath, "\t"); err != nil {
896 return errors.Newf("save config file: %v", err)
897 }
898 return nil
899}
900
901var hooksTpls = map[git.HookName]string{
902 "pre-receive": "#!/usr/bin/env %s\n\"%s\" hook --config='%s' pre-receive\n",

Callers 1

CleanUpMigrateInfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected