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