Skip to content

Commit

Permalink
Fix #515
Browse files Browse the repository at this point in the history
  • Loading branch information
unknwon committed Sep 30, 2014
1 parent 198567e commit 2a031c1
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gogs.go
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)

const APP_VER = "0.5.4.0929 Beta"
const APP_VER = "0.5.4.0930 Beta"

func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
Expand Down
4 changes: 2 additions & 2 deletions modules/git/repo_commit.go
Expand Up @@ -40,11 +40,11 @@ func (repo *Repository) GetCommitIdOfTag(tagName string) (string, error) {
}

func (repo *Repository) GetCommitOfTag(tagName string) (*Commit, error) {
commitId, err := repo.GetCommitIdOfTag(tagName)
tag, err := repo.GetTag(tagName)
if err != nil {
return nil, err
}
return repo.GetCommit(commitId)
return tag.Commit()
}

// Parse commit information from the (uncompressed) raw
Expand Down
2 changes: 1 addition & 1 deletion modules/git/repo_tag.go
Expand Up @@ -52,6 +52,7 @@ func (repo *Repository) getTag(id sha1) (*Tag, error) {
if err != nil {
return nil, errors.New(stderr)
}
tp = strings.TrimSpace(tp)

// Tag is a commit.
if ObjectType(tp) == COMMIT {
Expand All @@ -77,7 +78,6 @@ func (repo *Repository) getTag(id sha1) (*Tag, error) {
}

tag.Id = id
tag.Object = id
tag.repo = repo

repo.tagCache[id] = tag
Expand Down
5 changes: 4 additions & 1 deletion modules/git/tree.go
Expand Up @@ -109,9 +109,12 @@ func (t *Tree) ListEntries(relpath string) (Entries, error) {
}
t.entriesParsed = true

stdout, _, err := com.ExecCmdDirBytes(t.repo.Path,
stdout, stderr, err := com.ExecCmdDirBytes(t.repo.Path,
"git", "ls-tree", t.Id.String())
if err != nil {
if strings.Contains(err.Error(), "exit status 128") {
return nil, errors.New(strings.TrimSpace(string(stderr)))
}
return nil, err
}
t.entries, err = parseTreeData(t, stdout)
Expand Down
5 changes: 2 additions & 3 deletions modules/middleware/repo.go
Expand Up @@ -208,10 +208,9 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
} else if gitRepo.IsTagExist(refName) {
ctx.Repo.IsTag = true
ctx.Repo.BranchName = refName

ctx.Repo.Commit, err = gitRepo.GetCommitOfTag(refName)
ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetCommitOfTag(refName)
if err != nil {
ctx.Handle(500, "RepoAssignment invalid tag", err)
ctx.Handle(500, "Fail to get tag commit", err)
return
}
ctx.Repo.CommitId = ctx.Repo.Commit.Id.String()
Expand Down
1 change: 0 additions & 1 deletion public/ng/css/gogs.css
Expand Up @@ -833,7 +833,6 @@ ol.linenums {
}
#dashboard-my-repo .repo-count {
margin-left: 4px;
font-size: .8em;
}
#dashboard-my-org,
#dashboard-my-mirror {
Expand Down
1 change: 0 additions & 1 deletion public/ng/less/gogs/dashboard.less
Expand Up @@ -139,7 +139,6 @@
}
.repo-count {
margin-left: 4px;
font-size: .8em;
}
}
#dashboard-my-org,
Expand Down
1 change: 1 addition & 0 deletions routers/repo/view.go
Expand Up @@ -118,6 +118,7 @@ func Home(ctx *middleware.Context) {
ctx.Handle(404, "SubTree", err)
return
}

entries, err := tree.ListEntries(treename)
if err != nil {
ctx.Handle(500, "ListEntries", err)
Expand Down
2 changes: 1 addition & 1 deletion templates/.VERSION
@@ -1 +1 @@
0.5.4.0929 Beta
0.5.4.0930 Beta

0 comments on commit 2a031c1

Please sign in to comment.