summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-03-19 14:40:49 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-03-19 14:40:49 +0800
commit9e8e910bd64e3fd6526ead90f7211fcc1a81964d (patch)
tree709f40d26a56325abfca42024bd28f0843feeca9 /models
parent3da325591b5d8578f575f5fad59595f3c5efe4d6 (diff)
parent38776a0dd5762b2efbf70ebe98eeecdcd395c185 (diff)
downloadgitea-9e8e910bd64e3fd6526ead90f7211fcc1a81964d.tar.gz
gitea-9e8e910bd64e3fd6526ead90f7211fcc1a81964d.zip
merge
Diffstat (limited to 'models')
-rw-r--r--models/action.go4
-rw-r--r--models/repo.go41
-rw-r--r--models/user.go2
3 files changed, 3 insertions, 44 deletions
diff --git a/models/action.go b/models/action.go
index 7917929df4..d388bca991 100644
--- a/models/action.go
+++ b/models/action.go
@@ -22,8 +22,8 @@ const (
// Action represents user operation type and information to the repository.
type Action struct {
Id int64
- UserId int64 // Receiver user id.
- OpType int
+ UserId int64 // Receiver user id.
+ OpType int // Operations: CREATE DELETE STAR ...
ActUserId int64 // Action user id.
ActUserName string // Action user name.
RepoId int64
diff --git a/models/repo.go b/models/repo.go
index 1331bbf450..6abfee747a 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -401,15 +401,6 @@ func DeleteRepository(userId, repoId int64, userName string) (err error) {
return nil
}
-// Commit represents a git commit.
-type Commit struct {
- Author string
- Email string
- Date time.Time
- SHA string
- Message string
-}
-
var (
ErrRepoFileNotLoaded = fmt.Errorf("repo file not loaded")
)
@@ -569,38 +560,6 @@ func GetCommit(userName, repoName, branchname, commitid string) (*git.Commit, er
return r.LastCommit()
}
-/*
-// GetLastestCommit returns the latest commit of given repository.
-func GetLastestCommit(userName, repoName string) (*Commit, error) {
- stdout, _, err := com.ExecCmd("git", "--git-dir="+RepoPath(userName, repoName), "log", "-1")
- if err != nil {
- return nil, err
- }
-
- commit := new(Commit)
- for _, line := range strings.Split(stdout, "\n") {
- if len(line) == 0 {
- continue
- }
- switch {
- case line[0] == 'c':
- commit.SHA = line[7:]
- case line[0] == 'A':
- infos := strings.SplitN(line, " ", 3)
- commit.Author = infos[1]
- commit.Email = infos[2][1 : len(infos[2])-1]
- case line[0] == 'D':
- commit.Date, err = time.Parse("Mon Jan 02 15:04:05 2006 -0700", line[8:])
- if err != nil {
- return nil, err
- }
- case line[:4] == " ":
- commit.Message = line[4:]
- }
- }
- return commit, nil
-}*/
-
// GetCommits returns all commits of given branch of repository.
func GetCommits(userName, reposName, branchname string) (*list.List, error) {
repo, err := git.OpenRepository(RepoPath(userName, reposName))
diff --git a/models/user.go b/models/user.go
index 87c644b2b6..80af9bd4ba 100644
--- a/models/user.go
+++ b/models/user.go
@@ -252,7 +252,7 @@ func LoginUserPlain(name, passwd string) (*User, error) {
} else if !has {
err = ErrUserNotExist
}
- return &user, nil
+ return &user, err
}
// FollowUser marks someone be another's follower.