diff options
-rw-r--r-- | gogs.go | 2 | ||||
-rw-r--r-- | models/repo.go | 41 | ||||
-rw-r--r-- | routers/repo/single.go | 2 | ||||
-rw-r--r-- | templates/repo/single.tmpl | 5 |
4 files changed, 4 insertions, 46 deletions
@@ -20,7 +20,7 @@ import ( // Test that go1.1 tag above is included in builds. main.go refers to this definition. const go11tag = true -const APP_VER = "0.1.0.0317.1" +const APP_VER = "0.1.0.0318.1" func init() { base.AppVer = APP_VER diff --git a/models/repo.go b/models/repo.go index c37fb4de..610c3597 100644 --- a/models/repo.go +++ b/models/repo.go @@ -400,15 +400,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") ) @@ -568,38 +559,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) ([]*git.Commit, error) { repo, err := git.OpenRepository(RepoPath(userName, reposName)) diff --git a/routers/repo/single.go b/routers/repo/single.go index 2ed5cfed..0cc41b1c 100644 --- a/routers/repo/single.go +++ b/routers/repo/single.go @@ -97,7 +97,7 @@ func Single(ctx *middleware.Context, params martini.Params) { ctx.Render.Error(404) return } - ctx.Data["CurrentCommit"] = commit + ctx.Data["LastCommit"] = commit var readmeFile *models.RepoFile diff --git a/templates/repo/single.tmpl b/templates/repo/single.tmpl index c19ade77..f1674446 100644 --- a/templates/repo/single.tmpl +++ b/templates/repo/single.tmpl @@ -42,10 +42,10 @@ <div class="panel panel-default info-box"> <div class="panel-heading info-head"> - <a href="/{{$username}}/{{$reponame}}/commit/{{.LatestCommit.SHA}}">{{.LatestCommit.Message}}</a> + <a href="/{{$username}}/{{$reponame}}/commit/{{.LastCommit.Oid.String}}">{{.LastCommit.Message}}</a> </div> <div class="panel-body info-content"> - <a href="/user/{{.LatestCommit.Author}}">{{.LatestCommit.Author}}</a> <span class="text-muted">{{TimeSince .CurrentCommit.Committer.When}}</span> + <a href="/user/{{.LastCommit.Author.Name}}">{{.LastCommit.Author.Name}}</a> <span class="text-muted">{{TimeSince .LastCommit.Author.When}}</span> </div> <table class="panel-footer table file-list"> <thead class="hidden"> @@ -57,7 +57,6 @@ </tr> </thead> <tbody> - {{$currentCommit := .CurrentCommit}} {{range .Files}} <tr {{if .IsDir}}class="is-dir"{{end}}> |