| 2112 | } |
| 2113 | |
| 2114 | func GitGcRepos() error { |
| 2115 | args := append([]string{"gc"}, conf.Git.GCArgs...) |
| 2116 | return x.Where("id > 0").Iterate(new(Repository), |
| 2117 | func(idx int, bean any) error { |
| 2118 | repo := bean.(*Repository) |
| 2119 | if err := repo.GetOwner(); err != nil { |
| 2120 | return err |
| 2121 | } |
| 2122 | _, stderr, err := process.ExecDir( |
| 2123 | time.Duration(conf.Git.Timeout.GC)*time.Second, |
| 2124 | RepoPath(repo.Owner.Name, repo.Name), "Repository garbage collection", |
| 2125 | "git", args...) |
| 2126 | if err != nil { |
| 2127 | return errors.Newf("%v: %v", err, stderr) |
| 2128 | } |
| 2129 | return nil |
| 2130 | }) |
| 2131 | } |
| 2132 | |
| 2133 | type repoChecker struct { |
| 2134 | querySQL, correctSQL string |