]> source.dussan.org Git - gitea.git/commitdiff
more on #966
authorUnknwon <u@gogs.io>
Thu, 20 Aug 2015 08:08:26 +0000 (16:08 +0800)
committerUnknwon <u@gogs.io>
Thu, 20 Aug 2015 08:08:26 +0000 (16:08 +0800)
models/git_diff.go

index 9681b3f465c540f465570e84b43f07e092a31a56..6698565001d1bc143c851dffcf741e1001262441 100644 (file)
@@ -169,6 +169,12 @@ func ParsePatch(pid int64, maxlines int, cmd *exec.Cmd, reader io.Reader) (*Diff
                        beg := len(DIFF_HEAD)
                        a := line[beg : (len(line)-beg)/2+beg]
 
+                       // In case file name is surrounded by double quotes(it happens only in git-shell).
+                       if a[0] == '"' {
+                               a = a[1 : len(a)-1]
+                               a = strings.Replace(a, `\"`, `"`, -1)
+                       }
+
                        curFile = &DiffFile{
                                Name:     a[strings.Index(a, "/")+1:],
                                Index:    len(diff.Files) + 1,