Browse Source

#3464 reproduce diff signs

Commited wrong file.
pull/3473/head
Unknwon 8 years ago
parent
commit
9349def72e
  1. 2
      README.md
  2. 2
      gogs.go
  3. 11
      models/git_diff.go
  4. 2
      templates/.VERSION

2
README.md

@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true)
##### Current tip version: 0.9.80 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions) ##### Current tip version: 0.9.81 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions)
| Web | UI | Preview | | Web | UI | Preview |
|:-------------:|:-------:|:-------:| |:-------------:|:-------:|:-------:|

2
gogs.go

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.9.80.0815" const APP_VER = "0.9.81.0816"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

11
models/git_diff.go

@ -72,6 +72,15 @@ var (
func diffToHTML(diffs []diffmatchpatch.Diff, lineType DiffLineType) template.HTML { func diffToHTML(diffs []diffmatchpatch.Diff, lineType DiffLineType) template.HTML {
buf := bytes.NewBuffer(nil) buf := bytes.NewBuffer(nil)
// Reproduce signs which are cutted for inline diff before.
switch lineType {
case DIFF_LINE_ADD:
buf.WriteByte('+')
case DIFF_LINE_DEL:
buf.WriteByte('-')
}
for i := range diffs { for i := range diffs {
switch { switch {
case diffs[i].Type == diffmatchpatch.DiffInsert && lineType == DIFF_LINE_ADD: case diffs[i].Type == diffmatchpatch.DiffInsert && lineType == DIFF_LINE_ADD:
@ -167,7 +176,7 @@ func (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine) tem
diff1 = diffLine.Content diff1 = diffLine.Content
diff2 = compareDiffLine.Content diff2 = compareDiffLine.Content
default: default:
return template.HTML(html.EscapeString(diffLine.Content[1:])) return template.HTML(html.EscapeString(diffLine.Content))
} }
diffRecord := diffMatchPatch.DiffMain(diff1[1:], diff2[1:], true) diffRecord := diffMatchPatch.DiffMain(diff1[1:], diff2[1:], true)

2
templates/.VERSION

@ -1 +1 @@
0.9.80.0815 0.9.81.0816
Loading…
Cancel
Save