summaryrefslogtreecommitdiffstats
path: root/modules/private
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2018-12-12 02:37:32 +0800
committertechknowlogick <hello@techknowlogick.com>2018-12-11 13:37:32 -0500
commitba75319157f23031cfca55b5a286f86d36065f35 (patch)
tree450a6e1ffd17b89fd00fea664c59cb31f7cbc351 /modules/private
parentccea91652f8d23bd65494f5c04275506118aaa27 (diff)
downloadgitea-ba75319157f23031cfca55b5a286f86d36065f35.tar.gz
gitea-ba75319157f23031cfca55b5a286f86d36065f35.zip
fix clone wiki failed via ssh (#5503)
Diffstat (limited to 'modules/private')
-rw-r--r--modules/private/wiki.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/private/wiki.go b/modules/private/wiki.go
new file mode 100644
index 0000000000..4ad0cc7c4e
--- /dev/null
+++ b/modules/private/wiki.go
@@ -0,0 +1,33 @@
+// Copyright 2018 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package private
+
+import (
+ "fmt"
+
+ "code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/setting"
+)
+
+// InitWiki initwiki via repo id
+func InitWiki(repoID int64) error {
+ // Ask for running deliver hook and test pull request tasks.
+ reqURL := setting.LocalURL + fmt.Sprintf("api/internal/repositories/%d/wiki/init", repoID)
+ log.GitLogger.Trace("InitWiki: %s", reqURL)
+
+ resp, err := newInternalRequest(reqURL, "GET").Response()
+ if err != nil {
+ return err
+ }
+
+ defer resp.Body.Close()
+
+ // All 2XX status codes are accepted and others will return an error
+ if resp.StatusCode/100 != 2 {
+ return fmt.Errorf("Failed to init wiki: %s", decodeJSONError(resp).Err)
+ }
+
+ return nil
+}