diff options
author | Kim Carlbäcker <kim.carlbacker@gmail.com> | 2016-08-11 05:08:09 +0200 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2016-08-10 20:08:09 -0700 |
commit | b756806ee99f28c4fa6ff824037f92800af4bf72 (patch) | |
tree | c92feea6fb4719d99f528c7342af2474e5654540 | |
parent | 81e6f82cafe4b450996a01618a2ee379c7f67682 (diff) | |
download | gitea-b756806ee99f28c4fa6ff824037f92800af4bf72.tar.gz gitea-b756806ee99f28c4fa6ff824037f92800af4bf72.zip |
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
-rw-r--r-- | models/repo.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/models/repo.go b/models/repo.go index 822ad1d9ca..2902dc84a5 100644 --- a/models/repo.go +++ b/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) if err != nil { return fmt.Errorf("getRepositoriesByForkID: %v", err) |