diff options
author | Unknwon <u@gogs.io> | 2015-12-09 20:46:05 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-12-09 20:46:05 -0500 |
commit | 9a2e43bff28ac92f180109fe900a6997614ea5a8 (patch) | |
tree | 564dbb6fb30c153e43b0e18499d80e7d93dd0bee /modules/git/submodule.go | |
parent | bd5dc626e82e18d3e619d918e579dc130edcd1fa (diff) | |
download | gitea-9a2e43bff28ac92f180109fe900a6997614ea5a8.tar.gz gitea-9a2e43bff28ac92f180109fe900a6997614ea5a8.zip |
move out git module and #1573 send push hook
Diffstat (limited to 'modules/git/submodule.go')
-rw-r--r-- | modules/git/submodule.go | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/modules/git/submodule.go b/modules/git/submodule.go deleted file mode 100644 index 10680c242a..0000000000 --- a/modules/git/submodule.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2014 The Gogs 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 git - -import ( - "strings" - - "github.com/gogits/gogs/modules/setting" -) - -type SubModule struct { - Name string - Url string -} - -// SubModuleFile represents a file with submodule type. -type SubModuleFile struct { - *Commit - - refUrl string - refId string -} - -func NewSubModuleFile(c *Commit, refUrl, refId string) *SubModuleFile { - return &SubModuleFile{ - Commit: c, - refUrl: refUrl, - refId: refId, - } -} - -// RefUrl guesses and returns reference URL. -func (sf *SubModuleFile) RefUrl() string { - if sf.refUrl == "" { - return "" - } - - url := strings.TrimSuffix(sf.refUrl, ".git") - - // git://xxx/user/repo - if strings.HasPrefix(url, "git://") { - return "http://" + strings.TrimPrefix(url, "git://") - } - - // http[s]://xxx/user/repo - if strings.HasPrefix(url, "http://") || strings.HasPrefix(url, "https://") { - return url - } - - // sysuser@xxx:user/repo - i := strings.Index(url, "@") - j := strings.LastIndex(url, ":") - if i > -1 && j > -1 { - // fix problem with reverse proxy works only with local server - if strings.Contains(setting.AppUrl, url[i+1:j]) { - return setting.AppUrl + url[j+1:] - } else { - return "http://" + url[i+1:j] + "/" + url[j+1:] - } - } - - return url -} - -// RefId returns reference ID. -func (sf *SubModuleFile) RefId() string { - return sf.refId -} |