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