Selaa lähdekoodia

#3091 add config option for Git GC

Unknwon 8 vuotta sitten
vanhempi
commit
b0b88d9bc5
4 muutettua tiedostoa jossa 8 lisäystä ja 3 poistoa
  1. 1 0
      conf/app.ini
  2. 5 2
      models/repo.go
  3. 0 0
      modules/bindata/bindata.go
  4. 2 1
      modules/setting/setting.go

+ 1 - 0
conf/app.ini

@@ -357,6 +357,7 @@ MIGRATE = 600
 MIRROR = 300
 CLONE = 300
 PULL = 300
+GC = 60
 
 [api]
 ; Max number of items will response in a page

+ 5 - 2
models/repo.go

@@ -1741,14 +1741,17 @@ func GitFsck() {
 }
 
 func GitGcRepos() error {
-	args := append([]string{"gc"}, setting.Git.GcArgs...)
+	args := append([]string{"gc"}, setting.Git.GCArgs...)
 	return x.Where("id > 0").Iterate(new(Repository),
 		func(idx int, bean interface{}) error {
 			repo := bean.(*Repository)
 			if err := repo.GetOwner(); err != nil {
 				return err
 			}
-			_, stderr, err := process.ExecDir(-1, RepoPath(repo.Owner.Name, repo.Name), "Repository garbage collection", "git", args...)
+			_, stderr, err := process.ExecDir(
+				time.Duration(setting.Git.Timeout.GC)*time.Second,
+				RepoPath(repo.Owner.Name, repo.Name), "Repository garbage collection",
+				"git", args...)
 			if err != nil {
 				return fmt.Errorf("%v: %v", err, stderr)
 			}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
modules/bindata/bindata.go


+ 2 - 1
modules/setting/setting.go

@@ -198,12 +198,13 @@ var (
 		MaxGitDiffLines          int
 		MaxGitDiffLineCharacters int
 		MaxGitDiffFiles          int
-		GcArgs                   []string `delim:" "`
+		GCArgs                   []string `delim:" "`
 		Timeout                  struct {
 			Migrate int
 			Mirror  int
 			Clone   int
 			Pull    int
+			GC      int `ini:"GC"`
 		} `ini:"git.timeout"`
 	}
 

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä