this repo has no description
1{{ define "repo/fragments/interdiff" }} 2{{ $repo := index . 0 }} 3{{ $x := index . 1 }} 4{{ $fileTree := fileTree $x.AffectedFiles }} 5{{ $diff := $x.Files }} 6{{ $last := sub (len $diff) 1 }} 7{{ $isSplit := $opts.Split }} 8 9 {{ range $idx, $hunk := $diff }} 10 {{ with $hunk }} 11 <section class="mt-4 border border-gray-200 dark:border-gray-700 w-full mx-auto rounded bg-white dark:bg-gray-800 drop-shadow-sm"> 12 <div id="file-{{ .Name }}"> 13 <div id="diff-file"> 14 <details {{ if not (.Status.IsOnlyInOne) }}open{{end}}> 15 <summary class="list-none cursor-pointer sticky top-0"> 16 <div id="diff-file-header" class="rounded cursor-pointer bg-white dark:bg-gray-800 flex justify-between"> 17 <div id="left-side-items" class="p-2 flex gap-2 items-center overflow-x-auto"> 18 <div class="flex gap-1 items-center" style="direction: ltr;"> 19 {{ $markerstyle := "diff-type p-1 mr-1 font-mono text-sm rounded select-none" }} 20 {{ if .Status.IsOk }} 21 <span class="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 {{ $markerstyle }}">CHANGED</span> 22 {{ else if .Status.IsUnchanged }} 23 <span class="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 {{ $markerstyle }}">UNCHANGED</span> 24 {{ else if .Status.IsOnlyInOne }} 25 <span class="bg-red-100 text-red-700 dark:bg-red-800/50 dark:text-red-400 {{ $markerstyle }}">REVERTED</span> 26 {{ else if .Status.IsOnlyInTwo }} 27 <span class="bg-green-100 text-green-700 dark:bg-green-800/50 dark:text-green-400 {{ $markerstyle }}">NEW</span> 28 {{ else if .Status.IsRebased }} 29 <span class="bg-amber-100 text-amber-700 dark:bg-amber-800/50 dark:text-amber-400 {{ $markerstyle }}">REBASED</span> 30 {{ else }} 31 <span class="bg-red-100 text-red-700 dark:bg-red-800/50 dark:text-red-400 {{ $markerstyle }}">ERROR</span> 32 {{ end }} 33 </div> 34 35 <div class="flex gap-2 items-center overflow-x-auto" style="direction: rtl;"> 36 <a class="dark:text-white whitespace-nowrap overflow-x-auto" href=""> 37 {{ .Name }} 38 </a> 39 </div> 40 </div> 41 42 {{ $iconstyle := "p-1 mx-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded" }} 43 <div id="right-side-items" class="p-2 flex items-center"> 44 <a title="top of file" href="#file-{{ .Name }}" class="{{ $iconstyle }}">{{ i "arrow-up-to-line" "w-4 h-4" }}</a> 45 {{ if gt $idx 0 }} 46 {{ $prev := index $diff (sub $idx 1) }} 47 <a title="previous file" href="#file-{{ $prev.Name }}" class="{{ $iconstyle }}">{{ i "arrow-up" "w-4 h-4" }}</a> 48 {{ end }} 49 50 {{ if lt $idx $last }} 51 {{ $next := index $diff (add $idx 1) }} 52 <a title="next file" href="#file-{{ $next.Name }}" class="{{ $iconstyle }}">{{ i "arrow-down" "w-4 h-4" }}</a> 53 {{ end }} 54 </div> 55 56 </div> 57 </summary> 58 59 <div class="transition-all duration-700 ease-in-out"> 60 {{ if .Status.IsUnchanged }} 61 <p class="text-center text-gray-400 dark:text-gray-500 p-4"> 62 This file has not been changed. 63 </p> 64 {{ else if .Status.IsRebased }} 65 <p class="text-center text-gray-400 dark:text-gray-500 p-4"> 66 This patch was likely rebased, as context lines do not match. 67 </p> 68 {{ else if .Status.IsError }} 69 <p class="text-center text-gray-400 dark:text-gray-500 p-4"> 70 Failed to calculate interdiff for this file. 71 </p> 72 {{ else }} 73 {{ if $isSplit }} 74 {{- template "repo/fragments/splitDiff" .Split -}} 75 {{ else }} 76 {{- template "repo/fragments/unifiedDiff" . -}} 77 {{ end }} 78 {{- end -}} 79 </div> 80 81 </details> 82 83 </div> 84 </div> 85 </section> 86 {{ end }} 87 {{ end }} 88{{ end }} 89 90{{ define "statPill" }} 91 <div class="flex items-center font-mono text-sm"> 92 {{ if and .Insertions .Deletions }} 93 <span class="rounded-l p-1 select-none bg-green-100 text-green-700 dark:bg-green-800/50 dark:text-green-400">+{{ .Insertions }}</span> 94 <span class="rounded-r p-1 select-none bg-red-100 text-red-700 dark:bg-red-800/50 dark:text-red-400">-{{ .Deletions }}</span> 95 {{ else if .Insertions }} 96 <span class="rounded p-1 select-none bg-green-100 text-green-700 dark:bg-green-800/50 dark:text-green-400">+{{ .Insertions }}</span> 97 {{ else if .Deletions }} 98 <span class="rounded p-1 select-none bg-red-100 text-red-700 dark:bg-red-800/50 dark:text-red-400">-{{ .Deletions }}</span> 99 {{ end }} 100 </div> 101{{ end }}