mirror of https://github.com/go-gitea/gitea.git
feat: add git version on admin panel. (#921)
This commit is contained in:
parent
091f063706
commit
5cc275b1de
|
@ -135,13 +135,14 @@ func NewRepoContext() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Git version.
|
// Check Git version.
|
||||||
gitVer, err := git.BinVersion()
|
var err error
|
||||||
|
setting.Git.Version, err = git.BinVersion()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(4, "Failed to get Git version: %v", err)
|
log.Fatal(4, "Failed to get Git version: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Git Version: %s", gitVer)
|
log.Info("Git Version: %s", setting.Git.Version)
|
||||||
if version.Compare("1.7.1", gitVer, ">") {
|
if version.Compare("1.7.1", setting.Git.Version, ">") {
|
||||||
log.Fatal(4, "Gitea requires Git version greater or equal to 1.7.1")
|
log.Fatal(4, "Gitea requires Git version greater or equal to 1.7.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -354,6 +354,7 @@ var (
|
||||||
|
|
||||||
// Git settings
|
// Git settings
|
||||||
Git = struct {
|
Git = struct {
|
||||||
|
Version string `ini:"-"`
|
||||||
DisableDiffHighlight bool
|
DisableDiffHighlight bool
|
||||||
MaxGitDiffLines int
|
MaxGitDiffLines int
|
||||||
MaxGitDiffLineCharacters int
|
MaxGitDiffLineCharacters int
|
||||||
|
|
|
@ -1117,6 +1117,7 @@ config.offline_mode = Offline Mode
|
||||||
config.disable_router_log = Disable Router Log
|
config.disable_router_log = Disable Router Log
|
||||||
config.run_user = Run User
|
config.run_user = Run User
|
||||||
config.run_mode = Run Mode
|
config.run_mode = Run Mode
|
||||||
|
config.git_version = Git Version
|
||||||
config.repo_root_path = Repository Root Path
|
config.repo_root_path = Repository Root Path
|
||||||
config.lfs_root_path = LFS Root Path
|
config.lfs_root_path = LFS Root Path
|
||||||
config.static_file_root_path = Static File Root Path
|
config.static_file_root_path = Static File Root Path
|
||||||
|
|
|
@ -1045,6 +1045,7 @@ config.offline_mode=離線模式
|
||||||
config.disable_router_log=關閉路由日誌
|
config.disable_router_log=關閉路由日誌
|
||||||
config.run_user=執行用戶
|
config.run_user=執行用戶
|
||||||
config.run_mode=執行模式
|
config.run_mode=執行模式
|
||||||
|
config.git_version=Git 版本
|
||||||
config.repo_root_path=儲存庫目錄
|
config.repo_root_path=儲存庫目錄
|
||||||
config.static_file_root_path=靜態檔案目錄
|
config.static_file_root_path=靜態檔案目錄
|
||||||
config.log_file_root_path=日誌檔案目錄
|
config.log_file_root_path=日誌檔案目錄
|
||||||
|
|
|
@ -1045,6 +1045,7 @@ config.offline_mode=離線模式
|
||||||
config.disable_router_log=關閉路由日誌
|
config.disable_router_log=關閉路由日誌
|
||||||
config.run_user=執行用戶
|
config.run_user=執行用戶
|
||||||
config.run_mode=執行模式
|
config.run_mode=執行模式
|
||||||
|
config.git_version=Git 版本
|
||||||
config.repo_root_path=儲存庫目錄
|
config.repo_root_path=儲存庫目錄
|
||||||
config.static_file_root_path=靜態檔案目錄
|
config.static_file_root_path=靜態檔案目錄
|
||||||
config.log_file_root_path=日誌檔案目錄
|
config.log_file_root_path=日誌檔案目錄
|
||||||
|
|
|
@ -200,6 +200,7 @@ func Config(ctx *context.Context) {
|
||||||
ctx.Data["DisableRouterLog"] = setting.DisableRouterLog
|
ctx.Data["DisableRouterLog"] = setting.DisableRouterLog
|
||||||
ctx.Data["RunUser"] = setting.RunUser
|
ctx.Data["RunUser"] = setting.RunUser
|
||||||
ctx.Data["RunMode"] = strings.Title(macaron.Env)
|
ctx.Data["RunMode"] = strings.Title(macaron.Env)
|
||||||
|
ctx.Data["GitVersion"] = setting.Git.Version
|
||||||
ctx.Data["RepoRootPath"] = setting.RepoRootPath
|
ctx.Data["RepoRootPath"] = setting.RepoRootPath
|
||||||
ctx.Data["StaticRootPath"] = setting.StaticRootPath
|
ctx.Data["StaticRootPath"] = setting.StaticRootPath
|
||||||
ctx.Data["LogRootPath"] = setting.LogRootPath
|
ctx.Data["LogRootPath"] = setting.LogRootPath
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
|
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
|
|
||||||
|
<dt>{{.i18n.Tr "admin.config.git_version"}}</dt>
|
||||||
|
<dd>{{.GitVersion}}</dd>
|
||||||
|
|
||||||
|
<div class="ui divider"></div>
|
||||||
|
|
||||||
<dt>{{.i18n.Tr "admin.config.repo_root_path"}}</dt>
|
<dt>{{.i18n.Tr "admin.config.repo_root_path"}}</dt>
|
||||||
<dd>{{.RepoRootPath}}</dd>
|
<dd>{{.RepoRootPath}}</dd>
|
||||||
<dt>{{.i18n.Tr "admin.config.static_file_root_path"}}</dt>
|
<dt>{{.i18n.Tr "admin.config.static_file_root_path"}}</dt>
|
||||||
|
|
Loading…
Reference in New Issue