Browse Source

Add "support" for git-daemon-export-ok (#2940) (#3046)

* add git-daemon-export-ok "support"

* Slight fix to git-daemon-export-ok

* Add error-checking for git-demon-export-ok

* Remove old comments and fixed logging-issues

* Check if git-daemon-export-ok exists or not
pull/3432/head
Kim Carlbäcker 9 years ago committed by 无闻
parent
commit
b756806ee9
  1. 14
      models/repo.go

14
models/repo.go

@ -1268,6 +1268,20 @@ func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err e
} }
} }
// Create/Remove git-daemon-export-ok for git-daemon...
daemonExportFile := path.Join(repo.RepoPath(), `git-daemon-export-ok`)
if repo.IsPrivate && com.IsExist(daemonExportFile) {
if err = os.Remove(daemonExportFile); err != nil {
log.Error(4, "Failed to remove %s: %v", daemonExportFile, err)
}
} else if !repo.IsPrivate && !com.IsExist(daemonExportFile) {
if f, err := os.Create(daemonExportFile); err != nil {
log.Error(4, "Failed to create %s: %v", daemonExportFile, err)
} else {
f.Close()
}
}
forkRepos, err := getRepositoriesByForkID(e, repo.ID) forkRepos, err := getRepositoriesByForkID(e, repo.ID)
if err != nil { if err != nil {
return fmt.Errorf("getRepositoriesByForkID: %v", err) return fmt.Errorf("getRepositoriesByForkID: %v", err)

Loading…
Cancel
Save