From 9349def72e687c590ed34403f7663c309376610e Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 16 Aug 2016 07:33:53 -0700 Subject: [PATCH] #3464 reproduce diff signs Commited wrong file. --- README.md | 2 +- gogs.go | 2 +- models/git_diff.go | 11 ++++++++++- templates/.VERSION | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6697482257..89069f1e5c 100644 --- a/README.md +++ b/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) -##### 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 | |:-------------:|:-------:|:-------:| diff --git a/gogs.go b/gogs.go index 8882daa7ea..5455eb2cd1 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.9.80.0815" +const APP_VER = "0.9.81.0816" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/git_diff.go b/models/git_diff.go index a63a1bb999..a45c44345b 100644 --- a/models/git_diff.go +++ b/models/git_diff.go @@ -72,6 +72,15 @@ var ( func diffToHTML(diffs []diffmatchpatch.Diff, lineType DiffLineType) template.HTML { 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 { switch { case diffs[i].Type == diffmatchpatch.DiffInsert && lineType == DIFF_LINE_ADD: @@ -167,7 +176,7 @@ func (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine) tem diff1 = diffLine.Content diff2 = compareDiffLine.Content default: - return template.HTML(html.EscapeString(diffLine.Content[1:])) + return template.HTML(html.EscapeString(diffLine.Content)) } diffRecord := diffMatchPatch.DiffMain(diff1[1:], diff2[1:], true) diff --git a/templates/.VERSION b/templates/.VERSION index 1bc4bb85d4..d381c8cafc 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.9.80.0815 \ No newline at end of file +0.9.81.0816 \ No newline at end of file