@@ -0,0 +1,5 @@ | |||
// Copyright 2016 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 git // import "code.gitea.io/git" |
@@ -102,13 +102,13 @@ func ListHooks(repoPath string) (_ []*Hook, err error) { | |||
} | |||
const ( | |||
HookPathUpdate = "hooks/update" | |||
HOOK_PATH_UPDATE = "hooks/update" | |||
) | |||
// SetUpdateHook writes given content to update hook of the reposiotry. | |||
func SetUpdateHook(repoPath, content string) (err error) { | |||
log("Setting update hook: %s", repoPath) | |||
hookPath := path.Join(repoPath, HookPathUpdate) | |||
hookPath := path.Join(repoPath, HOOK_PATH_UPDATE) | |||
if com.IsExist(hookPath) { | |||
err = os.Remove(hookPath) | |||
} else { |
@@ -121,6 +121,7 @@ func Clone(from, to string, opts CloneRepoOptions) (err error) { | |||
type PullRemoteOptions struct { | |||
Timeout time.Duration | |||
All bool | |||
Rebase bool | |||
Remote string | |||
Branch string | |||
} | |||
@@ -128,6 +129,9 @@ type PullRemoteOptions struct { | |||
// Pull pulls changes from remotes. | |||
func Pull(repoPath string, opts PullRemoteOptions) error { | |||
cmd := NewCommand("pull") | |||
if opts.Rebase { | |||
cmd.AddArguments("--rebase") | |||
} | |||
if opts.All { | |||
cmd.AddArguments("--all") | |||
} else { |
@@ -11,7 +11,6 @@ import ( | |||
"sort" | |||
"strconv" | |||
"strings" | |||
"time" | |||
) | |||
type EntryMode int | |||
@@ -94,11 +93,11 @@ func (tes Entries) Less(i, j int) bool { | |||
t1, t2 := tes[i], tes[j] | |||
var k int | |||
for k = 0; k < len(sorter)-1; k++ { | |||
sort := sorter[k] | |||
s := sorter[k] | |||
switch { | |||
case sort(t1, t2): | |||
case s(t1, t2): | |||
return true | |||
case sort(t2, t1): | |||
case s(t2, t1): | |||
return false | |||
} | |||
} | |||
@@ -157,7 +156,6 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string) ([][]interfac | |||
if tes[i].Type != OBJECT_COMMIT { | |||
go func(i int) { | |||
time.Sleep(200 * time.Millisecond) | |||
cinfo := commitInfo{entryName: tes[i].Name()} | |||
c, err := commit.GetCommitByPath(filepath.Join(treePath, tes[i].Name())) | |||
if err != nil { |
@@ -3,10 +3,10 @@ | |||
"ignore": "test", | |||
"package": [ | |||
{ | |||
"checksumSHA1": "K3Gp8Tv/B8otlbsOfQp3UpJGaaE=", | |||
"checksumSHA1": "/JuXxX+Zg9lk3zvT9c82ltavFdk=", | |||
"path": "code.gitea.io/git", | |||
"revision": "766747ef8b271a2b1142edd0a40735f556ec2c1d", | |||
"revisionTime": "2016-11-06T09:52:37Z" | |||
"revision": "cddfff06fa8ed36571d43c1463ea63b3e6e8244b", | |||
"revisionTime": "2016-11-12T10:50:26Z" | |||
}, | |||
{ | |||
"checksumSHA1": "/uhZZppDeb3Rbp3h8C0ALR3hdrA=", |