1
0
هذا الالتزام موجود في:
Thomas Miceli
2023-03-18 23:53:05 +01:00
الأصل bd64922554
التزام b505f7147e
2 ملفات معدلة مع 12 إضافات و1 حذوفات

عرض الملف

@@ -58,6 +58,7 @@ func parseLog(out io.Reader) []*Commit {
var currentCommit *Commit
var currentFile *File
var isContent bool
var bytesRead = 0
for scanner.Scan() {
// new commit found
@@ -103,6 +104,7 @@ func parseLog(out io.Reader) []*Commit {
// create a new file
isContent = false
bytesRead = 0
currentFile = &File{}
filenameRegex := regexp.MustCompile(`^diff --git a/(.+) b/(.+)$`)
matches := filenameRegex.FindStringSubmatch(string(line))
@@ -131,6 +133,13 @@ func parseLog(out io.Reader) []*Commit {
if isContent {
currentFile.Content += string(line) + "\n"
bytesRead += len(line)
if bytesRead > 2<<18 {
currentFile.Truncated = true
currentFile.Content = ""
isContent = false
}
}
scanner.Scan()

عرض الملف

@@ -39,7 +39,9 @@
</p>
</div>
<div class="code overflow-auto">
{{ if and (eq $file.Content "") (ne $file.OldFilename "") }}
{{ if $file.Truncated }}
<p class="m-2 ml-4 text-xs">Diff truncated because its too large to be shown</p>
{{ else if and (eq $file.Content "") (ne $file.OldFilename "") }}
<p class="m-2 ml-4 text-xs">File renamed without changes</p>
{{ else if eq $file.Content "" }}
<p class="m-2 ml-4 text-xs">Empty file</p>