diff --git a/.bra.toml b/.bra.toml
index bd245653f..7d49786d3 100644
--- a/.bra.toml
+++ b/.bra.toml
@@ -13,7 +13,7 @@ watch_dirs = [
watch_exts = [".go"]
build_delay = 1500
cmds = [
- ["go", "install", "-tags", "sqlite"],# redis memcache cert pam tidb
- ["go", "build", "-tags", "sqlite"],
+ ["go", "install", "-race"], # sqlite redis memcache cert pam tidb
+ ["go", "build", "-race"],
["./gogs", "web"]
]
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index d696aff5f..774a100be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,3 +36,4 @@ docker/docker/init_gogs.sh
gogs.sublime-project
gogs.sublime-workspace
.tags*
+release
diff --git a/.gopmfile b/.gopmfile
index 2dcf00a41..868b0536b 100644
--- a/.gopmfile
+++ b/.gopmfile
@@ -3,41 +3,43 @@ path = github.com/gogits/gogs
[deps]
github.com/bradfitz/gomemcache = commit:72a68649ba
-github.com/Unknwon/cae = commit:2e70a1351b
-github.com/Unknwon/com = commit:47d7d2b81a
-github.com/Unknwon/i18n = commit:7457d88830
-github.com/Unknwon/paginater = commit:cab2d086fa
-github.com/codegangsta/cli = commit:142e6cd241
+github.com/codegangsta/cli = commit:70e3fa5
+github.com/go-macaron/binding = commit:864a5ce
+github.com/go-macaron/cache = commit:5617353
+github.com/go-macaron/captcha = commit:875ff77
+github.com/go-macaron/csrf = commit:75c2b04
+github.com/go-macaron/gzip = commit:4938e9b
+github.com/go-macaron/i18n = commit:5e728b6
+github.com/go-macaron/inject = commit:c5ab7bf
+github.com/go-macaron/session = commit:66031fc
+github.com/go-macaron/toolbox =
github.com/go-sql-driver/mysql = commit:527bcd55aa
github.com/go-xorm/core = commit:3e10003353
-github.com/go-xorm/xorm = commit:803f6db50c
+github.com/go-xorm/xorm = commit:8bf4405
github.com/gogits/chardet = commit:2404f77725
github.com/kiliit/go-gogs-client
-github.com/issue9/identicon =
-github.com/lib/pq = commit:b269bd035a
-github.com/go-macaron/binding =
-github.com/go-macaron/cache =
-github.com/go-macaron/captcha =
-github.com/go-macaron/csrf =
-github.com/go-macaron/gzip =
-github.com/go-macaron/i18n =
-github.com/go-macaron/session =
-github.com/go-macaron/toolbox =
-github.com/klauspost/compress =
-github.com/klauspost/crc32 =
-github.com/mattn/go-sqlite3 = commit:b808f01f66
-github.com/mcuadros/go-version = commit:d52711f8d6
-github.com/microcosm-cc/bluemonday = commit:85ba47ef2c
-github.com/mssola/user_agent = commit:a163d6a569
+github.com/issue9/identicon = commit:5a61672
+github.com/klauspost/compress = commit:0449b1c
+github.com/klauspost/cpuid = commit:8d9fe96
+github.com/klauspost/crc32 = commit:f8d2e12
+github.com/lib/pq = commit:83c4f41
+github.com/mattn/go-sqlite3 = commit:5651a9d
+github.com/mcuadros/go-version = commit:d52711f
+github.com/microcosm-cc/bluemonday = commit:4ac6f27
github.com/msteinert/pam = commit:6534f23b39
github.com/nfnt/resize = commit:dc93e1b98c
-github.com/russross/blackfriday = commit:8cec3a854e
-github.com/shurcooL/sanitized_anchor_name = commit:244f5ac324
+github.com/russross/blackfriday = commit:510be64
+github.com/shurcooL/sanitized_anchor_name = commit:10ef21a
+github.com/Unknwon/cae = commit:7f5e046
+github.com/Unknwon/com = commit:28b053d
+github.com/Unknwon/i18n = commit:7457d88830
+github.com/Unknwon/paginater = commit:7748a72
golang.org/x/net =
-golang.org/x/text =
-gopkg.in/gomail.v2 = commit:b1e55520bf
-gopkg.in/macaron.v1 =
-gopkg.in/ini.v1 = commit:e8c222fea7
+golang.org/x/text =
+golang.org/x/crypto =
+gopkg.in/gomail.v2 = commit:df6fc79
+gopkg.in/ini.v1 = commit:060d7da
+gopkg.in/macaron.v1 = commit:1c6dd87
gopkg.in/redis.v2 = commit:e617904962
[res]
diff --git a/.travis.yml b/.travis.yml
index 864a80c42..837d9a1cc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,13 +4,15 @@ go:
- 1.3
- 1.4
- 1.5
- - tip
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y libpam-dev
- go get github.com/msteinert/pam
+install:
+ - go get -t -v ./...
+
script: go build -v -tags "pam"
notifications:
diff --git a/Dockerfile b/Dockerfile
index 500a294f3..a7ff05fe3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,4 +19,4 @@ RUN ./docker/build.sh
VOLUME ["/data"]
EXPOSE 22 3000
ENTRYPOINT ["docker/start.sh"]
-CMD ["/usr/bin/s6-svscan", "/app/gogs/docker/s6/"]
+CMD ["/bin/s6-svscan", "/app/gogs/docker/s6/"]
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000..ee4950781
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,35 @@
+LDFLAGS += -X "github.com/gogits/gogs/modules/setting.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
+LDFLAGS += -X "github.com/gogits/gogs/modules/setting.BuildGitHash=$(shell git rev-parse HEAD)"
+
+TAGS = ""
+
+RELEASE_ROOT = "release"
+RELEASE_GOGS = "release/gogs"
+NOW = $(shell date -u '+%Y%m%d%I%M%S')
+
+.PHONY: build pack release bindata clean
+
+build:
+ go install -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
+ go build -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
+
+govet:
+ go tool vet -composites=false -methods=false -structtags=false .
+
+pack:
+ rm -rf $(RELEASE_GOGS)
+ mkdir -p $(RELEASE_GOGS)
+ cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
+ rm -rf $(RELEASE_GOGS)/public/config.codekit $(RELEASE_GOGS)/public/less
+ cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
+
+release: build pack
+
+bindata:
+ go-bindata -o=modules/bindata/bindata.go -ignore="\\.DS_Store|README.md" -pkg=bindata conf/...
+
+clean:
+ go clean -i ./...
+
+clean-mac: clean
+ find . -name ".DS_Store" -print0 | xargs -0 rm
\ No newline at end of file
diff --git a/README.md b/README.md
index 8e4cc8331..4d683eadd 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](public/img/gogs-large-resize.png)
-##### Current version: 0.6.16 Beta
+##### Current version: 0.7.16 Beta
@@ -29,20 +29,20 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
- Due to testing purpose, data of [try.gogs.io](https://try.gogs.io) has been reset in **Jan 28, 2015** and will reset multiple times after. Please do **NOT** put your important data on the site.
- The demo site [try.gogs.io](https://try.gogs.io) is running under `develop` branch.
-- :exclamation::exclamation::exclamation:You **MUST** read [CONTRIBUTING.md](CONTRIBUTING.md) before you start filing an issue or making a Pull Request, and **MUST** discuss with us on [Gitter](https://gitter.im/gogits/gogs) for UI changes and feature Pull Requests, otherwise it's high possibilities that we are not going to merge it.:exclamation::exclamation::exclamation:
+- :bangbang:You **MUST** read [CONTRIBUTING.md](CONTRIBUTING.md) before you start filing an issue or making a Pull Request, and **MUST** discuss with us on [Gitter](https://gitter.im/gogits/gogs) for UI changes and feature Pull Requests, otherwise it's high possibilities that we are not going to merge it.:bangbang:
- If you think there are vulnerabilities in the project, please talk privately to **u@gogs.io**. Thanks!
+- If you're interested in using APIs, we have experimental support with [documentation](https://github.com/gogits/go-gogs-client/wiki).
+- If your team/company is using Gogs and would like to put your logo on [our website](http://gogs.io), contact us by any means.
-#### Other language version
-
-- [简体中文](README_ZH.md)
+[简体中文](README_ZH.md)
## Purpose
-The goal of this project is to make the easiest, fastest, and most painless way of setting up a self-hosted Git service. With Go, this can be done with an independent binary distribution across **ALL platforms** that Go supports, including Linux, Mac OS X, and Windows.
+The goal of this project is to make the easiest, fastest, and most painless way of setting up a self-hosted Git service. With Go, this can be done with an independent binary distribution across **ALL platforms** that Go supports, including Linux, Mac OS X, Windows and ARM.
## Overview
-- Please see the [Documentation](http://gogs.io/docs/intro/) for project design, known issues, and change log.
+- Please see the [Documentation](http://gogs.io/docs/intro) for common usages and change log.
- See the [Trello Board](https://trello.com/b/uxAoeLUl/gogs-go-git-service) to follow the develop team.
- Want to try it before doing anything else? Do it [online](https://try.gogs.io/gogs/gogs) or go down to the **Installation -> Install from binary** section!
- Having trouble? Get help with [Troubleshooting](http://gogs.io/docs/intro/troubleshooting.html).
@@ -51,24 +51,25 @@ The goal of this project is to make the easiest, fastest, and most painless way
## Features
- Activity timeline
-- SSH/HTTP(S) protocol support
-- SMTP/LDAP/reverse proxy authentication support
-- Reverse proxy suburl support
-- Account/Organization(with team)/Repository management
-- Repository/Organization webhooks(including Slack)
+- SSH and HTTP/HTTPS protocols
+- SMTP/LDAP/Reverse proxy authentication
+- Reverse proxy with sub-path
+- Account/Organization/Repository management
+- Repository/Organization webhooks (including Slack)
- Repository Git hooks/deploy keys
-- Add/remove repository collaborators
-- Gravatar and custom source support
+- Repository issues and pull requests
+- Add/Remove repository collaborators
+- Gravatar and custom source
- Mail service
- Administration panel
- CI integration: [Drone](https://github.com/drone/drone)
-- Supports MySQL, PostgreSQL, SQLite3 and [TiDB](https://github.com/pingcap/tidb)
+- Supports MySQL, PostgreSQL, SQLite3 and [TiDB](https://github.com/pingcap/tidb) (experimental)
- Multi-language support ([14 languages](https://crowdin.com/project/gogs))
## System Requirements
- A cheap Raspberry Pi is powerful enough for basic functionality.
-- At least 2 CPU cores and 1GB RAM would be the baseline for teamwork.
+- 2 CPU cores and 1GB RAM would be the baseline for teamwork.
## Browser Support
@@ -77,7 +78,7 @@ The goal of this project is to make the easiest, fastest, and most painless way
## Installation
-Make sure you install the [prerequisites](http://gogs.io/docs/installation/) first.
+Make sure you install the [prerequisites](http://gogs.io/docs/installation) first.
There are 5 ways to install Gogs:
@@ -91,6 +92,7 @@ There are 5 ways to install Gogs:
- [How To Set Up Gogs on Ubuntu 14.04](https://www.digitalocean.com/community/tutorials/how-to-set-up-gogs-on-ubuntu-14-04)
- [Run your own GitHub-like service with the help of Docker](http://blog.hypriot.com/post/run-your-own-github-like-service-with-docker/)
+- [使用 Gogs 搭建自己的 Git 服务器](https://mynook.info/blog/post/host-your-own-git-server-using-gogs) (Chinese)
- [阿里云上 Ubuntu 14.04 64 位安装 Gogs](http://my.oschina.net/luyao/blog/375654) (Chinese)
- [Installing Gogs on FreeBSD](https://www.codejam.info/2015/03/installing-gogs-on-freebsd.html)
- [Gogs on Raspberry Pi](http://blog.meinside.pe.kr/Gogs-on-Raspberry-Pi/)
@@ -105,18 +107,25 @@ There are 5 ways to install Gogs:
- [Cloudron](https://cloudron.io/appstore.html#io.gogs.cloudronapp)
- [Scaleway](https://www.scaleway.com/imagehub/gogs/)
- [Portal](https://portaldemo.xyz/cloud/)
+- [Sandstorm](https://github.com/cem/gogs-sandstorm)
+
+### Product Support
+
+- [Synology](https://www.synology.com) (Docker)
+- [One Space](http://www.onespace.cc) (App Store)
## Acknowledgments
-- Router and middleware mechanism of [Macaron](https://github.com/Unknwon/macaron).
-- Mail Service, modules design is inspired by [WeTalk](https://github.com/beego/wetalk).
+- Router and middleware mechanism of [Macaron](https://github.com/go-macaron/macaron).
+- Modules design is inspired by [WeTalk](https://github.com/beego/wetalk).
- System Monitor Status is inspired by [GoBlog](https://github.com/fuxiaohei/goblog).
- Thanks [lavachen](http://www.lavachen.cn/) and [Rocker](http://weibo.com/rocker1989) for designing Logo.
- Thanks [Crowdin](https://crowdin.com/project/gogs) for providing open source translation plan.
+- Thanks [DigitalOcean](https://www.digitalocean.com) for hosting home and demo sites.
## Contributors
-- Ex-team members [@lunny](https://github.com/lunny) and [@fuxiaohei](https://github.com/fuxiaohei).
+- Ex-team members [@lunny](https://github.com/lunny), [@fuxiaohei](https://github.com/fuxiaohei) and [@slene](https://github.com/slene).
- See [contributors page](https://github.com/gogits/gogs/graphs/contributors) for full list of contributors.
- See [TRANSLATORS](conf/locale/TRANSLATORS) for public list of translators.
diff --git a/README_ZH.md b/README_ZH.md
index 471cc79aa..a529b3ab7 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -1,15 +1,15 @@
Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?branch=master)](https://travis-ci.org/gogits/gogs)
=====================
-Gogs (Go Git Service) 是一款可轻易搭建的自助 Git 服务。
+Gogs (Go Git Service) 是一款极易搭建的自助 Git 服务。
## 开发目的
-Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自助 Git 服务。使用 Go 语言开发使得 Gogs 能够通过独立的二进制分发,并且支持 Go 语言支持的 **所有平台**,包括 Linux、Mac OS X 以及 Windows。
+Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自助 Git 服务。使用 Go 语言开发使得 Gogs 能够通过独立的二进制分发,并且支持 Go 语言支持的 **所有平台**,包括 Linux、Mac OS X、Windows 以及 ARM 平台。
## 项目概览
-- 有关项目设计、已知问题和变更日志,请通过 [使用手册](http://gogs.io/docs/intro/) 查看。
+- 有关基本用法和变更日志,请通过 [使用手册](http://gogs.io/docs/intro/) 查看。
- 您可以到 [Trello Board](https://trello.com/b/uxAoeLUl/gogs-go-git-service) 跟随开发团队的脚步。
- 想要先睹为快?通过 [在线体验](https://try.gogs.io/gogs/gogs) 或查看 **安装部署 -> 二进制安装** 小节。
- 使用过程中遇到问题?尝试从 [故障排查](http://gogs.io/docs/intro/troubleshooting.html) 页面获取帮助。
@@ -18,18 +18,19 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自
## 功能特性
- 支持活动时间线
-- 支持 SSH/HTTP(S) 协议
-- 支持 SMTP/LDAP/反向代理的用户认证
+- 支持 SSH 以及 HTTP/HTTPS 协议
+- 支持 SMTP、LDAP 和反向代理的用户认证
- 支持反向代理子路径
- 支持用户、组织和仓库管理系统
- 支持仓库和组织级别 Web 钩子(包括 Slack 集成)
- 支持仓库 Git 钩子和部署密钥
-- 支持 添加/删除 仓库协作者
+- 支持仓库工单(Issue)和合并请求(Pull Request)
+- 支持添加和删除仓库协作者
- 支持 Gravatar 以及自定义源
- 支持邮件服务
- 支持后台管理面板
- 支持 CI 集成:[Drone](https://github.com/drone/drone)
-- 支持 MySQL、PostgreSQL、SQLite3 和 [TiDB](https://github.com/pingcap/tidb) 数据库
+- 支持 MySQL、PostgreSQL、SQLite3 和 [TiDB](https://github.com/pingcap/tidb)(实验性支持) 数据库
- 支持多语言本地化([14 种语言]([more](https://crowdin.com/project/gogs)))
## 系统要求
@@ -44,7 +45,7 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自
## 安装部署
-在安装 Gogs 之前,您需要先安装 [基本环境](http://gogs.io/docs/installation/)。
+在安装 Gogs 之前,您需要先安装 [基本环境](http://gogs.io/docs/installation)。
然后,您可以通过以下 5 种方式来安装 Gogs:
@@ -54,17 +55,36 @@ Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自
- [采用 Docker 部署](https://github.com/gogits/gogs/tree/master/docker)
- [通过 Vagrant 安装](https://github.com/geerlingguy/ansible-vagrant-examples/tree/master/gogs)
+### 使用教程
+
+- [使用 Gogs 搭建自己的 Git 服务器](https://mynook.info/blog/post/host-your-own-git-server-using-gogs)
+- [阿里云上 Ubuntu 14.04 64 位安装 Gogs](http://my.oschina.net/luyao/blog/375654)
+
+### 云端部署
+
+- [OpenShift](https://github.com/tkisme/gogs-openshift)
+- [Cloudron](https://cloudron.io/appstore.html#io.gogs.cloudronapp)
+- [Scaleway](https://www.scaleway.com/imagehub/gogs/)
+- [Portal](https://portaldemo.xyz/cloud/)
+- [Sandstorm](https://github.com/cem/gogs-sandstorm)
+
+### 产品支持
+
+- [Synology](https://www.synology.com)(Docker)
+- [One Space](http://www.onespace.cc)(应用商店)
+
## 特别鸣谢
-- 基于 [Macaron](https://github.com/Unknwon/macaron) 的路由与中间件机制。
-- 基于 [WeTalk](https://github.com/beego/wetalk) 修改的邮件服务和模块设计。
+- 基于 [Macaron](https://github.com/go-macaron/macaron) 的路由与中间件机制。
+- 基于 [WeTalk](https://github.com/beego/wetalk) 修改的模块设计。
- 基于 [GoBlog](https://github.com/fuxiaohei/goblog) 修改的系统监视状态。
- 感谢 [lavachen](http://www.lavachen.cn/) 和 [Rocker](http://weibo.com/rocker1989) 设计的 Logo。
- 感谢 [Crowdin](https://crowdin.com/project/gogs) 提供免费的开源项目本地化支持。
+- 感谢 [DigitalOcean](https://www.digitalocean.com) 提供主站和体验站点的服务器赞助。
## 贡献成员
-- 前团队成员 [@lunny](https://github.com/lunny) 和 [@fuxiaohei](https://github.com/fuxiaohei)。
+- 前团队成员 [@lunny](https://github.com/lunny)、[@fuxiaohei](https://github.com/fuxiaohei) 和 [@slene](https://github.com/slene)。
- 您可以通过查看 [贡献者页面](https://github.com/gogits/gogs/graphs/contributors) 获取完整的贡献者列表。
- 您可以通过查看 [TRANSLATORS](conf/locale/TRANSLATORS) 文件获取公开的翻译人员列表。
diff --git a/cmd/cert.go b/cmd/cert.go
index 5b182da9e..7b68f330e 100644
--- a/cmd/cert.go
+++ b/cmd/cert.go
@@ -32,12 +32,12 @@ var CmdCert = cli.Command{
Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`,
Action: runCert,
Flags: []cli.Flag{
- cli.StringFlag{"host", "", "Comma-separated hostnames and IPs to generate a certificate for", ""},
- cli.StringFlag{"ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521", ""},
- cli.IntFlag{"rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set", ""},
- cli.StringFlag{"start-date", "", "Creation date formatted as Jan 1 15:04:05 2011", ""},
- cli.DurationFlag{"duration", 365 * 24 * time.Hour, "Duration that certificate is valid for", ""},
- cli.BoolFlag{"ca", "whether this cert should be its own Certificate Authority", ""},
+ stringFlag("host", "", "Comma-separated hostnames and IPs to generate a certificate for"),
+ stringFlag("ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521"),
+ intFlag("rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set"),
+ stringFlag("start-date", "", "Creation date formatted as Jan 1 15:04:05 2011"),
+ durationFlag("duration", 365*24*time.Hour, "Duration that certificate is valid for"),
+ boolFlag("ca", "whether this cert should be its own Certificate Authority"),
},
}
diff --git a/cmd/cmd.go b/cmd/cmd.go
new file mode 100644
index 000000000..8df02d5c7
--- /dev/null
+++ b/cmd/cmd.go
@@ -0,0 +1,42 @@
+// Copyright 2015 The Gogs Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package cmd
+
+import (
+ "time"
+
+ "github.com/codegangsta/cli"
+)
+
+func stringFlag(name, value, usage string) cli.StringFlag {
+ return cli.StringFlag{
+ Name: name,
+ Value: value,
+ Usage: usage,
+ }
+}
+
+func boolFlag(name, usage string) cli.BoolFlag {
+ return cli.BoolFlag{
+ Name: name,
+ Usage: usage,
+ }
+}
+
+func intFlag(name string, value int, usage string) cli.IntFlag {
+ return cli.IntFlag{
+ Name: name,
+ Value: value,
+ Usage: usage,
+ }
+}
+
+func durationFlag(name string, value time.Duration, usage string) cli.DurationFlag {
+ return cli.DurationFlag{
+ Name: name,
+ Value: value,
+ Usage: usage,
+ }
+}
diff --git a/cmd/dump.go b/cmd/dump.go
index 44b180c32..0bf385d06 100644
--- a/cmd/dump.go
+++ b/cmd/dump.go
@@ -25,8 +25,8 @@ var CmdDump = cli.Command{
It can be used for backup and capture Gogs server image to send to maintainer`,
Action: runDump,
Flags: []cli.Flag{
- cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
- cli.BoolFlag{"verbose, v", "show process details", ""},
+ stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
+ boolFlag("verbose, v", "show process details"),
},
}
diff --git a/cmd/serve.go b/cmd/serve.go
index 34ebe9fbd..b6ab9bb86 100644
--- a/cmd/serve.go
+++ b/cmd/serve.go
@@ -5,6 +5,7 @@
package cmd
import (
+ "crypto/tls"
"fmt"
"os"
"os/exec"
@@ -32,7 +33,7 @@ var CmdServ = cli.Command{
Description: `Serv provide access auth for repositories`,
Action: runServ,
Flags: []cli.Flag{
- cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
+ stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
},
}
@@ -73,7 +74,51 @@ var (
func fail(userMessage, logMessage string, args ...interface{}) {
fmt.Fprintln(os.Stderr, "Gogs:", userMessage)
- log.GitLogger.Fatal(3, logMessage, args...)
+
+ if len(logMessage) > 0 {
+ log.GitLogger.Fatal(3, logMessage, args...)
+ return
+ }
+
+ log.GitLogger.Close()
+ os.Exit(1)
+}
+
+func handleUpdateTask(uuid string, user *models.User, repoUserName, repoName string) {
+ task, err := models.GetUpdateTaskByUUID(uuid)
+ if err != nil {
+ if models.IsErrUpdateTaskNotExist(err) {
+ log.GitLogger.Trace("No update task is presented: %s", uuid)
+ return
+ }
+ log.GitLogger.Fatal(2, "GetUpdateTaskByUUID: %v", err)
+ }
+
+ if err = models.Update(task.RefName, task.OldCommitID, task.NewCommitID,
+ user.Name, repoUserName, repoName, user.Id); err != nil {
+ log.GitLogger.Error(2, "Update: %v", err)
+ }
+
+ if err = models.DeleteUpdateTaskByUUID(uuid); err != nil {
+ log.GitLogger.Fatal(2, "DeleteUpdateTaskByUUID: %v", err)
+ }
+
+ // Ask for running deliver hook and test pull request tasks.
+ reqURL := setting.AppUrl + repoUserName + "/" + repoName + "/tasks/trigger?branch=" +
+ strings.TrimPrefix(task.RefName, "refs/heads/")
+ log.GitLogger.Trace("Trigger task: %s", reqURL)
+
+ resp, err := httplib.Head(reqURL).SetTLSClientConfig(&tls.Config{
+ InsecureSkipVerify: true,
+ }).Response()
+ if err == nil {
+ resp.Body.Close()
+ if resp.StatusCode/100 != 2 {
+ log.GitLogger.Error(2, "Fail to trigger task: not 2xx response code")
+ }
+ } else {
+ log.GitLogger.Error(2, "Fail to trigger task: %v", err)
+ }
}
func runServ(c *cli.Context) {
@@ -94,13 +139,13 @@ func runServ(c *cli.Context) {
}
verb, args := parseCmd(cmd)
- repoPath := strings.Trim(args, "'")
+ repoPath := strings.ToLower(strings.Trim(args, "'"))
rr := strings.SplitN(repoPath, "/", 2)
if len(rr) != 2 {
fail("Invalid repository path", "Invalid repository path: %v", args)
}
- repoUserName := rr[0]
- repoName := strings.TrimSuffix(rr[1], ".git")
+ repoUserName := strings.ToLower(rr[0])
+ repoName := strings.ToLower(strings.TrimSuffix(rr[1], ".git"))
repoUser, err := models.GetUserByName(repoUserName)
if err != nil {
@@ -123,6 +168,11 @@ func runServ(c *cli.Context) {
fail("Unknown git command", "Unknown git command %s", verb)
}
+ // Prohibit push to mirror repositories.
+ if requestedMode > models.ACCESS_MODE_READ && repo.IsMirror {
+ fail("mirror repository is read-only", "")
+ }
+
// Allow anonymous clone for public repositories.
var (
keyID int64
@@ -131,12 +181,12 @@ func runServ(c *cli.Context) {
if requestedMode == models.ACCESS_MODE_WRITE || repo.IsPrivate {
keys := strings.Split(c.Args()[0], "-")
if len(keys) != 2 {
- fail("Key ID format error", "Invalid key ID: %s", c.Args()[0])
+ fail("Key ID format error", "Invalid key argument: %s", c.Args()[0])
}
key, err := models.GetPublicKeyByID(com.StrTo(keys[1]).MustInt64())
if err != nil {
- fail("Key ID format error", "Invalid key ID[%s]: %v", c.Args()[0], err)
+ fail("Invalid key ID", "Invalid key ID[%s]: %v", c.Args()[0], err)
}
keyID = key.ID
@@ -161,7 +211,7 @@ func runServ(c *cli.Context) {
fail("Internal error", "UpdateDeployKey: %v", err)
}
} else {
- user, err = models.GetUserByKeyId(key.ID)
+ user, err = models.GetUserByKeyID(key.ID)
if err != nil {
fail("internal error", "Failed to get user by key ID(%d): %v", keyID, err)
}
@@ -200,32 +250,7 @@ func runServ(c *cli.Context) {
}
if requestedMode == models.ACCESS_MODE_WRITE {
- tasks, err := models.GetUpdateTasksByUuid(uuid)
- if err != nil {
- log.GitLogger.Fatal(2, "GetUpdateTasksByUuid: %v", err)
- }
-
- for _, task := range tasks {
- err = models.Update(task.RefName, task.OldCommitId, task.NewCommitId,
- user.Name, repoUserName, repoName, user.Id)
- if err != nil {
- log.GitLogger.Error(2, "Failed to update: %v", err)
- }
- }
-
- if err = models.DelUpdateTasksByUuid(uuid); err != nil {
- log.GitLogger.Fatal(2, "DelUpdateTasksByUuid: %v", err)
- }
- }
-
- // Send deliver hook request.
- reqURL := setting.AppUrl + repoUserName + "/" + repoName + "/hooks/trigger"
- resp, err := httplib.Head(reqURL).Response()
- if err == nil {
- resp.Body.Close()
- log.GitLogger.Trace("Trigger hook: %s", reqURL)
- } else {
- log.GitLogger.Error(2, "Fail to trigger hook: %v", err)
+ handleUpdateTask(uuid, user, repoUserName, repoName)
}
// Update user key activity.
diff --git a/cmd/update.go b/cmd/update.go
index c9eaeccf7..4cd62a7f5 100644
--- a/cmd/update.go
+++ b/cmd/update.go
@@ -20,7 +20,7 @@ var CmdUpdate = cli.Command{
Description: `Update get pushed info and insert into database`,
Action: runUpdate,
Flags: []cli.Flag{
- cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
+ stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
},
}
@@ -42,16 +42,14 @@ func runUpdate(c *cli.Context) {
log.GitLogger.Fatal(2, "refName is empty, shouldn't use")
}
- uuid := os.Getenv("uuid")
-
task := models.UpdateTask{
- Uuid: uuid,
+ UUID: os.Getenv("uuid"),
RefName: args[0],
- OldCommitId: args[1],
- NewCommitId: args[2],
+ OldCommitID: args[1],
+ NewCommitID: args[2],
}
if err := models.AddUpdateTask(&task); err != nil {
- log.GitLogger.Fatal(2, err.Error())
+ log.GitLogger.Fatal(2, "AddUpdateTask: %v", err)
}
}
diff --git a/cmd/web.go b/cmd/web.go
index c4712c59b..159356a55 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -7,7 +7,7 @@ package cmd
import (
"crypto/tls"
"fmt"
- "html/template"
+ gotmpl "html/template"
"io/ioutil"
"net/http"
"net/http/fcgi"
@@ -35,11 +35,11 @@ import (
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/auth/apiv1"
"github.com/gogits/gogs/modules/avatar"
- "github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/bindata"
"github.com/gogits/gogs/modules/log"
"github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/modules/setting"
+ "github.com/gogits/gogs/modules/template"
"github.com/gogits/gogs/routers"
"github.com/gogits/gogs/routers/admin"
"github.com/gogits/gogs/routers/api/v1"
@@ -56,8 +56,8 @@ var CmdWeb = cli.Command{
and it takes care of all the other things for you`,
Action: runWeb,
Flags: []cli.Flag{
- cli.StringFlag{"port, p", "3000", "Temporary port number to prevent conflict", ""},
- cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
+ stringFlag("port, p", "3000", "Temporary port number to prevent conflict"),
+ stringFlag("config, c", "custom/conf/app.ini", "Custom configuration file path"),
},
}
@@ -80,13 +80,14 @@ func checkVersion() {
// Check dependency version.
checkers := []VerChecker{
- {"github.com/go-xorm/xorm", func() string { return xorm.Version }, "0.4.3.0806"},
+ {"github.com/go-xorm/xorm", func() string { return xorm.Version }, "0.4.4.1029"},
{"github.com/Unknwon/macaron", macaron.Version, "0.5.4"},
- {"github.com/macaron-contrib/binding", binding.Version, "0.1.0"},
- {"github.com/macaron-contrib/cache", cache.Version, "0.1.2"},
- {"github.com/macaron-contrib/csrf", csrf.Version, "0.0.3"},
- {"github.com/macaron-contrib/i18n", i18n.Version, "0.0.7"},
- {"github.com/macaron-contrib/session", session.Version, "0.1.6"},
+ {"github.com/go-macaron/binding", binding.Version, "0.1.0"},
+ {"github.com/go-macaron/cache", cache.Version, "0.1.2"},
+ {"github.com/go-macaron/csrf", csrf.Version, "0.0.3"},
+ {"github.com/go-macaron/i18n", i18n.Version, "0.0.7"},
+ {"github.com/go-macaron/session", session.Version, "0.1.6"},
+ {"github.com/go-macaron/toolbox", toolbox.Version, "0.1.0"},
{"gopkg.in/ini.v1", ini.Version, "1.3.4"},
}
for _, c := range checkers {
@@ -124,7 +125,7 @@ func newMacaron() *macaron.Macaron {
))
m.Use(macaron.Renderer(macaron.RenderOptions{
Directory: path.Join(setting.StaticRootPath, "templates"),
- Funcs: []template.FuncMap{base.TemplateFuncs},
+ Funcs: []gotmpl.FuncMap{template.Funcs},
IndentJSON: macaron.Env != macaron.PROD,
}))
@@ -226,14 +227,14 @@ func runWeb(ctx *cli.Context) {
m.Group("/repos", func() {
m.Get("/search", v1.SearchRepos)
+ })
- m.Group("", func() {
- m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), v1.MigrateRepo)
- m.Delete("/:username/:reponame", v1.DeleteRepo)
- }, middleware.ApiReqToken())
+ m.Group("/repos", func() {
+ m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), v1.MigrateRepo)
+ m.Combo("/:username/:reponame").Get(v1.GetRepo).
+ Delete(v1.DeleteRepo)
m.Group("/:username/:reponame", func() {
- m.Get("", v1.GetRepo)
m.Combo("/hooks").Get(v1.ListRepoHooks).
Post(bind(api.CreateHookOption{}), v1.CreateRepoHook)
@@ -253,8 +254,8 @@ func runWeb(ctx *cli.Context) {
Post(bindIgnErr(api.CreateReleaseOption{}), v1.CreateRelease)
m.Get("/:release", v1.ReleaseByName)
}, middleware.RepoRef())
- }, middleware.ApiRepoAssignment(), middleware.ApiReqToken())
- })
+ }, middleware.ApiRepoAssignment())
+ }, middleware.ApiReqToken())
m.Any("/*", func(ctx *middleware.Context) {
ctx.Error(404)
@@ -478,8 +479,10 @@ func runWeb(ctx *cli.Context) {
m.Post("/delete", repo.DeleteDeployKey)
})
+ }, func(ctx *middleware.Context) {
+ ctx.Data["PageIsSettings"] = true
})
- }, reqSignIn, middleware.RepoAssignment(true), reqRepoAdmin)
+ }, reqSignIn, middleware.RepoAssignment(true), reqRepoAdmin, middleware.RepoRef())
m.Group("/:username/:reponame", func() {
m.Get("/action/:action", repo.Action)
@@ -527,11 +530,17 @@ func runWeb(ctx *cli.Context) {
}, reqSignIn, middleware.RepoAssignment(true))
m.Group("/:username/:reponame", func() {
- m.Get("/releases", middleware.RepoRef(), repo.Releases)
- m.Get("/^:type(issues|pulls)$", repo.RetrieveLabels, repo.Issues)
+ m.Group("", func() {
+ m.Get("/releases", repo.Releases)
+ m.Get("/^:type(issues|pulls)$", repo.RetrieveLabels, repo.Issues)
+ m.Get("/labels/", repo.RetrieveLabels, repo.Labels)
+ m.Get("/milestones", repo.Milestones)
+ }, middleware.RepoRef(),
+ func(ctx *middleware.Context) {
+ ctx.Data["PageIsList"] = true
+ })
m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue)
- m.Get("/labels/", repo.RetrieveLabels, repo.Labels)
- m.Get("/milestones", repo.Milestones)
+
m.Get("/branches", repo.Branches)
m.Get("/archive/*", repo.Download)
@@ -561,8 +570,8 @@ func runWeb(ctx *cli.Context) {
}, ignSignIn, middleware.RepoAssignment(true, true), middleware.RepoRef())
m.Group("/:reponame", func() {
- m.Any("/*", ignSignInAndCsrf, repo.Http)
- m.Head("/hooks/trigger", repo.TriggerHook)
+ m.Any("/*", ignSignInAndCsrf, repo.HTTP)
+ m.Head("/tasks/trigger", repo.TriggerTask)
})
})
// ***** END: Repository *****
diff --git a/conf/app.ini b/conf/app.ini
index 213d94511..5c7ce6983 100644
--- a/conf/app.ini
+++ b/conf/app.ini
@@ -11,6 +11,12 @@ RUN_MODE = dev
[repository]
ROOT =
SCRIPT_TYPE = bash
+; Default ANSI charset
+ANSI_CHARSET =
+; Force every new repository to be private
+FORCE_PRIVATE = false
+; Patch test queue length, make it as large as possible
+PULL_REQUEST_QUEUE_LENGTH = 10000
[ui]
; Number of repositories that are showed in one explore page
@@ -42,6 +48,8 @@ HTTP_ADDR =
HTTP_PORT = 3000
; Disable SSH feature when not available
DISABLE_SSH = false
+; Whether use builtin SSH server or not.
+START_SSH_SERVER = false
SSH_PORT = 22
; Disable CDN even in "prod" mode
OFFLINE_MODE = false
@@ -110,6 +118,16 @@ DISABLE_MINIMUM_KEY_SIZE_CHECK = false
; Enable captcha validation for registration
ENABLE_CAPTCHA = true
+; used to filter keys which are too short
+[service.minimum_key_sizes]
+ED25519 = 256
+ECDSA = 256
+NTRU = 1087
+MCE = 1702
+McE = 1702
+RSA = 1024
+DSA = 1024
+
[webhook]
; Hook task queue length
QUEUE_LENGTH = 1000
diff --git a/conf/gitignore/Clojure.gitignore b/conf/gitignore/Clojure.gitignore
deleted file mode 120000
index 7657a270c..000000000
--- a/conf/gitignore/Clojure.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-Leiningen.gitignore
\ No newline at end of file
diff --git a/conf/gitignore/Fortran.gitignore b/conf/gitignore/Fortran.gitignore
deleted file mode 120000
index 5daba98a3..000000000
--- a/conf/gitignore/Fortran.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-C++.gitignore
\ No newline at end of file
diff --git a/conf/locale/TRANSLATORS b/conf/locale/TRANSLATORS
index 7c6eb0baf..c7d7f9ed5 100644
--- a/conf/locale/TRANSLATORS
+++ b/conf/locale/TRANSLATORS
@@ -1,20 +1,29 @@
# This file lists all PUBLIC individuals having contributed content to the translation.
-# Order of name is meaningless.
+# Entries are in alphabetical order.
-Akihiro YAGASAKI
-Alexander Steinhöfer
-Alexandre Magno
-Barış Arda Yılmaz
-Christoph Kisfeld
-Daniel Speichert
-Gregor Santner
-Huimin Wang
-ilko
-Thomas Fanninger
-Łukasz Jan Niemier
-Lafriks
-Luc Stepniewski
-Miguel de la Cruz
-Marc Schiller
-Morten Sørensen
-Natan Albuquerque
\ No newline at end of file
+Akihiro YAGASAKI
+Alexander Steinhöfer
+Alexandre Magno
+Andrey Nering
+Arthur Aslanyan
+Barış Arda Yılmaz
+Christoph Kisfeld
+Daniel Speichert
+Dmitriy Nogay
+Gregor Santner
+Hamid Feizabadi
+Huimin Wang
+ilko
+Lafriks
+Lauri Ojansivu
+Luc Stepniewski
+Marc Schiller
+Miguel de la Cruz
+Morten Sørensen
+Natan Albuquerque
+Odilon Junior
+Thomas Fanninger
+Tilmann Bach
+Vladimir Vissoultchev
+YJSoft
+Łukasz Jan Niemier
\ No newline at end of file
diff --git a/conf/locale/locale_bg-BG.ini b/conf/locale/locale_bg-BG.ini
index 857d2cef6..00342a196 100755
--- a/conf/locale/locale_bg-BG.ini
+++ b/conf/locale/locale_bg-BG.ini
@@ -148,7 +148,6 @@ forgot_password=Забравена парола
forget_password=Забравена парола?
sign_up_now=Нуждаете се от профил? Регистрирайте се сега.
confirmation_mail_sent_prompt=Ново писмо за потвърждение е изпратено до %s. Моля проверете пощенската си кутия в рамките на следващите %d часа, за да завършите процеса на регистрация.
-sign_in_to_account=Влезте с Вашия профил
active_your_account=Активиране на профил
resent_limit_prompt=За съжаление Вие съвсем наскоро изпратихте писмо за активация. Моля изчакайте 3 минути, след което опитайте отново.
has_unconfirmed_mail=Здравейте %s, имате непотвърден адрес на ел. поща (%s). Ако не сте получили писмо за потвърждение или имате нужда да се изпрати ново писмо, моля щракнете бутона по-долу.
@@ -192,6 +191,7 @@ min_size_error=` трябва да съдържа поне %s знака.`
max_size_error=` трябва да съдържа най-много %s знака.`
email_error=` не е валиден адрес на ел. поща.`
url_error=` не е валиден URL адрес.`
+include_error=` трябва да съдържа текст '%s'.`
unknown_error=Неизвестна грешка:
captcha_incorrect=Captcha не е потвърдена.
password_not_match=Паролата и потвърждението ѝ не съвпадат.
@@ -334,6 +334,7 @@ repo_name=Име на хранилището
repo_name_helper=Добро име на хранилище е име, състоящо от кратки, запомнящи се и уникални ключови думи.
visibility=Видимост
visiblity_helper=Това хранилище е Частно
+visiblity_helper_forced=Административна настройка задължава всички нови хранилища да бъдат Частни
visiblity_fork_helper=(Промяна на тази стойност ще се отрази на всички разклонения)
fork_repo=Разклони хранилището
fork_from=Разклонение от
@@ -359,6 +360,7 @@ migrate_type_helper=Това хранилище ще бъде