On showing diff/file, use the tab_width specified on .editorconfig, if any (#3241)

Closes #3182
This commit is contained in:
Andrey Nering 2016-08-11 21:07:09 -03:00 committed by 无闻
parent aa1fc30b89
commit dbed39ba05
9 changed files with 137 additions and 2 deletions

View file

@ -174,6 +174,13 @@ func Diff(ctx *context.Context) {
}
}
ec, err := ctx.Repo.GetEditorconfig()
if err != nil && !git.IsErrNotExist(err) {
ctx.Handle(500, "ErrGettingEditorconfig", err)
return
}
ctx.Data["Editorconfig"] = ec
ctx.Data["CommitID"] = commitID
ctx.Data["IsSplitStyle"] = ctx.Query("style") == "split"
ctx.Data["Username"] = userName

View file

@ -371,6 +371,13 @@ func ViewPullFiles(ctx *context.Context) {
return
}
ec, err := ctx.Repo.GetEditorconfig()
if err != nil && !git.IsErrNotExist(err) {
ctx.Handle(500, "ErrGettingEditorconfig", err)
return
}
ctx.Data["Editorconfig"] = ec
headTarget := path.Join(pull.HeadUserName, pull.HeadRepo.Name)
ctx.Data["IsSplitStyle"] = ctx.Query("style") == "split"
ctx.Data["Username"] = pull.HeadUserName
@ -623,6 +630,13 @@ func CompareAndPullRequest(ctx *context.Context) {
}
}
ec, err := ctx.Repo.GetEditorconfig()
if err != nil && !git.IsErrNotExist(err) {
ctx.Handle(500, "ErrGettingEditorconfig", err)
return
}
ctx.Data["Editorconfig"] = ec
ctx.HTML(200, COMPARE_PULL)
}

View file

@ -225,6 +225,12 @@ func Home(ctx *context.Context) {
ctx.Data["Username"] = userName
ctx.Data["Reponame"] = repoName
ec, err := ctx.Repo.GetEditorconfig()
if err != nil && !git.IsErrNotExist(err) {
ctx.Handle(500, "ErrGettingEditorconfig", err)
return
}
ctx.Data["Editorconfig"] = ec
var treenames []string
paths := make([]string, 0)