diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2016-11-24 15:04:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-24 15:04:31 +0800 |
commit | 3917ed45de063b4e8868610c82d8172020d572fd (patch) | |
tree | 052b7651cbb64ae30f92efe87441ad1d4fa2d922 /routers/repo/http.go | |
parent | 3a3782bb7fed768c1e832ff4c0a77f2f5281ed05 (diff) | |
download | gitea-3917ed45de063b4e8868610c82d8172020d572fd.tar.gz gitea-3917ed45de063b4e8868610c82d8172020d572fd.zip |
golint fixed for routers (#208)
Diffstat (limited to 'routers/repo/http.go')
-rw-r--r-- | routers/repo/http.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go index a51fa9f176..91438812a6 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -29,6 +29,7 @@ import ( "code.gitea.io/gitea/modules/setting" ) +// HTTP implmentation git smart HTTP protocol func HTTP(ctx *context.Context) { username := ctx.Params(":username") reponame := strings.TrimSuffix(ctx.Params(":reponame"), ".git") @@ -170,7 +171,7 @@ func HTTP(ctx *context.Context) { return } - var lastLine int64 = 0 + var lastLine int64 for { head := input[lastLine : lastLine+2] if head[0] == '0' && head[1] == '0' { @@ -193,15 +194,15 @@ func HTTP(ctx *context.Context) { fields := strings.Fields(string(line)) if len(fields) >= 3 { - oldCommitId := fields[0][4:] - newCommitId := fields[1] + oldCommitID := fields[0][4:] + newCommitID := fields[1] refFullName := fields[2] // FIXME: handle error. if err = models.PushUpdate(models.PushUpdateOptions{ RefFullName: refFullName, - OldCommitID: oldCommitId, - NewCommitID: newCommitId, + OldCommitID: oldCommitID, + NewCommitID: newCommitID, PusherID: authUser.ID, PusherName: authUser.Name, RepoUserName: username, @@ -474,6 +475,7 @@ func getGitRepoPath(subdir string) (string, error) { return fpath, nil } +// HTTPBackend middleware for git smart HTTP protocol func HTTPBackend(ctx *context.Context, cfg *serviceConfig) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { for _, route := range routes { |