]> source.dussan.org Git - gitea.git/commitdiff
Add PushCommit
authorLunny Xiao <xiaolunwen@gmail.com>
Sat, 29 Mar 2014 11:29:52 +0000 (19:29 +0800)
committerLunny Xiao <xiaolunwen@gmail.com>
Sat, 29 Mar 2014 11:29:52 +0000 (19:29 +0800)
modules/base/tool.go
routers/repo/repo.go
update.go

index 9ddb90f721609c2a8fb410e4231be8b48cf768b4..d005ffe355b4f922d824f617e45672cf03534a37 100644 (file)
@@ -506,9 +506,16 @@ const (
 <div><img src="%s?s=16" alt="user-avatar"/> %s</div>`
 )
 
+type PushCommit struct {
+       Sha1        string
+       Message     string
+       AuthorEmail string
+       AuthorName  string
+}
+
 type PushCommits struct {
        Len     int
-       Commits [][]string
+       Commits []*PushCommit
 }
 
 // ActionDesc accepts int that represents action operation type
@@ -529,7 +536,7 @@ func ActionDesc(act Actioner, avatarLink string) string {
                }
                buf := bytes.NewBuffer([]byte("\n"))
                for _, commit := range push.Commits {
-                       buf.WriteString(fmt.Sprintf(TPL_COMMIT_REPO_LI, avatarLink, repoLink, commit[0], commit[0][:7], commit[1]) + "\n")
+                       buf.WriteString(fmt.Sprintf(TPL_COMMIT_REPO_LI, avatarLink, repoLink, commit.Sha1, commit.Sha1[:7], commit.Message) + "\n")
                }
                if push.Len > 3 {
                        buf.WriteString(fmt.Sprintf(`<div><a href="/%s/%s/commits/%s">%d other commits >></a></div>`, actUserName, repoName, branch, push.Len))
index e7107ad1cd0bf3aeab89257b6ef50627c3ed9004..b9ac1f1c42b20d7b436084413c2ca4cda2d70f9b 100644 (file)
@@ -276,11 +276,9 @@ func Http(ctx *middleware.Context, params martini.Params) {
        }
 
        prefix := path.Join("/", username, params["reponame"])
-       server := &webdav.Server{
-               Fs:         webdav.Dir(models.RepoPath(username, reponame)),
-               TrimPrefix: prefix,
-               Listings:   true,
-       }
+       server := webdav.NewServer(
+               models.RepoPath(username, reponame),
+               prefix, true)
 
        server.ServeHTTP(ctx.ResponseWriter, ctx.Req)
 }
index faec0029ac62d51275ef198564ed12fee0a3e822..9743dcc480cc262e24981badeb24c619ee11593a 100644 (file)
--- a/update.go
+++ b/update.go
@@ -130,11 +130,15 @@ func runUpdate(c *cli.Context) {
                return
        }
 
-       commits := make([][]string, 0)
+       commits := make([]*base.PushCommit, 0)
        var maxCommits = 3
        for e := l.Front(); e != nil; e = e.Next() {
                commit := e.Value.(*git.Commit)
-               commits = append(commits, []string{commit.Id().String(), commit.Message()})
+               commits = append(commits,
+                       &base.PushCommit{commit.Id().String(),
+                               commit.Message(),
+                               commit.Author.Email,
+                               commit.Author.Name})
                if len(commits) >= maxCommits {
                        break
                }