Browse Source

Fix #515

pull/521/head
Unknwon 10 years ago
parent
commit
2a031c1365
  1. 2
      gogs.go
  2. 4
      modules/git/repo_commit.go
  3. 2
      modules/git/repo_tag.go
  4. 5
      modules/git/tree.go
  5. 5
      modules/middleware/repo.go
  6. 1
      public/ng/css/gogs.css
  7. 1
      public/ng/less/gogs/dashboard.less
  8. 1
      routers/repo/view.go
  9. 2
      templates/.VERSION

2
gogs.go

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.5.4.0929 Beta" const APP_VER = "0.5.4.0930 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

4
modules/git/repo_commit.go

@ -40,11 +40,11 @@ func (repo *Repository) GetCommitIdOfTag(tagName string) (string, error) {
} }
func (repo *Repository) GetCommitOfTag(tagName string) (*Commit, error) { func (repo *Repository) GetCommitOfTag(tagName string) (*Commit, error) {
commitId, err := repo.GetCommitIdOfTag(tagName) tag, err := repo.GetTag(tagName)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return repo.GetCommit(commitId) return tag.Commit()
} }
// Parse commit information from the (uncompressed) raw // Parse commit information from the (uncompressed) raw

2
modules/git/repo_tag.go

@ -52,6 +52,7 @@ func (repo *Repository) getTag(id sha1) (*Tag, error) {
if err != nil { if err != nil {
return nil, errors.New(stderr) return nil, errors.New(stderr)
} }
tp = strings.TrimSpace(tp)
// Tag is a commit. // Tag is a commit.
if ObjectType(tp) == COMMIT { if ObjectType(tp) == COMMIT {
@ -77,7 +78,6 @@ func (repo *Repository) getTag(id sha1) (*Tag, error) {
} }
tag.Id = id tag.Id = id
tag.Object = id
tag.repo = repo tag.repo = repo
repo.tagCache[id] = tag repo.tagCache[id] = tag

5
modules/git/tree.go

@ -109,9 +109,12 @@ func (t *Tree) ListEntries(relpath string) (Entries, error) {
} }
t.entriesParsed = true t.entriesParsed = true
stdout, _, err := com.ExecCmdDirBytes(t.repo.Path, stdout, stderr, err := com.ExecCmdDirBytes(t.repo.Path,
"git", "ls-tree", t.Id.String()) "git", "ls-tree", t.Id.String())
if err != nil { if err != nil {
if strings.Contains(err.Error(), "exit status 128") {
return nil, errors.New(strings.TrimSpace(string(stderr)))
}
return nil, err return nil, err
} }
t.entries, err = parseTreeData(t, stdout) t.entries, err = parseTreeData(t, stdout)

5
modules/middleware/repo.go

@ -208,10 +208,9 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
} else if gitRepo.IsTagExist(refName) { } else if gitRepo.IsTagExist(refName) {
ctx.Repo.IsTag = true ctx.Repo.IsTag = true
ctx.Repo.BranchName = refName ctx.Repo.BranchName = refName
ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetCommitOfTag(refName)
ctx.Repo.Commit, err = gitRepo.GetCommitOfTag(refName)
if err != nil { if err != nil {
ctx.Handle(500, "RepoAssignment invalid tag", err) ctx.Handle(500, "Fail to get tag commit", err)
return return
} }
ctx.Repo.CommitId = ctx.Repo.Commit.Id.String() ctx.Repo.CommitId = ctx.Repo.Commit.Id.String()

1
public/ng/css/gogs.css

@ -833,7 +833,6 @@ ol.linenums {
} }
#dashboard-my-repo .repo-count { #dashboard-my-repo .repo-count {
margin-left: 4px; margin-left: 4px;
font-size: .8em;
} }
#dashboard-my-org, #dashboard-my-org,
#dashboard-my-mirror { #dashboard-my-mirror {

1
public/ng/less/gogs/dashboard.less

@ -139,7 +139,6 @@
} }
.repo-count { .repo-count {
margin-left: 4px; margin-left: 4px;
font-size: .8em;
} }
} }
#dashboard-my-org, #dashboard-my-org,

1
routers/repo/view.go

@ -118,6 +118,7 @@ func Home(ctx *middleware.Context) {
ctx.Handle(404, "SubTree", err) ctx.Handle(404, "SubTree", err)
return return
} }
entries, err := tree.ListEntries(treename) entries, err := tree.ListEntries(treename)
if err != nil { if err != nil {
ctx.Handle(500, "ListEntries", err) ctx.Handle(500, "ListEntries", err)

2
templates/.VERSION

@ -1 +1 @@
0.5.4.0929 Beta 0.5.4.0930 Beta
Loading…
Cancel
Save