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
This commit is contained in:
Kim Carlbäcker 2016-08-11 05:08:09 +02:00 committed by 无闻
parent 81e6f82caf
commit b756806ee9

View file

@ -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)
if err != nil {
return fmt.Errorf("getRepositoriesByForkID: %v", err)